# Dynamic report chart, legend not hiding unused pens

**URL:** <https://forum.inductiveautomation.com/t/dynamic-report-chart-legend-not-hiding-unused-pens/44565>\
**Category:** Ignition\
**Created:** [March 17, 2021, 9:04am UTC](https://forum.inductiveautomation.com/t/dynamic-report-chart-legend-not-hiding-unused-pens/44565 "2021-03-17T09:04:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 17, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/dynamic-report-chart-legend-not-hiding-unused-pens/44565/2 "2021-03-17T15:40:52Z")

</div>

Take a look at this other post of mine about changing the legend:

> [@EasyChart legend: increase key line width and change colours](http://forum.inductiveautomation.com/t/easychart-legend-increase-key-line-width-and-change-colours/15337/6):
>
> Well, that ended up being way more involved than I figured it would be. But because I enjoyed myself: (Preemptive disclaimer: Don’t even think of trying to call in to support if this doesn’t work for you) from org.jfree.chart.renderer.xy import XYLineAndShapeRenderer from org.jfree.chart import LegendItem legend = chart.getLegend() plot = chart.getPlot() renderer = plot.getRenderer() class CustomRenderer(XYLineAndShapeRenderer): def getLegendItem(self, dataset, series): original =…

The trick is to implement a 'custom' [`XYItemRenderer`](https://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/xy/XYItemRenderer.html) class that allows you to provide your own arbitrary set of legend items to display.

---

_[View the full topic](https://forum.inductiveautomation.com/t/dynamic-report-chart-legend-not-hiding-unused-pens/44565)._
