我正在发送数据集中的负值,并且在相应的工具提示中也显示了相同的值,但是我无法获得负条或图形移位的x轴。
我试图找到相同的正确配置,并尝试了这段代码。 我将这些比例发送到数据集,并更改了x轴和y轴的刻度。
scales = Object.assign({
xAxes: [
{
ticks: {
autoSkip: autoSkip,
maxTicksLimit: 2,
beginAtZero: true,
fontSize: 10,
callback: function(tick) {
const characterLimit = 6;
if (tick.length >= characterLimit) {
return tick.substring(0, 6) + "...";
}
return tick;
}
},
gridLines: {
display: false,
drawBorder: true
}
}
],
yAxes: [
{
id: "A",
type: "linear",
position: "left",
ticks: {
display: false,
suggestedMin: 0,
beginAtZero: true,
fontSize: 10
},
scaleLabel: {
display: false,
labelString: "Spend",
position: "left",
fontSize: 10
},
gridLines: {
display: false,
drawBorder: false
}
},
{
id: "B",
type: "linear",
position: "right",
scaleLabel: {
display: false,
labelString: labelRightYAxis,
position: "right",
fontSize: 10
},
ticks: {
suggestedMin: 0,
beginAtZero: true,
display: false,
fontSize: 10
},
gridLines: {
display: false,
drawBorder: false
}
}
]
});
我得到的结果是