Help with Easy Chart Time Axis

I am struggling to format a chart time axis and I am hoping this community can help!

I have a real-time Easy Chart with a 30 minute time duration. By default, it puts gridlines every 2 minutes. I tried to change the gridline intervals by using the following script in configureChart (guided by script found in the forum):

plot = chart.getPlot()

from org.jfree.chart.axis import DateTickUnit

plot.domainAxis.tickUnit = DateTickUnit(DateTickUnit.MINUTE, 5)

That did change gridlines to every 5 minutes but it also changed the tick labels to show only the date with no time:

image

(Side note: it also stopped the scrolling feature of the real time chart but I found a workaround by copy and pasting the chart - the new copy will scroll)

I then tried to change the format of the time axis to show only the time (with no date) by using the following script (again, guided by script I found in the forum):

from org.jfree.chart.axis import DateAxis
from java.text import SimpleDateFormat

pureDateFormat = SimpleDateFormat("")
pureTimeFormat = SimpleDateFormat("HH:mm")
dateAxis = DateAxis()
plot.setDomainAxis(dateAxis)
plotField1 = plot.getClass().getDeclaredField('dateFormat')
plotField2 = plot.getClass().getDeclaredField('timeFormat')
plotField1.setAccessible(True)
plotField2.setAccessible(True)
plotField1.set(plot, pureDateFormat)
plotField2.set(plot, pureTimeFormat)

But then that reset the gridlines to every 2 minutes (and also changed the font of my tick labels).

If I change the order of the script to set the date format first, then set the 5 minute gridline interval, the date format resets to show the date and not the time. So it seems that one script overwrites the other.

Can anyone help me to set the gridline interval to 5 minutes and show the time instead of the date?

Much appreciated!