Author 
Topic 

Peter
17 Posts 
Posted  29 Jun 2010 : 12:13:05

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
1567 Posts 
Posted  29 Jun 2010 : 12:49:00

The axes don't automatically autoscale if you change the coordinate system bounds. If you change the coordinate system bounds and you want associated axes to rescale you must call the axis calcAutoAxis() method.
xAxis.calcAutoAxis();
See the example program swingexamples.MultipleAxes.



Peter
17 Posts 
Posted  29 Jun 2010 : 22:28:48

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 xaxis. That works great except that you can slide the bars right off the right side of the plot without it rescaling. 


quinncurtis
1567 Posts 
Posted  29 Jun 2010 : 22:51:33

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 xaxis 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. 


Peter
17 Posts 
Posted  30 Jun 2010 : 12:18:59

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. 


quinncurtis
1567 Posts 
Posted  30 Jun 2010 : 14:57:21

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 autoscale to the new range of the original coordinate system. 



Topic 
