Time Series Chart Set Date Interval?

I am using a time series chart in a report I am designing. I am having an issuing trying to figure out how to use the jfreechart scripting.

If the user inputs a small enough date range then the time axis will display 12/10, 12/11, 12/11, 12/12, 12/12, …

I would like to set it so that there is only one day listed at a time.

If possible I would like to set it up so every tick actually correlates to the plotted point, but I will settle for getting the auto range to only display one day at a time.

Does anyone have any advice or help on this?

In your configureChart script, include the following:

	from org.jfree.chart import axis
	plot = chart.getPlot()
	plot_axis = plot.getDomainAxis()

	plot_axis.setTickUnit(axis.DateTickUnit(axis.DateTickUnit.DAY, 1))

For a small dataset of just 3 points this yielded the following chart:

It’s not perfect but it is closer!

Thank you, That is exactly what I was trying to do.

1 Like