LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

X axis expands and chart shrinks in a strip chart

Hello,

I am using LabWindows/CVI 7.1 and wanted to auto expand the X Axis in a stripchart as points are added. 

My strip chart control "POINTS PER SCREEN" property is set to 100.  So what I want is as point 101th is added then the X Axis scale would changed from 0..99 to 0..199 and the current chart would shrink (not dissapear) to half, and as point 201th is added then the X Axis scale would changed from 0..199 to 0..299 and so on...

Is there a way in CVI to achieve this?  I am using PlotStripChart().

What I am experiencing was when I use SetCtrlAttribute to inscrease the points_per_screen to 200 (at anytime) the chart cleared and started to draw from 0 to 200 points, which I didn't want.

Thanks.
V.
0 Kudos
Message 1 of 4
(3,311 Views)

Hello vtran,

You won't be able to get your desired behavior from the stripchart.  The strip chart by default incrementally displays data up to the value specified in the Points Per Screen attribute.   Then, the strip chart either scrolls the data, clears it and redraws the data from the left side of the chart, or does a sweep update.  By design, you should only programmatically change the points per screen before plotting to the strip chart.  Whenever you change the points per screen, the chart is cleared, so you won't be able to scale down the current values displayed on the chart in order to display more points on the screen.

Thanks.

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 4
(3,291 Views)

Thanks for the reply, and I have to live with the limitation.

Perhaps it's something to consider in future versions of LabWindows, at least it should maintain a history of pass data so when X/Y scales are resized the chart would not clear.

Thanks,

V.

0 Kudos
Message 3 of 4
(3,282 Views)
Hi vtran.

Why not try this:
  • Use a Graph in place of your Stripchart.
  • Set the graph control's ATTR_XLOOSE_FIT_AUTOSCALING attribute to 1 (TRUE).
  • Set its ATTR_XLOOSE_FIT_AUTOSCALING_UNIT to 2 (= log(100)).
  • Buffer the data for all of your "traces" in a static array. Create a pointer to the first value of each channel.
  • To update the graph, call DeleteGraphPlot() once to remove all plots, then PlotY() once for each trace. Plot all the valid data points you have. Limit updates to, say, 10 per second maximum.
  • When you have "enough" points in your arrays, shift the array data "left" to make room for new data; use memmove().
The effect will be that the x-axis maximum value will always be a multiple of 100.

Good luck,
Colin.

Message 4 of 4
(3,268 Views)