# Edit date format in CategoryChart in Report module

**URL:** <https://forum.inductiveautomation.com/t/edit-date-format-in-categorychart-in-report-module/55848>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 8, 2022, 7:43am UTC](https://forum.inductiveautomation.com/t/edit-date-format-in-categorychart-in-report-module/55848 "2022-02-08T07:43:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamuelsenLarsen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samuelsenlarsen/32/11901_2.png) [@SamuelsenLarsen](https://forum.inductiveautomation.com/u/SamuelsenLarsen)\
**Post date:** [February 8, 2022, 7:43am UTC](https://forum.inductiveautomation.com/t/edit-date-format-in-categorychart-in-report-module/55848/1 "2022-02-08T07:43:07Z")

</div>

Hi,  
I have not figure out how to edit the date format in CategoryChart in Report module.  
Tried to use this script

```auto
	from java.text import SimpleDateFormat
	from org.jfree.chart.axis import DateAxis
	from org.jfree.chart.axis.DateAxis import setDateFormatOverride
	plot = chart.getXYPlot()#getPlot()
	axis = plot.getDomainAxis()
	axis.setDateFormatOverride(SimpleDateFormat("dd-MM"))

```

But getting error

```auto
java.lang.ClassCastException: java.lang.ClassCastException: class org.jfree.chart.plot.CategoryPlot cannot be cast to class org.jfree.chart.plot.XYPlot (org.jfree.chart.plot.CategoryPlot and org.jfree.chart.plot.XYPlot are in unnamed module of loader java.net.URLClassLoader @38a2d98b)

```

- Stian

---

<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:** [February 8, 2022, 3:20pm UTC](https://forum.inductiveautomation.com/t/edit-date-format-in-categorychart-in-report-module/55848/2 "2022-02-08T15:20:35Z")

</div>

You’re asking the chart for its plot _as an XY plot_ - but it’s a category chart, so that step fails.

Go back to `getPlot()`, which will give you (some subclass of) [`CategoryPlot`](https://www.jfree.org/jfreechart/javadoc/org/jfree/chart/plot/CategoryPlot.html). From that, you would still use `getDomainAxis`, but you’ll get a [`CategoryAxis`](https://www.jfree.org/jfreechart/javadoc/org/jfree/chart/axis/CategoryAxis.html) of some kind.

From _that_ object, you’ll need to explore what type it is and what methods is has available. I don’t remember offhand if we provide our own implementation. I’d recommend looking up Phil Turmel’s `introspect.py` (search here on the forums) to explore the axis object you have.

At a guess, you won’t be able to provide a simple date format override; you’ll have to implement your own label generator or similar class to customize the formatting.

---

<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:** [February 8, 2022, 5:49pm UTC](https://forum.inductiveautomation.com/t/edit-date-format-in-categorychart-in-report-module/55848/3 "2022-02-08T17:49:19Z")

</div>

That would be the `introspect()` function in [inspect.py](https://www.automation-pros.com/ignition/inspect.py).
