ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

display waveformGraph from txt file data

How to use the waveformGraph to display the moving chart based on the collected data (data from txt file)? How to incorporate the received / custom data (instead of random generated data)?

Programming Languages: C#, Measurement Studio
0 Kudos
Message 1 of 2
(3,195 Views)
There is not only one way to display a data collection from a file. It also depends on your file structure.
But you can do something like that :

1) load the data at the application startup, for instance

_data = new ArrayList( 1000 );

using( StreamReader streamReader = new StreamReader( _fileName ) )
{
String line = streamReader.ReadLine();

while( line != null )
{
_data.Add( Convert.ToDouble( line ) );
line = streamReader.ReadLine();
}
}

_data.TrimToSize();


2) use a timer / thread to chart the data, for instance

_graph.PlotYAppend( _data[ _currentDataIndex ], _dataSize );
++_currentDataIndex;
if( _currentDataIndex >= _data.Count )
{
_currentDataIndex = 0;
}
0 Kudos
Message 2 of 2
(3,187 Views)