Jasperreports time series chart

2019-08-17 01:44发布

问题:

I have a csv file as the data source. I want to create a time series chart to show the data during a day. The time series data from csv file is like 0:15 0:30 0:45 ... 23:45, and every time pot has a value which I want to show in the chart.

So I just use: new SimpleDateFormat("HH:mm").parse($F{time}) to be the Time period expression, but the chart looks like just one dot, and just 23:59:59.999 and 00:00:00.000 on the x-axis

How do I fix it to show 0:15 0:30 0:45 ... 23:45 on x-axis and corresponding value on y-axis? How do I set the time period expression, and any other setup?

回答1:

If you want to show each entry in your CSV file on the X-axis, don't use the time series charts, but the "Line" chart. You don't have to parse the date either - simply assign the field to the "Category expression" and you should be done.