Plotting time data formatted in a certain way

A free public discussion forum for the JFreeChart class library.

Plotting time data formatted in a certain way

Postby Siniz » Mon Jul 21, 2008 12:09 pm

I am new to this forum and to JFreeChart, so hello to you all!

I am in need of creating a time-data plot. I was browsing the net for finished java graph solutions (to save time) and ended up finding JFreeChart, which looks like an excellent candidate to do the job.

What I am interested in (first of) is if it is even possible to do what I want to do with JFreeChart. I've been browsing the API and searching the forums and it seems like it could work, but I haven't found an identical solution. To easier explain what I want to do, I'll supply this image:

link removed

A few quick questions then:

1. Is it possible to format the x-axis in the following way:
17:04:45 .1 .2 .3 .4 .5 .6 .7 .8 .9 17:04:46 .1 .2 .3 etc, like show in the figure above.
Basically I want to show the time in seconds, then inbetween two consecutive seconds I want it to split it up in deci-seconds like shown above. The actual x-axis data will however be in milliseconds. If so, what classes do I need to look at in the API? Any hints on how I could go about getting it to show the x-axis like explained above? I just need some quick hints!

2. Is it possible to move the chart with the mouse, for example along the x-axis. Is the chart also zoomable? (edit: I found the zoomable interface, so I assume it is zoomable, is it movable with the mouse though?)

3. As I am beginner when it comes to JFreeChart, is there anything else I have to think about when creating a graph like this? I need about 6 different y-axises, all plotted versus the same time x-axis. Can that be done?

Appreciate any and all help.
Regards,
Tobias
Last edited by Siniz on Mon Nov 23, 2009 4:36 pm, edited 2 times in total.
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Postby Siniz » Tue Jul 22, 2008 8:45 am

I missed the second post in the "How to ask a question..." post. Sorry!
I update the first questions in my first post and supplied an image. Thanks for any help. :)
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Postby Siniz » Wed Jul 23, 2008 10:44 am

Hoping for just some input! Nothing elaborate, just a hint or two. Was hoping someone had something to say :)
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Re: Plotting time data formatted in a certain way

Postby paradoxoff » Wed Jul 23, 2008 12:41 pm

Siniz wrote:1. Is it possible to format the x-axis in the following way:
17:04:45 .1 .2 .3 .4 .5 .6 .7 .8 .9 17:04:46 .1 .2 .3 etc, like show in the figure above.
Basically I want to show the time in seconds, then inbetween two consecutive seconds I want it to split it up in deci-seconds like shown above. The actual x-axis data will however be in milliseconds. If so, what classes do I need to look at in the API? Any hints on how I could go about getting it to show the x-axis like explained above? I just need some quick hints!

Formatting of the labels of a DateAxis is achieved by an instance of DateFormat. A DateAxis brings its own DateFormats by default (which one is actually chosen depends on the date range). You could create your own class that extends DateFormat and does the formatting as expected and install that via DateAxis.setDateFormatOverride(java.text.DateFormat formatter);
Siniz wrote:2. Is it possible to move the chart with the mouse, for example along the x-axis. Is the chart also zoomable? (edit: I found the zoomable interface, so I assume it is zoomable, is it movable with the mouse though?)

Zooming is possible when the chart is placed in a chartPanel. Panning would need to be implemented. You might want to check whether someone has already submitted a patch for that that you could integrate into your local JFreeChart installation.
Siniz wrote:3. As I am beginner when it comes to JFreeChart, is there anything else I have to think about when creating a graph like this? I need about 6 different y-axises, all plotted versus the same time x-axis. Can that be done?

Yes. JFreeChart supports plot with multiple datasets, each of which can be visualized against an individual axis via XYPlot.mapDatasetToRangeAxis(int datasetIndex, int axisIndex). If you don´t do the mapping explicitly, always the first range axis will be used.
The minor tick marks are not yet supported. There is a patch in the queue that waits to be integrated into the official release :wink:
Regards
Paradoxoff
paradoxoff
 
Posts: 1193
Joined: Sat Feb 17, 2007 1:51 pm

Postby Siniz » Thu Jul 24, 2008 9:05 am

Very good info. I know exactly where to look and read now. Thank you very much paradoxoff.
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Postby Siniz » Sun Jul 27, 2008 7:55 pm

A followup question:

I was browsing the API and found CombinedDomainXYPlot. Isn't that what's supposed to be used instead of an XYPlot that you suggested?

Thanks!
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Postby Siniz » Thu Jul 31, 2008 1:11 pm

Just hoping for a quick answer yet again :)
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Postby david.gilbert » Thu Jul 31, 2008 3:04 pm

Siniz wrote:A followup question:

I was browsing the API and found CombinedDomainXYPlot. Isn't that what's supposed to be used instead of an XYPlot that you suggested?

Thanks!


It depends. If you want each data series on a separate subplot, then yes. But if you prefer to overlay all the series on one plot, then a plain XYPlot will do.

(I've not been answering much on the forum in the last week because I'm on holiday).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11352
Joined: Fri Mar 14, 2003 10:29 am

Postby Siniz » Thu Jul 31, 2008 5:59 pm

Thanks David! Appreciate it a lot. It's understandable of course, I'm not expecting an answer, just always hoping for one.
Siniz
 
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 10 guests