Area charts
Area charts are very similar to line charts, except that the area between the line and a “baseline” (e.g., the X
axis) is shaded. You can create them using the Plot.Create.AreaChart
method:
Optional parameters can be used to determine the appearance of some elements of the plot. Many of these are in common with other kinds of plots and are described in the page about scatter plots; here are the ones specific to area charts:
bool vertical
: if this istrue
(the default), the area between the data points and theX
axis is shaded. If this is set tofalse
, the area between the data points and theY
axis is shaded instead.bool smooth
: by default, the points are connected by straight lines. If you set this totrue
, a smooth spline will be computed, which passes through all the data points.PlotElementPresentationAttributes dataPresentationAttributes
: this determines the presentation attributes for the line and the filled area.
Note that, in order for the area chart to be displayed correctly, the values for the x
axis should be monotonically increasing (if vertical
is true
; this should apply to the y
axis otherwise), that is, the data values should be provided in order of increasing x
.
Stacked area charts
The Plot.Create.StackedAreaChart
method can be used to create a stacked area chart. This consists of multiple areas stacked one over the other.
This method has the same parameters as the AreaChart
method. Here are a few notes to create a sucessful stacked area chart:
- The data should be provided in the following format:
- If
vertical
istrue
(the default),data[i][0]
shall be thex
value for all samples. Then,data[i][1]
,data[i][2]
, etc., are they
axis values for each of the stacked lines. - If
vertical
isfalse
,data[i][1]
shall be they
value for all samples. Then,data[i][0]
,data[i][2]
, etc., are thex
axis values for each of the stacked lines.
- If
- All data elements must be of the same length (
n + 1
, wheren
is the number of stacked areas). - The values for the
x
axis (ory
axis, ifvertical
is false) should be monotonically increasing. - The values for the stacked lines should be in increasing order. E.g., if
vertical
istrue
,data[i][2]
must be greater thandata[i][1]
etc.