I have a number of charts in a dashboard. However there is one chart I require that is a stacked and grouped column chart. Similar to:

Image result for stacked clustered column chart

In my case, the columns are comprised of "SubTags" which I want to group, like above, by "Tags".

I have managed to create the graph below with stacked SubTags (apologies for lack of data). However I would like to group them like above by the "Tag". You can see below that I have 2 columns where this would be applicable - "Illumination - Third Party Site" and "Illumination - Office", similarly, "PPE - Head Protection" and "PPE - Gloves" 


I have looked in the Highcharts API and found the following sample, and I see that you are able to label a series "Stack" but I am unsure how to do this with the DataPoint List I am creating to populate the Chart. 

https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/column-stacked-and-grouped/

Unfortunately my application is quite complicated so I cant share an .oml. 

Any help would be greatly appreciated. 

C

Hello Maria, 

Thanks for your reply, I have read that, and have managed to implement Stacked Column Charts, including in my example above. 

Currently for the stacked Column I have 4 series, which are on the legend, But I want to group all the Illumination related columns together.
When I try just using the "Tag" as the Data Point Label I get:


The action which creates this: 

It cycles through all the Subtags for each Tag - and the SQL generates the number of counts for each category (safe act, Safe Condition, Unsafe Act, Unsafe Condition) which are all added with a different DataSeriesName as below:


The tool tip gives me the correct information as you would imagine, but i just need it to group all of the Subtags based on its related Tag. 

Hope that gives more information.


Hi Christopher,


The grouping you are referring to, is probably not going to be the solution for you.  As far as I can tell, it's intended to create some sort of middle ground between unstacked and stacked column charts : it allows to apply grouping to entire series.

So in your example, it would make sense to have one stack with all the safe series, and another stack with all the unsafe series on top of each other.

If you would still like to give it a try, what you're really asking is how can you add this extra 'stack' feature to the series, right ?  This can be done with the DataSeriesFormats parameter of the Advanced_Format_Init action.

For each serie, you add a DataSeriesFormat record to this list, with the name and the format,which would be something like :


SyntaxEditor Code Snippet

"
stack: 'Boring'
"


For your use case, it might be interesting to have some sort of drill down chart, showing illumination, and then going down to more detail level when clicked...

If you can't find a suitable chart, maybe color coding, or using plot bands might be an option...


Good luck,

Dorine

Thank you for your reply Dorine! 

I think the functionality I require is the "Stack" feature, which I did notice on Highcharts API but not sure how to implement. 

I use the Advanced_Format_Init on the chart in question already, to add HighchartsJSON, but how would I be able to add the Stack feature for a specific set of points or series? Do I need to return an AdvancedDataSeriesFormat List along with the DataPoint List?


The action that creates the Data Point List is a Function that is the source of the chart as all it returns is the DataPoint List, would I have to change the action to no longer be a function?


Thanks

Chris

Hi Christopher,


I made a demo oml to show how to use the stack property of a series.  

So basically, you create 2 lists, the datapoint list you already had, and also an AdvancedDataSeriesFormatList, which holds all your series, and some JSON to apply the desired stack to each series.


You then use this list as a parameter to your AdvancedFormat_Init action


I didn't add any other formatting, in your oml the bottom parameter (HighchartsJSON) is probably also populated, right ?


Mind you, you apply it on a whole series, not just some random points, so I'm still not seeing how you will make that work for what I understand to be different levels of detail on your x axis.  In my example, beers are all of a particular beer style, If I would like to visually group styles together on the X axis and show the beer style name, I couldn't achieve that with this 'stack' feature.

If I have time, I'll look into improving on this OML to find a solution for that in some other way.

Hope this gets you started at least,

Dorine


Edit : what you are looking for looks a lot like this : http://blacklabel.github.io/grouped_categories/

Hello Dorine, 


Thank you again for helping with this. 


http://blacklabel.github.io/grouped_categories/ - This is almost exactly what I am looking for, but hopefully with the traffic lights too. 

I attempted to use the Data Series Format and name the "Stack" the HSEQTag.current.label but it doesnt seem to work. 

This is the data model of the relevant entities. Observations reference HSEQTags and HSEQ_SubTags but the relationship between tags and subtags is many to many.



Im not sure its possible since the data series is the traffic lights. I already have them sort of grouped as all the "Equipment" related HSEQ_SubTags are together. Might just be a formatting of the xaxis I require?