# Chart renderer not working

**URL:** <https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593>\
**Category:** General Discussion\
**Created:** [January 24, 2020, 2:47pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593 "2020-01-24T14:47:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![leversole](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@leversole](https://forum.inductiveautomation.com/u/leversole)\
**Post date:** [January 24, 2020, 2:47pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/1 "2020-01-24T14:47:59Z")

</div>

I am trying to change the pen colors on a normal XY chart using the following code…

from java.awt import Color

```
chart = event.source.parent.getComponent('chart1')
colors = chart.getDynamicProps().get("ranges").getRenderer().getSeriesColors()
colors[0] = Color(255,230,0)
chart.getDynamicProps().get("ranges").getRenderer().setSeriesColors(colors)

```

I get the following error…

File “”, line 22, in configureChart  
NameError: global name ‘event’ is not defined

Not sure what is going on…

there is only one data series of data…

Thank You

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 24, 2020, 4:34pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/2 "2020-01-24T16:34:56Z")

</div>

configureChart isn’t an event. So it doesn’t have an event variable. Look at the top line to see the arguments passed in. Construct your code with those. For example, use `self` instead of `event.source`.

---

<div class="post-metadata">

**Author:** ![leversole](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@leversole](https://forum.inductiveautomation.com/u/leversole)\
**Post date:** [January 24, 2020, 4:41pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/3 "2020-01-24T16:41:47Z")

</div>

Thanks! I thought I tried that but will try again!

---

<div class="post-metadata">

**Author:** ![leversole](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@leversole](https://forum.inductiveautomation.com/u/leversole)\
**Post date:** [January 24, 2020, 4:59pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/4 "2020-01-24T16:59:57Z")

</div>

I must be missing something above my Ignition knowlege!

the args passed in are self and chart…

simply replacing event.source with self does not work…

assuming self is the object,

colors = self.getDynamicProps().get(“ranges”).getRenderer().getSeriesColors()

doesnt work either…both die with the same error, “Nonetype has no attribute renderer”

Still at a loss…

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 24, 2020, 6:14pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/5 "2020-01-24T18:14:07Z")

</div>

You’ve cut and pasted code that doesn’t seem to be for an XY Chart (classic chart in XY Plot mode). (A button with some customized chart as a sibling, it seems.) The `getDynamicProps("ranges")` looks suspicious/custom. The only dynamic props in the classic chart are the data series.

---

<div class="post-metadata">

**Author:** ![leversole](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@leversole](https://forum.inductiveautomation.com/u/leversole)\
**Post date:** [January 24, 2020, 7:12pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/6 "2020-01-24T19:12:16Z")

</div>

Hmmm…I got the code from the forum…dated back to 2013…anyhow,  
is there a way to dynamically change a series color on an xy chart?

I didn’t want to just ask without demonstrating that I put some effort into it…😉

Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 24, 2020, 7:17pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/7 "2020-01-24T19:17:30Z")

</div>

Almost certainly. I just haven’t done exactly that, so have no code to supply. The comment in the configureChart() extension function is your next step: dig into the [JFreeChart](http://www.jfree.org/jfreechart/api/javadoc/) library.

---

<div class="post-metadata">

**Author:** ![leversole](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@leversole](https://forum.inductiveautomation.com/u/leversole)\
**Post date:** [January 24, 2020, 7:41pm UTC](https://forum.inductiveautomation.com/t/chart-renderer-not-working/31593/8 "2020-01-24T19:41:13Z")

</div>

Thanks!
