Zoom across multiple charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
montepv
Posts: 4
Joined: Mon Sep 18, 2006 5:36 pm

Zoom across multiple charts

Post by montepv » Tue Sep 26, 2006 5:03 pm

I have read on some older posts (2002) that zooming across multiple charts has some issues. Is this still the case? I have 2 or more time plots that when zooming on one I would like to apply the same zoom to the other plots (zoom to the same time region).

purduephotog
Posts: 17
Joined: Wed Nov 10, 2004 11:29 pm

Re: Zoom across multiple charts

Post by purduephotog » Mon Mar 12, 2007 8:04 pm

montepv wrote:I have read on some older posts (2002) that zooming across multiple charts has some issues. Is this still the case? I have 2 or more time plots that when zooming on one I would like to apply the same zoom to the other plots (zoom to the same time region).
Any examples I could read thru for how to do this? I may have the opportunity to make someone's life easier by zooming to a 'goto' region of data that is difficult to understand by selecting /zooming on a different chart. I want to tie the two of them together- but they have completely different coordinate axis and are only related by the fact that each data point they both has a sequence ID in common.

Kousu
Posts: 63
Joined: Wed Mar 07, 2007 10:40 pm

Post by Kousu » Mon Mar 12, 2007 8:21 pm

Seeing as zooming is implemented by following the org.jfree.plot.Zoomable interface which just works in terms of rectangles, it should be possible to manually construct the rectangle you wish to zoom in on from the other chart you aren't zooming in on.

You won't be able to use ChartPanel though.

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Mon Mar 12, 2007 9:07 pm

If all the plots share the same domain axis and range axis, they will zoom in unison. Try somthing like this

Code: Select all

NumberAxis l_domain = new NumberAxis("domain");
NumberAxis l_range  = new NumberAxis("range");
XYPlot l_plot1      = new XYPlot(l_dataset1, l_domain, l_range, l_renderer1);
XYPlot l_plot2      = new XYPlot(l_dataset2, l_domain, l_range, l_renderer2);
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

purduephotog
Posts: 17
Joined: Wed Nov 10, 2004 11:29 pm

Post by purduephotog » Thu Mar 15, 2007 9:40 pm

RichardWest wrote:If all the plots share the same domain axis and range axis, they will zoom in unison. Try somthing like this

Code: Select all

NumberAxis l_domain = new NumberAxis("domain");
NumberAxis l_range  = new NumberAxis("range");
XYPlot l_plot1      = new XYPlot(l_dataset1, l_domain, l_range, l_renderer1);
XYPlot l_plot2      = new XYPlot(l_dataset2, l_domain, l_range, l_renderer2);
So.... Close.... :)

Thank you- that was inspired. I (as you've answered in another post) have three charts that show three subsystems- all easily ID's by their sequentialID. That ID range is my domain axis, and can be used to cull data for the system performance 'overview' that sits in another graph.

Now, lets see, I'll have to add a listener handle to know when the domain axis has changed, then update the system performance graph with the new range (it has to be calculated as it displays in different metrics).

But I'm alot closer now thanks to this post- thanks Richard.

Locked