Jump to content

Chart, Start X Axis time from where it left off


Recommended Posts

I've got an application where the user can stop the test. The chart X-axis shows the time since the test started. If the user exits the application completely the chart loses the test time. When they try to resume the test the X-axis of the chart starts plotting at zero.

I can make the chart start the X-axis at a time I specify but I can't seem to get the X axis position of the last plotted point.

See the attached code snippet.

Thanks,

Download File:post-2745-1123788403.llb

Link to comment
I've got an application where the user can stop the test.  The chart X-axis shows the time since the test started.  If the user exits the application completely the chart loses the test time.  When they try to resume the test the X-axis of the chart starts plotting at zero. 

I can make the chart start the X-axis at a time I specify but I can't seem to get the X axis position of the last plotted point.

5618[/snapback]

The Maximum cluster element in the XScale.Range Property shows the last point on the strip chart.

couldn't you read this property and set it to the start position before you enter the while loop.

You could also save the last position value to an ini file when the program stops and recall it in the begining.

post-584-1123851912.png?width=400

Download File:post-584-1123851927.llb

Link to comment
The Maximum cluster element in the XScale.Range Property shows the last point on the strip chart.

couldn't you read this property and set it to the start position before you enter the while loop.

You could also save the last position value to an ini file when the program stops and recall it in the begining.

post-584-1123851912.png?width=400

Download File:post-584-1123851927.llb

5644[/snapback]

You are correct. The llb I attached was written that way. So what happens when the data stops in the middle of the chart? You pull off the last value on the X axis scale and you'll start your chart on the next itteration at the wrong point.

There is a chart property Called Plot x.Scale Index. The help on this says "The index of X-scale with which this plot is associated." This sounds to me like it should give you the point on the x axis associated with the last point plotted on the chart for the active plot. It Always returns zero though.

So I'm still lost and Tech support has no idea either.

Fred

Link to comment

Download File:post-2745-1124273429.viDownload File:post-2745-1124273455.vi

You are correct.  The llb I attached was written that way.  So what happens when the data stops in the middle of the chart?  You pull off the last value on the X axis scale and you'll start your chart on the next itteration at the wrong point. 

There is a chart property Called Plot x.Scale Index.  The help on this says "The index of X-scale with which this plot is associated."  This sounds to me like it should give you the point on the x axis associated with the last point plotted on the chart for the active plot.  It Always returns zero though.

So I'm still lost and Tech support has no idea either. 

Fred

5646[/snapback]

I found two solutions. The first uses the loop interator to keep track of how many points have been written to the chart. The Iteration +1 is multiplied by the XScale.Multiplier and added to the XScale.Offset to get the current position of the plot on the graph with respect to the X Axis. This works great for an instant position update with out changing the appearance of the graph. But if you don't write to the graph with every iteration of the loop then you have to keep count of non written loops and subtract them out.

The 2nd is good if you want the Plot location with respect to the X-Axis when exiting the code. This method adjusts the appearance of the graph. Write a 1 to the property node XScale.ScaleFit. This will adjust the X axis to have a min and max value matching the 1st and last values of the chart history. Then Read the XScale.Maximum property to get the position of the plot with respect to the x-axis. I'll then save this value to file and recall it the next time the user opens the software to resume the test and write it to the XScale.Minimum property.

Fred

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.