Reputation: 31
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.
Example: http://jsfiddle.net/G5S9L/1/
Any idea?
Upvotes: 0
Views: 5480
Reputation: 45079
==== V3+ ====
Set xAxis.type = "category"
with xAxis.uniqueNames = true
.
You read more about type
and uniqueNames
options.
Demo: https://jsfiddle.net/BlackLabel/6rj3xf0z/1/
==== PRE v3 ====
You need to use category index instead of category name, so the proper example will be:
series: [{
name: 'Severity-1',
data: [[1,20]] //0-DEV, 1-TEST, 2-Stage
},{
name: 'Severity-2',
data: [[1,20]]
}]
Upvotes: 2
Reputation: 22651
Did you try:
{"xAxis": { "type" : "category" .... } ... }
It should get category from your data.
Upvotes: 3
Reputation: 73
Hey Vipul Do you want something like this ? Please check the link below for the code.
series: [{
name: 'Severity-1',
data: [['TEST',20]]
},{
name: 'Severity-2',
data: [['TEST',20]]
}]
Upvotes: -2