Markers are shapes displayed at each data point. Each series that supports markers has an instance of the Markers class associated with it. It is accessible through the Markers property of the Series class. For example:
VB.NET |
|
Dim markers As Markers = area.Markers |
C# |
|
Markers markers = area.Markers; |
Currently the Line, Area, HighLow, Polar and Radar series support markers.
Controlling the Visibility of Markers
The visibility of markers is controlled by the Visible property. By default it is set to false. The following code displays the markers of a line series:
VB.NET |
|
series.Markers.Visible = True |
C# |
|
series.Markers.Visible = true; |
Controlling the Shape of Markers
The shape of markers is controlled by the Style property. It is of type PointStyle and can accept the following values (for details, see PointStyle Enumeration):
Bar
Cylinder
Cone
InvertedCone
Pyramid
InvertedPyramid
Sphere
Ellipse
Cross
DiagonalCross
Star
By default the markers are displayed as bars. The following example displays the markers of a line series as cones:
VB.NET |
|
line.Markers.Style = PointStyle.Cone |
C# |
|
line.Markers.Style = PointStyle.Cone; |
Controlling the Dimensions of Markers
The width and height of markers are controlled by the Width and Height properties, respectively. By default these properties are set to 2.5f Model units. The following example increases the size of the markers:
VB.NET |
|
line.Markers.Width = 3 line.Markers.Height = 3.5f
|
C# |
|
line.Markers.Width = 3; line.Markers.Height = 3.5f; |
The depth dimension of the markers is calculated automatically by default. This feature is useful because you do not have to bother with increasing the depth of the markers if for example you have decided to increase the depth of an area or line displayed as tape. Auto depth can be switched off by setting the AutoDepth property to false:
VB.NET |
|
line.Markers.AutoDepth = False |
C# |
|
line.Markers.AutoDepth = false; |
When the depth of the line is not calculated automatically, the user can set it to a custom value with the help of the Depth property:
VB.NET |
|
line.Markers.Depth = 4 |
C# |
|
line.Markers.Depth = 4; |
Controlling the Appearance of Markers
The markers are filled with the fill effect specified by the FillEffect property. The user can change the appearance of the marker borders through the LineProperties object accessible from the Border property.
The following code will display the markers in red with a blue border:
VB.NET |
|
line.Markers.FillEffect.SetSolidColor(Color.Red) line.Markers.Border.Color = Color.Blue
|
C# |
|
line.Markers.FillEffect.SetSolidColor(Color.Red); line.Markers.Border.Color = Color.Blue; |
Related Examples
Windows Forms: Series Attributes\Markers
See Also
Series | Markers