# JFreeChart Can't Hide Second Legend Item?

**URL:** <https://forum.inductiveautomation.com/t/jfreechart-cant-hide-second-legend-item/86971>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 7, 2024, 2:09pm UTC](https://forum.inductiveautomation.com/t/jfreechart-cant-hide-second-legend-item/86971 "2024-03-07T14:09:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawn\_Rieger1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger1/32/57040_2.png) [@Shawn\_Rieger1](https://forum.inductiveautomation.com/u/Shawn_Rieger1)\
**Post date:** [March 7, 2024, 2:09pm UTC](https://forum.inductiveautomation.com/t/jfreechart-cant-hide-second-legend-item/86971/1 "2024-03-07T14:09:16Z")

</div>

The following is working in my report to hide the first legend item. However, I want to hide the second. Logic says to pass index 1 instead of 0, but this doesn't work. What am I missing?

```auto
xyplot = chart.plot
xyplot.getRenderer().setSeriesVisibleInLegend(0, False) # this works

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/693265fdb806fc344e63f87c0a29460eb8b61c1d.png)

```auto
xyplot = chart.plot
xyplot.getRenderer().setSeriesVisibleInLegend(1, False) # this does nothing

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/b/3b37facd78c54d98557bc8d0110fc4624e79a72e.png)

---

<div class="post-metadata">

**Author:** ![Shawn\_Rieger1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/shawn_rieger1/32/57040_2.png) [@Shawn\_Rieger1](https://forum.inductiveautomation.com/u/Shawn_Rieger1)\
**Post date:** [March 7, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/jfreechart-cant-hide-second-legend-item/86971/2 "2024-03-07T14:57:31Z")

</div>

For now, I've set the pens so the one I want to hide is first. This works but is not a solution. If anyone has any insight on this please let me know!

---

<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:** [March 7, 2024, 3:19pm UTC](https://forum.inductiveautomation.com/t/jfreechart-cant-hide-second-legend-item/86971/3 "2024-03-07T15:19:40Z")

</div>

You probably want to use [.getRenderer(int)](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/plot/XYPlot.html#getRenderer-int-), not plain `.getRenderer()`.
