Skip to content

Commit aff10ed

Browse files
authored
Update legend.rst
Update documentation on legends
1 parent f6ac89a commit aff10ed

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

models/legend.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,46 @@ Legend
33
======
44

55
.. note:: This section is under construction. Please contribute!
6+
7+
Overview
8+
--------
9+
10+
For a legend to appear, the ``Series.Title`` property must be set.
11+
12+
Basic Options
13+
-------------
14+
Legend options are specified in the ``PlotModel``.
15+
16+
1. LegendPlacement
17+
* Place the legends inside/outside the plot area
18+
2. LegendPosition
19+
* Place the legend box in the top/middle/bottom left/center/right corner
20+
3. LegendOrientation
21+
* Orient the items horizontally/vertically
22+
4. LegendBackground
23+
* Gets or sets the background color of the legend. Defaults to no background
24+
5. LegendFontSize
25+
* Set the size of the legend font
26+
6. LegendMaxWidth
27+
* Set the max width of the legend
28+
7. LegendMaxHeight
29+
* Set the max height of the legend
30+
8. IsLegendVisible
31+
* Show/hide the legend. If the ``Title``s of the chart's series are properly set, defaults to showing the legend.
32+
33+
Example
34+
-------
35+
36+
.. code:: csharp
37+
38+
var model = new PlotModel();
39+
model.LegendPosition = LegendPosition.BottomCenter;
40+
model.LegendPlacement = LegendPlacement.Outside;
41+
model.LegendOrientation = LegendOrientation.Horizontal;
42+
43+
var lineSeries = new LineSeries()
44+
{
45+
Title = "MyTitle", //this is required for legends
46+
ItemsSource = dataPoints
47+
}
48+
model.Series.Add(lineSeries);

0 commit comments

Comments
 (0)