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
 QCRTGraph for Java
 How to scroll vertically
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

johnbutler

23 Posts

Posted - 08 Nov 2005 :  08:58:23  Show Profile  Reply with Quote
I am just getting started with QCRTGraph. I started by using an example that scolls horizontally over time. I modified it to not use a TimeAxis for the horizontal axis (used a LinearAxis) and got that working. I am not attempting to convert the graph so that the data scrolls vertically over time. I have switched the axes and data so that the data appears correctly, however it does not scroll. How do I fix this?

quinncurtis

1586 Posts

Posted - 08 Nov 2005 :  09:54:37  Show Profile  Reply with Quote
Unfortunately, the RTScrollFrame does does not support vertical scrolling.

The RTScrollFrame was written as a utility class to make automatic management of scrolling easier. It is possible to implement vertical scrolling without using the RTScrollFrame class. The QCChart2D example program DynamicCharts has several examples of scrolling graphs that do not use the RTScrollFrame. These examples all use horizontal scrolling, but the ideas are the same.

Scrolling is the synchronized update of the underlying coordinate system (and related axes) along with the data.

So as your data is added to the graph, you can rescale the coodinate system to display the "window" on the data that you want.


For each update you could do something like:

int count = 0;
 void addNewPoints()
{    

     // Add new points to dataset
     .
     .
     .
      // Scroll coordinate system
      pTransform1.setScaleStartY(count);
      pTransform1.setScaleStopY(count + 100);

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

      count++;
}



The y-scale would change with each update:
0 - 100
1 - 101
2 - 102
3 - 103
.
.
.

You can trigger an updateDraw with each update, if your update rate is not too fast, or use a timer, as most of our examples do, that is asynchronous with the actual update of the data.
Go to Top of Page

johnbutler

23 Posts

Posted - 09 Nov 2005 :  08:10:37  Show Profile  Reply with Quote
Will there be an efficiency loss by using QCChart2D classes to do scrolling instead of the RTScollFrame class?
Go to Top of Page

quinncurtis

1586 Posts

Posted - 09 Nov 2005 :  09:38:01  Show Profile  Reply with Quote
No. The RTScrollFrame basically does what my previous post described. The RTScrollFrame has many more options for variations of scrolling and auto-scaling, but it will not be any faster.

It is important to understand the difference between the data update rate, and the display update rate. The data can be updated thousands of times a second. It is the display of the data that takes significant time. That is why in our examples we separate the two.

A better example of scrolling is seen below. In this case the window does not start to scroll until after the first 100 points are added.

int count = 0;
int windowsize = 100;
 void addNewPoints()
{    

     // Add new points to dataset
     .
     .
     .
      if (count > windowsize )
      {
        // Scroll coordinate system
        pTransform1.setScaleStartY(count-windowsize );
        pTransform1.setScaleStopY(count);
      }
     xAxis1.calcAutoAxis();
     yAxis1.calcAutoAxis();
     xAxisLab1.calcAutoAxisLabels();
     yAxisLab1.calcAutoAxisLabels();

      count++;
}
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