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
 QCChart2D for Java
 autoscale on DataLoggerView variation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gstola

Argentina
1 Posts

Posted - 19 Jun 2015 :  15:20:18  Show Profile  Reply with Quote
Hi,

I am working on a data logger application. I took DataLoggerView.java from dynamicscharts example as a base.

My issue occurs when my traces evolves in a way that they occupies a smaller part of the chart, without rescaling it. In other words, y-axis should zoom in but it doesnt.

So, I went back to the dynamicscharts example to check where was my mistake by comparing both codes. There, I just made a small change, to force the traces tendence. In practice, Ive modulated the four traces with an exponential, to guarantee that traces converged to some positive value. Under that context, I found that the y-axis didnt zoom in. That is, the four traces were around 800, but the x-axis still was there.

In short how should DataLoggerView example be changed so it autoscales in a way that always occupies most of the chart?

Thank you!
Gerardo

quinncurtis

1551 Posts

Posted - 20 Jun 2015 :  09:20:42  Show Profile  Reply with Quote
The auto-scaling in the Datalogger example takes place in the addNewPoints method, in the following lines. The call to pTransform1.autoScale is what rescales the y-scale to current data. The calcAutoAxis calls make sure the existing axes adapt to the new scale.


    xValues = Dataset1.getTimeXData();
    nNumPnts = Dataset1.getNumberDatapoints();
    pTransform1.autoScale(Dataset1,ChartConstants.AUTOAXES_NEAR,  ChartConstants.AUTOAXES_NEAR);
    if (fixedStartTimeFlag)
      pTransform1.setTimeScaleStart(xValues[0]); // peg start of graph at start of data
    else // Set a 100 point view into data
      pTransform1.setTimeScaleStart(Dataset1.getTimeXDataValue(Dataset1.getNumberDatapoints()-100));

     xAxis1.calcAutoAxis();
     yAxis1.calcAutoAxis();
     xAxisLab1.calcAutoAxisLabels();
     yAxisLab1.calcAutoAxisLabels();


So you must do something similar in your own code. If you can't get it to work, show exactly what code you are using to achieve the auto-scaling of the y-scale and axis.
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