如何去除条形图X轴上的小数点值: highcharts

v09wglhw  于 2022-11-10  发布在  Highcharts
关注(0)|答案(1)|浏览(356)

我在条形图的X轴上设置仅整数值时遇到问题。有人能帮助我解决这个问题吗?
这是我的沙箱:https://codesandbox.io/s/react-line-chart-forked-0409lk?file=/src/LineChart.js
我试过了,allowDecimal: false, min:0, float:0。没有成功。
感谢您的帮助

import * as React from "react";
import Highcharts from "highcharts";
import HighchartsReact from "highcharts-react-official";
import HC_exporting from "highcharts/modules/exporting";
HC_exporting(Highcharts);

function Chart(props) {
  const chartOptions = {
    chart: {
      type: "bar",
      height: 250
    },
    xAxis: {
      type: "category",
      visible: true,
      gridLineWidth: 1,
      floor: 0,
      tickInterval: 1,
      min: 0
    },
    yAxis: {
      min: 0,
      title: {
        text: null
      }
    },
    plotOptions: {
      column: {
        dataLabels: {
          enabled: true,
          crop: false,
          overflow: "none"
        }
      }
    },
    series: [{ data: props.chartData }]
  };
  return <HighchartsReact highcharts={Highcharts} options={chartOptions} />;
}

export default Chart;

相关问题