# Changing colors on Chart

**URL:** <https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776>\
**Category:** Ignition\
**Created:** [January 31, 2013, 8:15pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776 "2013-01-31T20:15:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [January 31, 2013, 8:15pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/1 "2013-01-31T20:15:43Z")

</div>

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

```auto
colors = [sameColor, sameColor, ANOTHERCOLOR, ANOTHERCOLOR, Color.orange, Color.gray]
chart = event.source.parent.getComponent('Chart 1')
chart.getDynamicProps().get("ranges").getRenderer().setSeriesColors(colors)
```

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?

Thanks,

Mike

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 31, 2013, 8:30pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/2 "2013-01-31T20:30:13Z")

</div>

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)`

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [January 31, 2013, 8:56pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/3 "2013-01-31T20:56:31Z")

</div>

Great!

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?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 31, 2013, 9:00pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/4 "2013-01-31T21:00:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [January 31, 2013, 9:12pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/5 "2013-01-31T21:12:07Z")

</div>

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,

Mike

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [February 12, 2013, 7:26pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/6 "2013-02-12T19:26:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [February 12, 2013, 8:36pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/7 "2013-02-12T20:36:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mikehill100](https://avatars.discourse-cdn.com/v4/letter/m/bcef8e/32.png) [@mikehill100](https://forum.inductiveautomation.com/u/mikehill100)\
**Post date:** [February 22, 2013, 9:04pm UTC](https://forum.inductiveautomation.com/t/changing-colors-on-chart/5776/8 "2013-02-22T21:04:04Z")

</div>

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

Thanks for the help.

Mike
