Changing color of bar chart?

Can we give diff sheds to 1 chart depending on xy position.

For eg. for 0-20 color of bar should be red.
20-40 color should be blue and so on ,

So 1 bar will have more colors , red blue and green etc 0-20 , 20 -40 and so on…

Is there any facility like this in ignition?

Not really. The colors are pretty static.

It is possible to set the bar chart’s “Extract Order” to “By Column” so each bar’s color is governed by the appropriate color in the “Series Colors” property. Through scripting you can set the “Series Colors” to different colors based on the values inside of the dataset. It is pretty hacky but it could work.

Hi Travix,

Thank you for your reply.
I got following code from your one of the post to change color through scripting. But I am really wondering how we compare with dataset.

from java.awt import Color
colors = [Color.green, Color.yellow, Color.red, Color.blue, Color.orange, Color.magenta, Color.gray]
event.source.parent.getComponent(‘Chart’).seriesColors = colors

I have 3 columns Date, V and R for bar chart. and according to value of R I want to set the series color.
For R between 10-20 - color should be red. for 20-30 color should be blue etc…

Thank you, and hope you get my question.

After looking into this I really don’t think there is a way to do what you want. I can put this in as a feature request to see if this might be possible to add sometime in the future.

I’m not sure I understand your question, but if you are looking at making the height of the bar based on I but the color of the bar a different color based on V, I have done this by using a standard chart component instead of the bar chart component, with the selection set to bar renderer.

Use scripting or your query to filter your single dataset into multiple data sets based on your value of V, where the dataset values for I that didn’t match V are set to 0. You can then set the color of each dataset to what you want (Red for R between 10-20, Blue for R between 20-30, etc.). Graph all of these items on the same X axis. In this way, it appears to be a single dataset being graphed, but each bar relates to the color desired.

Not sure if this is what you are looking for, but thought I would pass it along. I had a customer ask for their hourly production level to be color coded based on how close they were to target, and this is how I solved the issue.

Lance