Back to Devexpress

Legend.MarkerMode Property

corelibraries-devexpress-dot-xtracharts-dot-legend.md

latest5.5 KB
Original Source

Legend.MarkerMode Property

Gets or sets the appearance of the chart legend markers.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public LegendMarkerMode MarkerMode { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property MarkerMode As LegendMarkerMode

Property Value

TypeDescription
LegendMarkerMode

The specified legend marker mode.

|

Available values:

NameDescription
Marker

Only markers are shown in the legend.

| | CheckBox |

Only check boxes are shown in the legend.

| | CheckBoxAndMarker |

Check boxes and markers are shown in the legend simultaneously (check boxes are positioned in front of markers).

| | MarkerAndCheckBox |

Markers and check boxes are shown in the legend simultaneously (markers are positioned in front of check boxes).

| | None |

No check boxes or markers are shown in the legend.

|

Remarks

For Chart Control for ASP.NET and ASP.NET MVC, to save the state of series‘, constant lines‘, strips‘ or indicators’ legend check boxes on callbacks, set WebChartControl.SaveStateOnCallbacks (ChartControlSettings.SaveStateOnCallbacks) to true.

Example

The example shows how to simultaneously display check boxes and markers in a legend.

To do this, set the Legend.MarkerMode property to the CheckBoxAndMarker (or MarkerAndCheckBox ) mode. The LegendMarkerMode enumeration lists all the possible modes.

csharp
// Use the following line to display check boxes and markers for the default chart legend.
chartControl.Legend.MarkerMode = LegendMarkerMode.CheckBoxAndMarker;

// Use the following line to display check boxes and markers for an additional legend.
chartControl.Legends[legendIndex].MarkerMode = LegendMarkerMode.CheckBoxAndMarker;
vb
' Use the following line to display check boxes and markers for the default chart legend.
chartControl.Legend.MarkerMode = LegendMarkerMode.CheckBoxAndMarker
' Use the following line to display check boxes and markers for an additional legend.
chartControl.Legends(legendIndex).MarkerMode = LegendMarkerMode.CheckBoxAndMarker

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MarkerMode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-charts-create-stacked-bar-chart/CS/Series_StackedBarChart/Form1.cs#L41

csharp
// Specify legend settings:
chart.Legend.MarkerMode = LegendMarkerMode.CheckBoxAndMarker;
chart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;

winforms-charts-create-stacked-bar-chart/VB/Series_StackedBarChart/Form1.vb#L38

vb
' Specify legend settings:
chart.Legend.MarkerMode = LegendMarkerMode.CheckBoxAndMarker
chart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center

See Also

Legends

Legend Check Box

Legend Marker

Legend Class

Legend Members

DevExpress.XtraCharts Namespace