[英]Specify X-Axis Category in Series Data in Highcharts
I am trying to implement a stacked bar graph and I would like to understand if there is anyway that we can specify the category along with the data point in series. 我正在尝试实现一个堆积的条形图,我想了解是否无论如何我们都可以指定类别以及串联的数据点。
I have Categories as : 我的类别为:
xAxis: {
categories: ['DEV', 'TEST', 'Stage']
},
Series data: 系列数据:
series: [{
name: 'Severity-1',
data: [['TEST',20]]
},{
name: 'Severity-2',
data: [['TEST',20]]
}]
In above snippet I am trying to add a point value '30' to 'TEST' category but when I load the graph it shows up under 'DEV' category. 在上面的代码片段中,我试图将点值“ 30”添加到“测试”类别中,但是当我加载图形时,它显示在“开发”类别下。
Example: http://jsfiddle.net/G5S9L/1/ 示例: http : //jsfiddle.net/G5S9L/1/
Any idea? 任何想法?
You need to use category index instead of category name, so proper example will be: 您需要使用类别索引而不是类别名称,因此正确的示例将是:
series: [{
name: 'Severity-1',
data: [[1,20]] //0-DEV, 1-TEST, 2-Stage
},{
name: 'Severity-2',
data: [[1,20]]
}]
Did you try: 你试过了吗:
{"xAxis": { "type" : "category" .... } ... }
It should get category from your data. 它应该从您的数据中获取类别。
Hey Vipul Do you want something like this ? 嘿Vipul您想要这样的东西吗? Please check the link below for the code.
请检查下面的链接以获取代码。
series: [{
name: 'Severity-1',
data: [['TEST',20]]
},{
name: 'Severity-2',
data: [['TEST',20]]
}]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.