在 highcharts 水平条形图中,我无法显示默认刻度
In highcharts horizontal bar chart, I can't display the default ticks
这是javascript中的图表代码:
Highcharts.chart(here, {
exporting: {
enabled: false
},
chart: {
type: "bar",
//width: 300,
//height: 60,
width: 800,
height: 160,
margin: [0, 0, 0, 0]
},
title: {
text: null
},
xAxis: {
categories: ["Default category name"],
title: {
text: "testo uno"
},
//labels: {
// enabled: true
//},
opposite: true,
tickInterval: 1
},
yAxis: {
max: maximum,
min: 0,
title: {
text: "testo due"
}
//labels: {
// enabled: true
// }
},
tooltip: {
enabled: true,
valueSuffix: " millions"
},
plotOptions: {
series: {
pointPadding: 0.3,
groupPadding: 0.1,
animation: false
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [
{
name: "Name number one",
data: [v1],
color: "rgb(251, 147, 53)"
},
{
name: "Name number two",
data: [v2],
color: "rgb(128, 128, 128)"
},
{
name: "Name number three",
data: [v3],
color: "rgb(137, 196, 76)"
}
]
});
我希望默认刻度的标签显示在顶部。我似乎无法得到这些,我尝试将 labels{enabled} 设置为 false,以及其他一些东西,但我似乎无法让刻度标签显示在顶部。请查看随附的屏幕截图以查看我想要刻度线的位置。有什么建议么?
您需要为标签设置 space,例如保持默认边距并将 yAxis.opposite
设置为 true。
在API中我们可以读到:
margin: number, Array.
...
By default there is no margin. The actual space is dynamically
calculated from the offset of axis labels, axis title, title, subtitle
and legend in addition to the spacingTop, spacingRight, spacingBottom
and spacingLeft options.
yAxis: {
opposite: true,
...
}
现场演示: http://jsfiddle.net/BlackLabel/9rgjdesw/
API参考:
这是javascript中的图表代码:
Highcharts.chart(here, {
exporting: {
enabled: false
},
chart: {
type: "bar",
//width: 300,
//height: 60,
width: 800,
height: 160,
margin: [0, 0, 0, 0]
},
title: {
text: null
},
xAxis: {
categories: ["Default category name"],
title: {
text: "testo uno"
},
//labels: {
// enabled: true
//},
opposite: true,
tickInterval: 1
},
yAxis: {
max: maximum,
min: 0,
title: {
text: "testo due"
}
//labels: {
// enabled: true
// }
},
tooltip: {
enabled: true,
valueSuffix: " millions"
},
plotOptions: {
series: {
pointPadding: 0.3,
groupPadding: 0.1,
animation: false
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [
{
name: "Name number one",
data: [v1],
color: "rgb(251, 147, 53)"
},
{
name: "Name number two",
data: [v2],
color: "rgb(128, 128, 128)"
},
{
name: "Name number three",
data: [v3],
color: "rgb(137, 196, 76)"
}
]
});
我希望默认刻度的标签显示在顶部。我似乎无法得到这些,我尝试将 labels{enabled} 设置为 false,以及其他一些东西,但我似乎无法让刻度标签显示在顶部。请查看随附的屏幕截图以查看我想要刻度线的位置。有什么建议么?
您需要为标签设置 space,例如保持默认边距并将 yAxis.opposite
设置为 true。
在API中我们可以读到:
margin: number, Array.
...
By default there is no margin. The actual space is dynamically calculated from the offset of axis labels, axis title, title, subtitle and legend in addition to the spacingTop, spacingRight, spacingBottom and spacingLeft options.
yAxis: {
opposite: true,
...
}
现场演示: http://jsfiddle.net/BlackLabel/9rgjdesw/
API参考: