# Jfree chart colour change issue

**URL:** <https://forum.inductiveautomation.com/t/jfree-chart-colour-change-issue/35205>\
**Category:** Ignition\
**Created:** [June 1, 2020, 12:48pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-colour-change-issue/35205 "2020-06-01T12:48:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![theerthraj.munusamy](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@theerthraj.munusamy](https://forum.inductiveautomation.com/u/theerthraj.munusamy)\
**Post date:** [June 1, 2020, 12:48pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-colour-change-issue/35205/1 "2020-06-01T12:48:41Z")

</div>

Hi,

I have a chart with 4 datasets and 2 subplots (2 datasets plotted on each subplot). I want to show only shapes for subplot 1 and series 0. If I use below code, it changes the colour for both the subplots series 0.

```auto
chartObj = event.source
chart = chartObj.chart
plot = chart.getXYPlot()
	
line_shape = XYLineAndShapeRenderer()
	
line_shape.setSeriesShape(0, Rectangle2D.Double(-3, -3, 6, 6)) 	
line_shape.setSeriesShapesFilled(0, 1)									
line_shape.setSeriesLinesVisible(0, 0)						
	
plot.setRenderer(line_shape)
#print plot.getDataset(0)
plot.getRendererForDataset(plot.getDataset(0)).setSeriesPaint(0, Color.red)	#Sets the colour

```

Additionally, print plot.getDataset(0) returns None. Anyway I can make this happen only in subplot 1.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 1, 2020, 1:23pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-colour-change-issue/35205/2 "2020-06-01T13:23:33Z")

</div>

You need to get the subplots.  
plot.getSubplots()

---

<div class="post-metadata">

**Author:** ![theerthraj.munusamy](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@theerthraj.munusamy](https://forum.inductiveautomation.com/u/theerthraj.munusamy)\
**Post date:** [June 1, 2020, 3:30pm UTC](https://forum.inductiveautomation.com/t/jfree-chart-colour-change-issue/35205/4 "2020-06-01T15:30:31Z")

</div>

Damn I didn’t think about that. Thank you very much.
