Changing colors on Chart

I have a chart with a dataset that has 5 columns.

I want to change the colors of columns3 and 4.
This is the only way on the forum I have found to change series colors

colors = [sameColor, sameColor, ANOTHERCOLOR, ANOTHERCOLOR,, Color.gray]
chart = event.source.parent.getComponent('Chart 1')

How would I leave the first two serieses alone?

Also, is there another location I could go to to look for answers to this kind of stuff?



You would get the current series colors and update only the ones you want to change:from java.awt import Color chart = event.source.parent.getComponent('Chart 1') colors = chart.getDynamicProps().get("ranges").getRenderer().getSeriesColors() colors[2] = Color(255,0,255) colors[3] = Color(255,0,255) chart.getDynamicProps().get("ranges").getRenderer().setSeriesColors(colors)


How the heck was I supposed to know there is a function called getSeriesColors() though?

Searching for it on the forum doesn’t give me anything.

Is there a place to look to find all this stuff?

Unfortunately, that is an undocumented function. In Java there will usually be a set function and a get function for each variable. The classic chart needs to be updated and have more documentation.

Good to know. I really appreciate it.

I guess it’s a good thing you guys have such a fast support team.

Have a great day,


One more question.

This may seem odd, but when I change the colors of a dataset like you showed me it changes the colors for all the datasets (even if I specify which one), which is doesn’t help me.

Can you replicate this and/or do you have a solution?

It should only change the “ranges” dataset. When you open the chart customizer, and look at the dataset properties, the series colors are the exact same?

Yes. Not sure why, but when I copied the chart and put it back it worked fine.

Thanks for the help.