This project is read-only.

Setting axis extents

Mar 13, 2009 at 6:51 PM

Another question from a new user...  How do I control an axis’s extent?  Specifically, I want to be able to make the x axis be a fixed number of units long but have the maximum value always equal to the data maximum so that as new data comes in from a dynamic simulation the x-axis (the time axis) scrolls.  I also want to be able to plot all data from some non-zero starting time, rather from t = 0.

Thanks, Rich

Mar 27, 2009 at 10:30 AM
Hi Rich,

Maybe you should use Plotter.Viewport.Visible property. It's type is Rect, you can set its value to any rectangle you want.
If you are using non-double axes, you may need to convert your border values (for example, DateTime or TimeSpan - depending on what axis you are using) to double. You should do it manually, and specific conversion can be similar to conversion that is used in axis you are using. Examples of those conversions you can see in constructors of <T>Axis and <T>AxisControl, where <T> is type of axis you are using.

Mikhail.


Mar 27, 2009 at 4:13 PM
2 Thecentury:

Can I change settings of axis independently?
E.g. I need Y axes to scale (autofit), and X to scroll atomatically.
Now I have to set points to be plotted programatically. Y axes stands for value and X - for time.
X axes "width" set to 30 seconds, afer this period graph starts to slide.
Mar 31, 2009 at 9:47 AM
Hi, vpv!

Yes, you can change 'settings of axes' independently - you can pass to plotter.Viewport.Visible any Rect you want, specifying neccesary for you position or size.

Currently it is not so easy to reach your second requirement - having one axis to be autofit, and another to slide. In future we'll provide convenient means for doing it, and now you should implement scenario you've descrived by yourself - you can compute bounding box for you data, and according to its value create Visible rect, taking all data height and only latest 30 seconds for width.

As Rect type accepts only double values of its properties, you'll have to convert DateTime or TimeSpan to double. This can be done by calling ConvertToDouble (or ConvertFromDouble, if you need) method of appropriate axis.

Mikhail.


Mar 31, 2009 at 3:19 PM
Hi Rich and Mikhail,

I just want to make a comment about the features you are talking about. They are necessary for applying DDD for financial application:
- if you work with 1 minute data for example, you need to see only a window with a fixed amount of data that scroll automatically when new data update. But you still need this ability to zoom out (and still maintain the autofit on the y axis) to see general trends.
Cool feature would be, if you drag the x-axis (compress or decompress the data), the amount of data in the new dragged window would remain the same when the window is going to scroll.

If you want more information about financial application with nice graphical features have a look to:
- http://www.modulusfe.com/stockchartxwpf/
- http://www.tssupport.com/multicharts/

Kamel.
Mar 31, 2009 at 4:48 PM
Hi

Is there any method to retrieve the number of points plotted in the window?

Thanks,
Kamel
Apr 1, 2009 at 9:48 AM
Hi Kamel,

Thank you for examples of financial components and application, we will definetely use them as an example when working closer on financial part of DDD.

In next release of DynamicDataDisplay we'll include nice extension of Viewport - something which will allow you to have better control of behavior of Plotter's Viewport.

What do you mean saying 'to retrieve the number of points plotted in the window'? Do you mean number of points that builds up line chart or marker chart?
If it is so, currently there is no straightforward way to get this count.
Why do you need this number and how are you going to use it?

Yours faithfully,
Mikhail.

Apr 1, 2009 at 4:20 PM
As to the number of points:

Why doesn't the polyline representing the linegraph contain all the points of the enumerable source?

In the described above scenario data is plotted for last 30 seconds. When the data flow is stopped the graph is replotted (and FitToView is called) with all the points - e.g 4000 of points with the step of 0.1s.( I preffrred to programatically set points to be plotted during data registration rather rhan change viewport cause this affects performance in long time measurements.)
But zooming gives lines with thepproximate step of 0.5-1s, not 0.1s.
What am I doing wrong?