Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart3D for Java
 autoscaling not happening
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Peter

17 Posts

Posted - 29 Jun 2010 :  12:13:05  Show Profile  Reply with Quote
I've got a set of plots where their datasets are updated dynamically based on manual changes of the data (by the user).

Everything is updating fine except that the axes are not autoscaling if the new data exceeds the current maximums of the plot. Here's snippet of what I'm doing on one of the plots:

This is in the update() method (a la Observer/Observable):
...
pTransform1 = new TimeCoordinates();
pTransform1.autoScale( Dataset1, ChartConstants.AUTOAXES_FAR, ChartConstants.AUTOAXES_FAR );
pTransform1.setTimeScaleStart( new GregorianCalendar( sd.getMinYear(), 0, 1 ) );
pTransform1.setTimeScaleStop( new GregorianCalendar( sd.getMaxYear(), 0, 1 ) );
...

The axis in question here, is simply:
xAxis = new TimeAxis( pTransform1, TimeAxis.X_AXIS, TimeAxis.TIMEAXIS_YEAR );


quinncurtis

1551 Posts

Posted - 29 Jun 2010 :  12:49:00  Show Profile  Reply with Quote
The axes don't automatically auto-scale if you change the coordinate system bounds. If you change the coordinate system bounds and you want associated axes to re-scale you must call the axis calcAutoAxis() method.

xAxis.calcAutoAxis();

See the example program swingexamples.MultipleAxes.

Go to Top of Page

Peter

17 Posts

Posted - 29 Jun 2010 :  22:28:48  Show Profile  Reply with Quote
Thanks. I tried calcAutoAxis() to no avail. I also tried it with setScaleStopX() as well but without effect.

I'm basically using your "Floating Bar Graph" (Media Schedule) as a starting point. The xAxis is in years and I have a JSlider that you can move the floating bars back and forth along the x-axis. That works great except that you can slide the bars right off the right side of the plot without it rescaling.
Go to Top of Page

quinncurtis

1551 Posts

Posted - 29 Jun 2010 :  22:51:33  Show Profile  Reply with Quote
Based on what you have provided, we don't know what the problem is. We have example programs which do exactly what you describe you want to do, scrolling the x-axis using a scrollbar, without a problem: swingexamples.LinePlotScrollBar and swingexamples.OHLCPlot. So study those examples. If you can't solve the problem you will need to create the simplest possible example that demonstrates the problem and send us the complete source we can compile and debug.
Go to Top of Page

Peter

17 Posts

Posted - 30 Jun 2010 :  12:18:59  Show Profile  Reply with Quote
Thanks for your help.

Problem solved. I was instantiating a new TimeCoordinates transform in the update method (after updating the dataset). Once I stopped doing that, and by using setScaleStopX() and calcAutoAxis(), it's working fine.

Thanks so much for your help and patience. I'm new to using your stuff (as you can tell) and have some utterly insane deadlines to meet.
Go to Top of Page

quinncurtis

1551 Posts

Posted - 30 Jun 2010 :  14:57:21  Show Profile  Reply with Quote
Just so you know what is happening -> Your original axes were created using the original coordinate system. Even though you instantiated a new one, with a new range, the axes still pointed to the old one with the old range. So the axes never changed, even as you continuously created new coordinate systems with new ranges. By not creating a new coordinate system, and just changing the original coordinate systems range, the axes were able to auto-scale to the new range of the original coordinate system.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07