Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to fill the plot area partially in fill mode

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();

 

0 Kudos
Message 11 of 13
(1,340 Views)

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;
}

 

 

 

0 Kudos
Message 12 of 13
(1,338 Views)

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

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 13 of 13
(1,311 Views)