how to format date on x-axis in charts?

I am trying to create a chart with lines where dates on the x-axis. The periods between the dates are different. First i selected a category dataset. The only problem was the formatting of the dates which i need in a dd.MM.yy pattern. Other as is in normal reports there is no pattern item. I tried to edit the xml-file but this was not successful. Next step was to try it with a time series dataset. There a period was asked for but as just mentioned a fix period doesn't exist.

The Ultimate Guide doesn't tell anything to this.

Would be more than happy for help.
Another question: is there a documentation about jrxml available?

Michael Fischer


kuquadrat_1's picture
Joined: Aug 16 2013 - 11:14pm
Last seen: 1 year 5 months ago

2 Answers:

Hi Michael,

you could have formatted the dates in your line chart in the category expression directly (in java), like:


Cheers, Thomas

Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 3 hours 26 min ago

new java.text.SimpleDateFormat("MM.dd.yy").format($F{date-field})
or simply
new SimpleDateFormat("MM.dd.yy").format($F{date-field})

kcd83 - 8 years 6 months ago

Hi Thomas,

thank you so much for your reply.

First i did was to change the class type from java.sql.Timestamp to java.util.Date.

Second i changed the caategory expression as you have suggested. After this the filling process could not work. Maybe a syntax error?


In the attached file all is documented.
Would be wonderful to hear from you again.

Best regards Michael

File xmlcode_date_in_chart.rtf8 KB
kuquadrat_1's picture
Joined: Aug 16 2013 - 11:14pm
Last seen: 1 year 5 months ago