Highcharts - 即使没有数据,也会显示x轴上的强制类别 [英] Highcharts - Force Categories in x-axis to be shown, even without data

查看:62
本文介绍了Highcharts - 即使没有数据,也会显示x轴上的强制类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法强制Highcharts显示传入其x轴的所有类别,而不提供填充数据来破解它的工作。例如, http://jsfiddle.net/cbargren/Sdnqu/ 有3个额外的x轴类别指定(foo,bar,baz)而没有任何实际数据(系列不一定具有相应类别的数据),并且它们不显示在图表上。这可以做到吗?谢谢!

I'm wondering if there's a way to force Highcharts to show ALL of the categories passed into its x-axis without giving filler data to hack it into working. For example, http://jsfiddle.net/cbargren/Sdnqu/ has 3 extra x-axis categories specified (foo, bar, baz) without any actual data (the series won't necessarily have data for the respective categories), and they aren't showing up on the chart. Can this be done? Thanks!

推荐答案

将xAxis上的最大值设置为要显示的最后一个类别的索引。看这 jsfiddle

Set the max on the xAxis to the index of the last category you want to show. See this jsfiddle

xAxis: {
       categories: ['Apples', 'Bananas', 'Pears', 'Oranges', 'foo', 'bar', 'baz'],
       max:6
},

这篇关于Highcharts - 即使没有数据,也会显示x轴上的强制类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆