Dear Sir/Madam,
Thanks for reading this.
I try to create a time series chart. I have many data with the time value in milliseconds. So, if I plot the chart, I will get a very messy plot with all the data on the plot if the range of X-Axis is in hour. I'm thinking of getting an average value for my data that align with the time tick mark on the X-Axis. For example, if I have the X-Axis in the range of 12 hours, and I have 12 tick marks on my X-Axis. However, I have all my data in seconds. So, I would like to get an average value for an hour and put it on the tick mark of the hour on X-Axis. As a result, I will get a cleaner plot which the user can see clearly. Question: Is there anyway I can do this with the API that provided by JFreeChart? Or I have to extend the API to achieve the result that I want? If so, any good advice on that? Also, how do you find out what time of the tick mark on the X-Axis?
I would appreciate a lot if someone who has done this before give me some good pointer. Thanks a lot for reading my question. Thanks.
Have a nice day.
Best regards,
Brandon.
How to align the data to the tick on X-Axis in time series c
Re: How to align the data to the tick on X-Axis in time seri
Hi Brandon,
JFreeChart will always display *all* of the data you pass to it. You will need to write yourself a method that takes a TimeSeriesCollection as a parameter and creates a new TimeSeriesCollection containing average values for particular subperiods - then pass that to the chart.
The date axis is a real time line measured in milliseconds. The tick labels are drawn independently of the data, the code tries to show as many ticks as possible without the tick labels overlapping - tick sizes (and label formats) are taken from a collection of 'standard' sizes, see the createStandardDateTickUnits() method in the DateAxis class for the default settings.
Regards,
DG.
JFreeChart will always display *all* of the data you pass to it. You will need to write yourself a method that takes a TimeSeriesCollection as a parameter and creates a new TimeSeriesCollection containing average values for particular subperiods - then pass that to the chart.
The date axis is a real time line measured in milliseconds. The tick labels are drawn independently of the data, the code tries to show as many ticks as possible without the tick labels overlapping - tick sizes (and label formats) are taken from a collection of 'standard' sizes, see the createStandardDateTickUnits() method in the DateAxis class for the default settings.
Regards,
DG.