我希望影响图从0基线开始,并沿负y方向展开。因此,在高图中,可以选择设置最小值和最大值以调整轴范围。但是它不能准确地工作。 y轴c我希望它为负值,因为它的值将为负百分比值。
chart: {
// type: 'column',
zoomType: "xy",
},
xAxis: [
{
categories:['a','b','c','d','e','f','g'],
crosshair: true,
},
],
yAxis: [
{
// Primary yAxis
min:0,
labels: {
format: "{value} In Million $",
style: {
color: Highcharts.getOptions().colors[0],
},
},
title: {
text: "A",
style: {
color: Highcharts.getOptions().colors[0],
},
},
opposite: false,
},
{
// Secondary yAxis,
min:0,
gridLineWidth: 0,
title: {
text: "B",
style: {
color: Highcharts.getOptions().colors[1],
},
},
labels: {
format: "{value} In Million $",
style: {
color: Highcharts.getOptions().colors[1],
},
},
opposite: true,
},
{
// Tertiary yAxis
min:-0.1,
startOnTick: -10,
endOnTick:-10,
,
title: {
text: "C",
style: {
color: Highcharts.getOptions().colors[2],
},
},
labels: {
format: '{value} %',
style: {
color: Highcharts.getOptions().colors[2]
}
},
opposite: true,
credits: {
enabled: false
}
},
],
tooltip: {
shared: true,
},
series: data,
};
我还在数据系列中将阈值选项也指定为true
data.forEach((item) => {
if (key == "A") {
obj["name"] = key;
obj["type"] = "column";
obj["yAxis"] = 0;
obj["threshold"] = 0;
obj["data"].push(item[key]);
obj["tooltip"]["valueSuffix"] = "In Million $";
}
if (key == "B") {
obj["name"] = key;
obj["type"] = "column";
obj["yAxis"] = 1;
obj["threshold"] = 0;
obj["data"].push(item[key]);
obj["tooltip"]["valueSuffix"] = "In Million $";
}
if (key == "C") {
obj["name"] = key;
obj["type"] = "column";
obj["yAxis"] = 2;
obj["threshold"] = 0;
obj["data"].push(item[key]);
obj["tooltip"]["valueSuffix"] = "%";
}
});
我想要这样的东西:
提前感谢!
使用top
和height
属性以所需的方式放置轴。
yAxis: [{
height: '50%'
}, {
top: '50%',
height: '50%',
offset: 0,
opposite: true
}]
实时演示: http://jsfiddle.net/BlackLabel/wrzLqsju/
API参考: