GraPL > GraPL COM server > Sample scripts > Multiple series > Multiple series
 

Handling Multiple Data Series

GraPL.NET has no restrictions on the number of data series you can plot against a set of axes, or on the number of charts which can occupy the same completed graphic. The examples in this tutorial show how to overlay a linegraph on a barchart, how to plot two related series using a secondary Y-axis and how to make two related charts share a common key.

Checkweigher Data

A common requirement in analytical charting is to plot more than one set of data against a common pair of axes. Often this involves more than one chart type, maybe a barchart for the raw data and a line showing the fit to some analytical curve. The important thing to remember is that GraPL.NET sets up the axes when the first dataset is plotted, so the axis ranges, tickmark placement etc. are fixed from then on.

Usually it pays to plot the most variable data first as this will ensure that the axes span the entire range you require, although you can set the range explicitly if you prefer. Here is an example where a barchart shows the actual rejection count of some test packs (preset at various weights) and a linegraph is overlayed to show the theoretical fit:

 Col_Pack = Array(220,221, ... ,231,232)
 Col_Reject = Array(50,47,45,38,24,16,15,8,2,0,1,0,0)
 Col_Fit = Array(48.41595442,46.72048922,43.45559867, ... 
Checkweigher chart

The script which builds this begins by setting up the headings and other labels, and plotting the rejects at each weight as a simple barchart.

 grapl.New 0,0,432,324
 grapl.FrameStyle   = "Wiped,Boxed"
 grapl.Margins      = array(60,36,36,18)
 grapl.Heading      = "Fit of Logistic Curve;to Checkweigh Data"
 grapl.HeadingStyle = "Right"
 grapl.XLabels  = Col_Pack
 grapl.Key      = array("Experimental Data","Logistic Fit")
 grapl.Axes     = "Black,1,Solid"
 grapl.XCaption = "Weight of Test Pack(g)"
 grapl.YCaption = "No of rejects (out of 50)"
 grapl.Barchart Col_Reject
 
 grapl.Style = "Lines,Markers"
 grapl.Linegraph Col_Fit
 
 grapl.NoteStyle = "Transparent"
 grapl.NoteFont  = "AR,10,Forest"
 grapl.Note "Deduced Set weight = 224.48g;Uncertainty = 1.31g",8,40
 Response.Write grapl.RenderVML

Once the axes have been established, any further plot is simply added to the existing chart. Note that any settings of axis titles, labels, tickmark styles and so on must come before the first chart. Here we are simply superimposing a linegraph on top of the earlier barchart – however we do want both data series mentioned on the chart key, so this is set up as:

grapl.Key = array("Experimental Data","Logistic Fit")

GraPL assigns the key text to each data series as they are plotted, and does not actually draw the key until the chart is finally closed by a call to one of the Render commands.

Back to TopOn to next section

© Copyright Causeway Graphical Systems Ltd 2000-2007
Telephone: +44 (0)1439 788413