Dynamic TimeSeries Plotting - Left to Right

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
aznoohwee
Posts: 4
Joined: Fri Feb 15, 2008 4:58 pm

Dynamic TimeSeries Plotting - Left to Right

Post by aznoohwee » Sat Mar 08, 2008 10:46 pm

I am working on a dynamic data application using JFreeChart and I am having some issues getting the plot to display how I want it.

The chart should be plotting data initially from left to right, but when it initially begins to plot data, the data displays from the right moving to the left.

I believe the problem is with the History of the data (set with maximumItemAge), but even when it is disabled the problem exists.

I was wondering if anyone has any solutions to this, workarounds, or suggestions for fixing this problem.

Thanks!
Programmer with Deadlines

asterix
Posts: 6
Joined: Sat Apr 05, 2008 3:35 pm

Post by asterix » Sat Apr 05, 2008 3:45 pm

Hi all,

I also created a dynamic chart using TimeSeriesChart. It started to draw from right to left. What can I make the chart draw from left to right ?

Thanks for your help.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Apr 07, 2008 3:20 pm

I don't think there is an easy way to make this happen. It would be a nice feature to add though.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

asterix
Posts: 6
Joined: Sat Apr 05, 2008 3:35 pm

Post by asterix » Mon Apr 07, 2008 3:38 pm

Thanks David for letting me know this.

mkivinie
Posts: 51
Joined: Wed Jul 06, 2005 8:35 am

Post by mkivinie » Thu Apr 10, 2008 11:08 am

If your problem is just that the initial drawing begins from the right (instead of left), maybe it is just as simple a problem as setting the initial X-axis range correctly.

You now probably have initially DateAxis range as
<some starting point> --- Now

What if you change the initial range to
Now -- <some time in the future>
before adding data to the chart?

Mind that I have not tested any of this, but at least in theory this should help.
Or then I am completely off the track and apologize...

asterix
Posts: 6
Joined: Sat Apr 05, 2008 3:35 pm

Post by asterix » Thu Apr 10, 2008 5:17 pm

Thanks mkivinie for your suggestion. I'll try that.

aznoohwee
Posts: 4
Joined: Fri Feb 15, 2008 4:58 pm

Post by aznoohwee » Fri Apr 11, 2008 7:37 pm

I solved it thanks!

Basically I set the initial range with auto-range off, and then added a ChartChangeListener which compared the time of the latest value added with the time of the first value. When this time exceeded the range FixedAutoRange was turned on with the current range of the graph.

gayathri
Posts: 3
Joined: Tue Nov 11, 2008 7:31 am

Post by gayathri » Tue Jan 13, 2009 10:33 am

aznoohwee,

I am working on a dynamic data application using JFreeChart and I am having some issues on displaying it.

Its plotting the data from right to left. I tried by setting initial range with auto-range off, and then added a ChartChangeListener in which i turned on the FixedAutoRange. Even then i am getting the plot moving from right to left.

Can u please send the sample of chartchangelistener in which you are able to plot from left to right.


Regards
Gayathri

Locked