Back to Devexpress

LegendBase.Visibility Property

corelibraries-devexpress-dot-xtracharts-dot-legendbase-280d1065.md

latest7.1 KB
Original Source

LegendBase.Visibility Property

Specifies whether to show the legend on a chart.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Appearance)]
public DefaultBoolean Visibility { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Appearance)>
Public Property Visibility As DefaultBoolean

Property Value

TypeDescription
DefaultBoolean

Default - the legend visibility is defined according to the adaptive layout algoritm when the chart is resized; True - the legend is visible; False - the legend is hidden. The default is DefaultBoolean.Default.

|

Available values:

NameDescriptionReturn Value
True

The value is true.

|

0

| | False |

The value is false.

|

1

| | Default |

The value is specified by a global option or a higher-level object.

|

2

|

Remarks

Use the Visibility property to show or hide the legend within a chart area.

For more information, refer to Legends.

Note

The Default returned value of the Visibility property is in affect when the adaptive layout feature is enabled. So, ensure the ChartControl.AutoLayout property is set to true.

The adaptive layout feature is used to maintain a better chart appearance and layout when the chart becomes smaller.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Visibility 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-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.cs#L34

csharp
flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() { AddColoringColumns = true });
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;
chart.Series.Clear();

winforms-charts-create-model-for-custom-chart-element/CS/CustomChartElementModel/Form1.cs#L134

csharp
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
}

winforms-charts-configure-settings-for-template-series-and-series-added-manually/CS/series-base-example/Form1.cs#L16

csharp
// Hide the legend.
chart.Legend.Visibility = DefaultBoolean.False;

winforms-dashboard-custom-items/CS/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.cs#L34

csharp
flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() { AddColoringColumns = true });
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;
chart.Series.Clear();

winforms-heatmap-bind-to-data-source/CS/Form1.cs#L43

csharp
heatmap.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/Funnel/FunnelItemControlProvider.vb#L40

vb
flatData = customItemData.GetFlatData(New DashboardFlatDataSourceOptions() With {.AddColoringColumns = True})
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
chart.Series.Clear()

winforms-charts-create-model-for-custom-chart-element/VB/CustomChartElementModel/Form1.vb#L191

vb
diagram.AxisY.WholeRange.AlwaysShowZeroLevel = False
    chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False
End Sub

winforms-charts-configure-settings-for-template-series-and-series-added-manually/VB/series-base-example/Form1.vb#L19

vb
' Hide the legend.
chart.Legend.Visibility = DefaultBoolean.False
' Define series template for multiple series.

winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L39

vb
flatData = customItemData.GetFlatData(New DashboardFlatDataSourceOptions() With {.AddColoringColumns = True})
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
chart.Series.Clear()

winforms-heatmap-bind-to-data-source/VB/Form1.vb#L29

vb
Me.heatmap.Titles.Add(New DevExpress.XtraCharts.Heatmap.HeatmapTitle With {.Text = "Balance of Trade"})
Me.heatmap.Legend.Visibility = DevExpress.Utils.DefaultBoolean.[True]
Me.heatmap.Label.Visible = True

See Also

LegendBase Class

LegendBase Members

DevExpress.XtraCharts Namespace