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 Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 Using arbitrary units of time on X-Axis plots
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mswlogo

10 Posts

Posted - 08 Mar 2007 :  18:46:03  Show Profile  Reply with Quote

I wish to build a Graph that has a fixed window that is horizontally scrollable and data will be added to the dataset dynamically over time.

But the X-Axis is not time based.

I notice all RT Charts always have time as the X-Axis.

Can the X-Axis be any units.

I seem to recall looking at this a few years ago and the models seemed to assume you just fed it Y values only and you set the chart up for time update period.

I want to dynamically give it X,Y data points dynamically and add to the current dataset.

I'm finding a little awkward doing this with the 2D package and was not sure if the RT package would clean things up. But I can't quite get my arms around what the RT package can and cannot do.

Thanks.

quinncurtis

1586 Posts

Posted - 09 Mar 2007 :  10:08:00  Show Profile  Reply with Quote
Scrolling graphs that use a managed RTScrollFrame, as do most all of our scrolling graph examples, are not restricted to time-based values.

You can just as easily use a graph that is based on a simple numeric range for both x and y. You would replace the TimeCoordinate scaling with CartesianCoordinate scaling. You would replace the TimeAxis x-axis with a LinearAxis. And you would replace the x-axis's TimeAxisLabels with NumericAxisLabels.

Most of our examples only pass in the y-values for real-time updates. In these cases the x-value is assumed to be the current time of day, as in the example below:

currentTemperature1.SetCurrentValue(currentTemperatureValue1);
currentTemperature2.SetCurrentValue(currentTemperatureValue2);


But, the SetCurrentValue method also has many overrides, described in the manual, that also allow you to pass in an explicit time-of-day, or as in your case, a double numeric value, as in the example below:
// This method uses an explicit time stamp, which is the update count in this case
double xvalue = (double) count;
currentTemperature1.SetCurrentValue((double) xvalue, currentTemperatureValue1);
currentTemperature2.SetCurrentValue((double) xvalue, currentTemperatureValue2);


You can download a modified version of our ScrollApplication1 example program that implements a simple version of a scrolling graph using a simple numeric scale. http://quinn-curtis.com/downloadsoftware/ScrollApplication2.zip

Go to Top of Page

mswlogo

10 Posts

Posted - 09 Mar 2007 :  11:13:59  Show Profile  Reply with Quote
Awesome!! you guys are great.

Just one more question on that example.

Is all the data collected still in the chart and can be scrolled back to?
Go to Top of Page

quinncurtis

1586 Posts

Posted - 09 Mar 2007 :  11:44:31  Show Profile  Reply with Quote
Yes, data that scrolls off of the screen is still in the dataset buffers. The data is simply being clipped to the current chart scale. See the Polygraph example for an example of scrolling back in time using a scrollbar.
Go to Top of Page

Procentaren

Sweden
8 Posts

Posted - 16 Jan 2014 :  15:29:44  Show Profile  Reply with Quote
quote:
Originally posted by quinncurtis

Scrolling graphs that use a managed RTScrollFrame, as do most all of our scrolling graph examples, are not restricted to time-based values.


You can download a modified version of our ScrollApplication1 example program that implements a simple version of a scrolling graph using a simple numeric scale. http://quinn-curtis.com/downloadsoftware/ScrollApplication2.zip


I'm looking for a scrolling graph with a numeric scale on the X-axis. Scaled 0 - 60.
It represents time 0 - 60 seconds.
I tested the above mentioned example, it's almost what I want.
But I don't want the timevalues to scroll left.

I thought setting scrollFrame.TimeStampMode = ChartObj.RT_NOT_MONOTONIC_X_MODE should do the trick, but the X-scale is still scrolling left when curves comes to the right end.
Can someone give a hint ?
Go to Top of Page

quinncurtis

1586 Posts

Posted - 16 Jan 2014 :  16:14:28  Show Profile  Reply with Quote
You want a time-based scrolling graph, and you don't want it to scroll to the left - i.e. as you add new data to the right of 60 seconds, the new data is appended to the right, and the old data is truncated from the left. So as the data moves from left to right, with increasing time, what exactly do you expect to happen to the line plot, and the x-axis labels, when the data passes through the 60-second mark?
Go to Top of Page

Procentaren

Sweden
8 Posts

Posted - 17 Jan 2014 :  11:35:49  Show Profile  Reply with Quote
quote:
Originally posted by quinncurtis

what exactly do you expect to happen to the line plot, and the x-axis labels, when the data passes through the 60-second mark?


Sorry for being vague.
I'm converting an old application made with VB6 and QCRTgraphics available at that time.
See Picture.
It's a simple RTgraph with data added to the right and scrolled left.
The X-axis is 0 - 300 seconds in this example. It's a fixed scale. Not moving.
The actual time for a datapoint is of no interest. I only want to measure time between two datapoints in the graph.

The new application is made with VB.net. I want this graph to work in the same way as the old.
A Scrolling graph, but a fixed X-scale. I have not been able to accomplish that.

Here is the code for the Xaxis, taken from your example scrollapplication2.
xaxis = new LinearAxis(pTransform1, ChartObj.X_AXIS);
xaxis.LineColor = Color.Black;
chartVu.AddChartObject(xaxis);

NumericAxisLabels xAxisLab = new NumericAxisLabels(xaxis);
xAxisLab.TextFont = axisFont;
chartVu.AddChartObject(xAxisLab);

Go to Top of Page

quinncurtis

1586 Posts

Posted - 17 Jan 2014 :  12:25:56  Show Profile  Reply with Quote
A straight forward solution is to use two coordinate systems, overlaying exactly the same area of the display. Initially both are scaled 0-300 for x and 0-100 for y. Specify the first coordinate system when creating both your x and y-axes (the axes, the grids, and the axis labels). Specify the second coordinate system for the line plots. When you create the RTScrollFrame, specify the second coordinate system.

The result should be that the axes, grids and axes labels remain unchanged as new data is added, because the objects are tied to the first coordinate system, which is NOT under the control of the RTScrollFrame. The second coordinate system will be constantly rescaled by the RTScrollFrame, causing the line plot to scroll in the standard fashion.

Let me know if there is something you do not understand.

Go to Top of Page

Procentaren

Sweden
8 Posts

Posted - 17 Jan 2014 :  13:38:22  Show Profile  Reply with Quote
quote:
Originally posted by quinncurtis

A straight forward solution is to use two coordinate systems, overlaying exactly the same area of the display. Initially both are scaled 0-300 for x and 0-100 for y. Specify the first coordinate system when creating both your x and y-axes (the axes, the grids, and the axis labels). Specify the second coordinate system for the line plots. When you create the RTScrollFrame, specify the second coordinate system.

The result should be that the axes, grids and axes labels remain unchanged as new data is added, because the objects are tied to the first coordinate system, which is NOT under the control of the RTScrollFrame. The second coordinate system will be constantly rescaled by the RTScrollFrame, causing the line plot to scroll in the standard fashion.


Yes, that made my day. Thankyou for the solution

pTtransform1 is used for the scrolling part of the graph.
pTtransform2 is used for the axis.


pTransform1 = new CartesianCoordinates( startTime, currentTemperature1.DefaultMinimumDisplayValue,
endTime, currentTemperature1.DefaultMaximumDisplayValue);
pTransform1.SetGraphBorderDiagonal(x1, y1, x2, y2) ;


pTransform2 = new CartesianCoordinates(startTime, currentTemperature1.DefaultMinimumDisplayValue,
endTime, currentTemperature1.DefaultMaximumDisplayValue);
pTransform2.SetGraphBorderDiagonal(x1, y1, x2, y2);

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