Hi, I’m attempting to dynamically assign colors to a pie chart in the reporting module. I was successfully able to do this on a table component with a simple drag-n-drop binding. I was also able to do this on a bar chart with the “enable script” option. Unfortunately, the pie chart is the only chart without a script option so I’m not sure how to go about this (or if it’s even possible).
Edit: I essentially just want to be able to associate a state with a color on the pie chart, so that ‘running’ is always green for example.
Thanks,
Ryan
1 Like
Hi Ryan,
When you were able to drag-n-drop the binding and view the script options on the table and bar chart component, are these in the Report Modules?
The Report Module components properties are not able to be bound or scripted on.
In regards to the Pie Chart in Reports, you are able to change the colors based off the data keys.
I have attached the some links that can be helpful:
https://docs.inductiveautomation.com/display/DOC81/Report+-+Pie+Chart
Very old thread, which was left unanswered. But to answer this question, there is no way to create a script in the Pie Chart. All other chart type have a script for this but not this one.
I've checked the video that Beatriz shared, There is no way to change the color based of the data keys.
Let's say i have:
- Runtime: 60
- Fault: 5
- Maintenance: 35
If they are always showing up in this order, the order of the pens colors Statically fixed will always be the same. So if i have Runtime in Green, Fault in Red, Maintenance in Yellow, and for some reason the resultset come in another order: Fault, Running, Maintenance, Fault will become Green.
That was the whole point of the question here: Can it be done dynamically? No.
The only workarround for this would be to:
- Fetch the data from your DB
- Create a dataset dynamically in the data tab, to make sure that the status always come in the same order so the statically assigned pen will always match the right status
- And use this new dataset for your pie chart
I hope it will help someone
As of Ignition 8.1.28, this oversight has been fixed:
1 Like
Thanks for this update! I was not aware of this changes. The server i'm developping on is 8.1.17. I'll suggest an update.
1 Like