Time format on Easy Chart X-axis and X-Trace

I cannot find a property where I can set the default date/time format for the whole of Ignition or the date/time format used by EasyChart for X-axis times and X-Trace times.
I am running v8.1.31 on W10 in Europe.

W10 formats date and time like this, which is how I would want it.
image
This is according to my OS settings.

The gateway formats like this on the Status/Performance page
image
Looks good.

The gateway on its Status/Overview page, section Environment says:
Local time: 2:15:07 PM
which is obviously not according to my 'locale'

And the EasyChart looks like this:
image
I'd rather have it like 13 Oct 2023 or 13-Oct-2023 and 13:45:29, like everybody in this corner of the world.

Where should I look to get this right?
Thanks

Did some poking around with one of my trending pages and think I found what you're looking for. Under the easy chart's 'Historical Range' header, there should be a property called 'Time Style' that can be changed from Auto, 12HR, or 24HR. Snips for reference below:
EZchartTime
EZChartTime2

Also, welcome to the forum!

That fixes the time. How about the date?

The prop above, 'Date Style,' will allow coarse changes: selections for MDY, DMY, YMD. I assume for finer tuning you'd need to use an extension function like configureChart.

Something like your script below @justinedwards.jle, from this post could likely be tweaked to get specific results:

# Written for the configureChart extension function 
#def configureChart(self, chart):
	from java.text import SimpleDateFormat
	from org.jfree.chart.axis import DateAxis
	pureDateFormat = SimpleDateFormat("")
	pureTimeFormat = SimpleDateFormat("")			
	dateAxis = DateAxis()
	plot = chart.getPlot()
	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)

The last time I tried 'YMD' it didn't effect the crosshair label, but it's been a while since I looked at that, so it's possible they have fixed it. If so, that would be the preferable solution.

@justinedwards.jle pointed me toward a similar script that's closer to what you're looking for @LenRem1. Code as follows:

def configureChart(self, chart):
	from java.text import SimpleDateFormat
	from org.jfree.chart.axis import DateAxis
	pureDateFormat = SimpleDateFormat("yyyy/MM/dd")
	pureTimeFormat = SimpleDateFormat("h:mm:ss a z")			
	dateAxis = DateAxis()
	plot = chart.getPlot()
	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)

With only "" inside the SimpleDateFormat argument (from the first script), the date/time tooltip would be removed. Filling that argument with your desired format should get you there.

The only difference is that a string representation of the date format is passed into SimpleDatFormat. Without it, the crosshair label disappears. At least that is the way it behaved in a basic chart. I'm not sure if I've ever applied that script to the Easy Chart, so I can't confirm what the result will be

Out of curiosity, where does this script run?

The configureChart extension function in a basic chart is what I wrote it for.

1 Like

Ah yeah I see now, bit of a dumb question lol. Haven't dived too deep into extension functions yet. For some reason was thinking it would need to sit in a custom property writing to some properties on the chart.

Time is ok now.
Date is more involved. Setting to DMY gives me 13/10/2023 on the X-trace and 13 Oct, 2023 below the x-axis. That is kind of acceptable.
I'll go and see if I can plug in a variation of those scripts sowewhere.
Thank you all!

2 Likes