我在条形图的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;
1条答案
按热度按时间kupeojn61#
您应该将
tickInterval: 1,
放在y轴上