Classic Chart X-Axis always show date not time

I have a classic chart that gets its data from a named query. The query consolidates the data by day. Therefore, I always want to show the date on the X-axis on the chart. However, I still want auto scaling because the user can change the dates. Is there a way to make the classic chart always show days in the X-Axis and not show time?

You could achieve this by adding the following override to your configure chart extension function:

#def configureChart(self, chart):
	from java.text import SimpleDateFormat
	domainAxis = chart.plot.domainAxis
	dateFormat = SimpleDateFormat("MM/dd/yyyy") #modify as needed
	domainAxis.setDateFormatOverride(dateFormat)
1 Like

That was perfect! Thank you. I was looking at the org.jfree.chart details all day yesterday and couldn't quite get it figured out!

1 Like