如何删除条形图 x 轴上的小数值:Highcharts
How to remove decimal values on x-axis of bar chart : Highcharts
我在为条形图的 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;
你应该把 tickInterval: 1,
放在 yAxis
我在为条形图的 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;
你应该把 tickInterval: 1,
放在 yAxis