@@ -4,11 +4,55 @@ AreaSeries
4
4
5
5
.. note :: This section is under construction. Please contribute!
6
6
7
- A ``AreaSeries `` shows an area between two sets of points, or between a
8
- set of point and a baseline.
7
+ An ``AreaSeries `` shows an area between two lines defined by two sets
8
+ of points, or a set of points and a baseline.
9
9
10
10
.. image :: AreaSeries.png
11
11
12
+ Axes
13
+ ----
14
+
15
+ An ``AreaSeries `` requires a horizontal and a vertical axis.
16
+
17
+ By default, the ``AreaSeries `` will use the default horizontal and
18
+ vertical axes in the parent ``PlotModel ``. If there are more than one
19
+ horizontal/vertical axis, the axes can be specified by the ``XAxisKey ``
20
+ and ``YAxisKey `` properties. This requires the ``Key `` property to be
21
+ set on the desired axes.
22
+
23
+ Data
24
+ ----
25
+
26
+ Use the ``Points `` and ``Points2 `` collections to add data points to
27
+ the first and second lines of the ``AreaSeries `` respectively:
28
+
29
+ .. code :: csharp
30
+
31
+ areaSeries1 .Points .Add (new DataPoint (0 , 5 ));
32
+ areaSeries1 .Points .Add (new DataPoint (10 , 8 ));
33
+
34
+ areaSeries1 .Points2 .Add (new DataPoint (0 , 2 ));
35
+ areaSeries1 .Points2 .Add (new DataPoint (10 , 1 ));
36
+
37
+ Alternatively, you can specify a collection in the ``ItemsSource `` properties.
38
+
39
+ - If the ``Mapping `` property is set, each element in the collection
40
+ will be transformed
41
+ - If the collection is a list of ``DataPoint ``, or a type that implements
42
+ ``IDataPointProvider ``, it will be used with no mapping
43
+ - If the ``DataFieldX `` and ``DataFieldY `` properties are set, each
44
+ element of the collection will be reflected to create a data point
45
+ for the first line
46
+ - If the ``DataFieldX2 `` and ``DataFieldY2 `` properties are set, each
47
+ element of the collection will be reflected to create a data point
48
+ for the second line
49
+
50
+ The ``Points2 `` property will not be ignored if the ``ItemSource `` property
51
+ is non-null.
52
+
53
+ If no data points are provided for the second line, the baseline value
54
+ ``ConstantY2 `` along with ``X `` values of the first and last data points
55
+ in the first line will be used instead.
12
56
13
57
Tracker
14
58
-------
@@ -39,16 +83,54 @@ See `MSDN`_ for more information about format strings.
39
83
The ``TrackerKey `` property may be used to specify a `custom tracker `_.
40
84
This makes it possible to use different trackers for each series.
41
85
86
+ Color and Style
87
+ ---------------
88
+
89
+ The ``Color `` and ``Color2 `` properties determine the colors of the first and second
90
+ line respective. The default value of ``Color2 `` is ``Automatic ``, which causes the
91
+ second line to have the same color as the first. The default value of ``Color `` is
92
+ ``Automatic ``. In this case the color will be set automatically from the colors
93
+ specified in the ``DefaultColors `` property of the parent ``PlotModel ``.
94
+
95
+ The ``LineStyle `` defines the line style. The default is ``Solid ``. The
96
+ ``StrokeThickness `` defines the thickness of lines.
97
+
98
+ Markers can be included by specifying the ``MarkerType `` and ``MarkerStroke ``. The
99
+ default ``MarkerType `` is ``None ``. If the ``Custom `` marker type is used, then a
100
+ list of relative screen points in screen-space must be provided in the
101
+ ``MarkerOutline `` property.
102
+
103
+ The ``MarkerStroke `` defines the stroke color of the markers. The ``MarkerFill ``
104
+ defines the fill color of the markers. The ``MarkerStrokeThickness `` defines the
105
+ thickness of the lines in the marker. The ``MarkerSize `` defines the size of the
106
+ markers.
107
+
108
+ The ``Fill `` defines the color of the fill color of the areas. The default value is
109
+ ``Automatic ``. In this case the color will be set automatically based on the color
110
+ of the first line.
111
+
42
112
Example
43
113
-------
44
114
45
115
.. sourcecode :: csharp
46
116
47
117
var model = new PlotModel { Title = "AreaSeries" };
48
- var areaSeries = new AreaSeries());
49
- ...
118
+ model.Axes.Add(new LinearAxis() { Title = "Day", Position = AxisPosition.Bottom });
119
+ model.Axes.Add(new LinearAxis() { Title = "Output", Position = AxisPosition.Left });
120
+
121
+ var areaSeries = new AreaSeries() { Color2 = OxyColors.Transparent };
122
+
123
+ var r = new Random(1);
124
+ var dailyOutput = 10;
125
+ for (int i = 0; i <= 100; i++)
126
+ {
127
+ areaSeries.Points.Add(new DataPoint(i, dailyOutput));
128
+
129
+ dailyOutput = Math.Max(0, dailyOutput + r.Next(-2, 3));
130
+ }
131
+
50
132
model.Series.Add(areaSeries);
51
133
52
134
.. _tracker : ../tracker
53
135
.. _MSDN : http://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
54
- .. _custom tracker : ../tracker
136
+ .. _custom tracker : ../tracker
0 commit comments