如何隐藏highchart x轴数据值
我正在使用 highchart.js
绘制条形图
我不想显示 x 轴数据值。
谁能告诉我是哪个选项吗?
完整配置:
var chart = new Highcharts.Chart({
chart: {
renderTo: container,
defaultSeriesType: 'bar'
},
title: {
text: null
},
subtitle: {
text: null
},
xAxis: {
categories: [''],
title: {
text: null
},
labels: {enabled:true,y : 20, rotation: -45, align: 'right' }
},
yAxis: {
min: 0,
gridLineWidth: 0,
title: {
text: '',
align: 'high'
}
},
tooltip: {
formatter: function () {
return '';
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
},
pointWidth: 35,
color: '#D9CDC1'
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [{
name: 'Year 1800',
data: [107]
}]
});
I am drawing a bar chart using highchart.js
I do not want to show the x - axis data values.
Can any one tell me which option does it?
full config:
var chart = new Highcharts.Chart({
chart: {
renderTo: container,
defaultSeriesType: 'bar'
},
title: {
text: null
},
subtitle: {
text: null
},
xAxis: {
categories: [''],
title: {
text: null
},
labels: {enabled:true,y : 20, rotation: -45, align: 'right' }
},
yAxis: {
min: 0,
gridLineWidth: 0,
title: {
text: '',
align: 'high'
}
},
tooltip: {
formatter: function () {
return '';
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
},
pointWidth: 35,
color: '#D9CDC1'
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [{
name: 'Year 1800',
data: [107]
}]
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 HighCharts 中,条形图使用倒轴,因此底部轴实际上是 Y 轴。 (另请参见“柱形”图,其中图形旋转 90 度,在这种情况下,底轴是 X 轴。)
您需要将以下内容添加到 yAxis 配置中,
请参阅以下内容以获取完整示例:
http://jsfiddle.net/k5yBj/433/
In HighCharts, bar graphs use inverted axes, so the bottom axis is really the Y axis. (See also "column" graphs where the graphic is rotated 90 degrees, in which case the bottom axis is the X axis.)
You need to add the following to the yAxis config
See the following for full example:
http://jsfiddle.net/k5yBj/433/
要隐藏 X 轴上的标签,请设置选项
labels: {enabled:false}
,如下所示:要隐藏 y 轴上的标签,请设置选项
labels: {enabled:false}
> 像这样:请参阅文档以进一步了解。
To hide labels on X-axis set the option
labels: {enabled:false}
like this:To hide labels on y-axis set the option
labels: {enabled:false}
like this:Refer the documentation for futher understanding.
上面流行的答案仅隐藏标签,这给我留下了刻度线,我也希望将其删除。
在这种情况下,效果很好。
对于任何感兴趣的人来说,这是一个简单的解决方案,可以删除 x/y 轴上的所有内容。有关更多信息,请查看此处 https://api.highcharts.com/highcharts/xAxis.visible
The above popular answer hides the labels only, this left tick marks for me which I also wished to remove.
In that case this works well
This is a simple solution to remove everything on the x/y axis for anyone interested. For more information please look here https://api.highcharts.com/highcharts/xAxis.visible
如果隐藏x数据,那么看看这个
https://jsfiddle.net/anrilafosel/3g4z5kc3/
If hiding x data, then look at this
https://jsfiddle.net/anrilafosel/3g4z5kc3/