Example Code

Programmatically Change the Number of Displayed Data Points on a Chart Using LabVIEW

Code and Documents

Attachment

Overview 

This VI programmatically changes the number of displayed data points on a Chart.

 

Description

This VI uses an Event Structure and the XScale Property Nodes of a Chart to change the number of displayed data points on a Chart.
It also generates data periodically to update the Chart.

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI.
  2. Change the number of Data Points.
  3. Observe the Chart display a different number of Data Points.

Note that the Data Entry for the Data Points Control has been set to coerce all input data to a value between 0 and 1024.
The value 1024 was chosen because this is the default Chart History Length of a Chart. Therefore, you cannot display more Data Points than the number of data points available in your Chart History.

 

Additional Information or References

 

3533584 - Snippet - self-made.PNG

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.** 

 

John B.
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
SKauth
Member
Member
on

This doesn't work on my computer (using LV 8.6). Nothing changes when I set a new value for the data points. The marker value is changed, though. What could be the reason?

BCharlton44
Member
Member
on

Nothing changes for me as well. I am on LV7.1    

BVSmith
Member
Member
on

This indeed doesn't work at all.  I found the way to do it was just to change the XScale.Maximum to the number of points acquired so far minus 1 and XScale.Minimum to that minus the number of points you want to display.

National, please update this page to reflect that because your example doesn't work.

Brian Smith
Advanced Light Source
Lawrence Berkeley National Laboratory
jordankuehn
Member
Member
on

I've found that you don't even need to read the max value.  Simply put in 0 for the min and whatever range you want for the max value and the chart will automatically adjust to have that range on what it displays showing the most current data.  Even if you are writing to the chart at the time.

The Colex Group
Lead Software Engineer
Certified LabVIEW Developer
Highland_Controls
Active Participant
Active Participant
on

Does not work at all. Tried with LV2013.