11-23-2009 12:24 PM
I am able to run your example. it is working.
Just need this feature to display / hide(remove) the filled area for particular plot.
Just like NI normal fillmode feature to show:
waveformPlot1.FillMode = PlotFillMode.Fill;
and hide specific filled area:
waveformPlot1.FillMode = PlotFillMode.None;
I have tried to clear the array points and refresh the plot, but it doen't work.
Array.Clear(points, 0, points.Length);
waveformPlot1.Invalidate();
11-23-2009 12:57 PM
It is working using this way(find the biggest Y value of data and set limitingValue equal to biggest Y value, refresh the Graphic:
private void clearFillArea_Click(object sender, EventArgs e)
{
double dblYbiggest = findBiggestValue4Array(data);
limitingValue = dblYbiggest;
waveformGraph1.Invalidate();
}
private double findBiggestValue4Array(double[] data)
{
double dblValue = 0.0;
for (int i = 0; i < data.Length; i++)
{
double dblTemp = data[i];
if (dblTemp > dblValue)
dblValue = dblTemp;
}
return dblValue;
}
11-24-2009 04:10 PM
In the BeforeDraw function you will need to set a global flag that toggles on and off the fill so
if (true) { PointF[] points = waveformPlot1.MapDataPoints(waveformGraph1.PlotAreaBounds, e.Plot.GetXData(), e.Plot.GetYData()); PointF point = waveformPlot1.MapDataPoint(waveformGraph1.PlotAreaBounds, 0, limitingValue); FillDataAboveValue(points, point, e.Graphics); }
will enable the fill
if (false) { PointF[] points = waveformPlot1.MapDataPoints(waveformGraph1.PlotAreaBounds, e.Plot.GetXData(), e.Plot.GetYData()); PointF point = waveformPlot1.MapDataPoint(waveformGraph1.PlotAreaBounds, 0, limitingValue); FillDataAboveValue(points, point, e.Graphics); }
will disable the fill