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: 

Limit Line

What is the best way to implement a limit line with different values?

For instance using a WaveformGraph with a Y scale from 50 to -10 and an X scale from 0 to 500. I need a limit line displayed in six different points going from 40, 0 , 0, 0 ,0, 40 in a linear scale.  The linear scale points would be spread equally across the X scale. 40 would be on 0 on the X Scale, 0 on 100, 0 on 200 and so on. Something like the attached jpg.

 

Thanks

0 Kudos
Message 1 of 3
(5,560 Views)

Have you considered plotting this limit line as another plot on the WaveformGraph? The code might look something like this:

 

int range = 500;
int numPoints = 500;
double increment = range / numPoints;
double startingPoint = 0.0;
double[] limitLinePoints = new double[numPoints];
double slope = 40.0 / 100.0;
for (int i = 0; i < 100; i++)
{
limitLinePoints[i] = 40 - (i * slope);
}
for (int i = 100; i < 400; i++)
{
limitLinePoints[i] = 0;
}
int j = 0;
for (int i = 400; i < 500; i++, j++)
{
limitLinePoints[i] = j * slope;
}

waveformPlot1.PlotY(limitLinePoints);

0 Kudos
Message 2 of 3
(5,539 Views)

Thank You,

That is exately what I needed

0 Kudos
Message 3 of 3
(5,523 Views)