Reputation: 1
i have some data as given below i want to show it as stack bar chart like https://www.highcharts.com/demo/highcharts/column-stacked-and-grouped
User Group | User | Value |
---|---|---|
A | a | 2 |
A | b | 3 |
A | c | 3 |
B | e | 4 |
B | f | 5 |
current chart options that i am using are
{
chartOptions :{
chart:{
type:'column'
},
data:{
csv:<table_data>
},
plotOptions:{
column:{
stacking:'normal'
}
}
...
}
}
is their any option for me for configure Highchart to group data and show stack chart.
I have tried seriesMapping but it is not working for me. The last way is to manually grouping data and generating configuration but it will create to much complexity to my already existing application also it can cause bugs for other charts that i am generating.
If their is any other way than above please let me know
Upvotes: 0
Views: 41
Reputation: 1
I was unable to auto populate stack chart with csv data. I went with manually processing it and providing it in format that Highchart like which looks like below:
chartOptions = {
chart:{
type:"column"
},
categories:['A', 'B'], // I was passing list of group
plotOptions: {
column: {
stacking:"normal"
}
},
series: [{name:'a', data:[2,null]}, {name:'b', data:[3,0]...]
}
This is the only solution as for now.
Upvotes: 0
Reputation: 206
Please mind that Highcharts itself, in principle, expects that your data format is consistent and prepared upfront. At the same time there are some options with the data module. With the data module enabled, you can directly get the data from the table as described in the documentation here: https://www.highcharts.com/docs/working-with-data/data-module#loading-data-from-a-table
And then, for stacked and grouped column chart you need to use plotOptions.column.stacking combined with series.column.stack
I hope this helps.
Upvotes: 1