Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Area Graph with Scattergraph?

Hello,

With CWGraph I was able to create an area plot on a graph
along with line plots by using SetBasePlot and SetFillToBase.
How can I do this with ScatterGraph?

Thanks.
0 Kudos
Message 1 of 5
(4,329 Views)
This feature was added in Measurement Studio 7.1. ScatterPlot has a BasePlot property, similar to CWPlot. Instead of a FillToBase property, though, ScatterPlot has a FillMode property which allows you to specify if the fill mode is Fill, Lines, FillAndLines, Bins, or FillAndBins. If you want to fill to a plot, set the FillBase property to Plot.

- Elton
0 Kudos
Message 2 of 5
(4,323 Views)
Check out the MStudio demo application from this link here. This demonstrates the property Elton mentioned and allows you to explore the behaviors and other features of the .NET Graph as well.
Bilal Durrani
NI
0 Kudos
Message 3 of 5
(4,298 Views)
Thanks 7.1 works.
Is there any way to get the area plot to show up behind the gridlines?
0 Kudos
Message 4 of 5
(4,271 Views)
Yes, but this is an uncommon scenario, so you have to write a little bit of code. To change the drawing order of things in the plot area you need to use custom drawing events (BeforeDraw*/AfterDraw* events on the graph and plot) and draw phase methods (Draw* methods on graph and plot). For example, one way that you could do this would be to handle the BeforeDraw event of the plot like this:


// This example assumes that you've added a ScatterGraph with two ScatterPlots
// to the form and they have their default names.
private void OnBeforeDrawPlot(object sender, BeforeDrawXYPlotEventArgs e)
{
ComponentDrawArgs args = new ComponentDrawArgs(e.Graphics, e.Bounds);

// Draw the fill (AKA area plot) first, then draw the grid lines, then
// draw the lines of the plot.

scatterPlot1.DrawFillToBase(args);
scatterGraph1.DrawGridLines(args);
scatterPlot1.DrawLines(args);

// Cancel the event since the drawing is completely handled here.
e.Cancel = true;
}


For more information on the custom drawing events, see the "Creating a Custom Plot for the Measurement Studio Graph.NET Controls" topic in the Measurement Studio Reference.

- Elton
0 Kudos
Message 5 of 5
(4,262 Views)