Class ChartLegend
Represents legend for a SfChart.
Implements
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public class ChartLegend : ItemsControl, ICloneable
Remarks
Chart legend will be added as chart's child. Each item in legend contain key information about the ChartSeriesBase. Legend has all abilities such as docking, enabling or disabling desired series in a SfChart.
Examples
<syncfusion:SfChart>
<syncfusion:SfChart.Legend>
<syncfusion:ChartLegend/>
</syncfusion:SfChart.Legend>
<syncfusion:Series/>
</syncfusion:SfChart >
ChartLegend chartLegend = new ChartLegend();
ChartArea.Legend = chartLegend;
Constructors
ChartLegend()
Initializes a new instance of the ChartLegend class.
Declaration
public ChartLegend()
Fields
CheckBoxVisibilityProperty
Identifies the CheckBoxVisibility dependency property. The DependencyProperty for CheckBoxVisibility property.
Declaration
public static DependencyProperty CheckBoxVisibilityProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
CornerRadiusProperty
Identifies the CornerRadius dependency property. The DependencyProperty for CornerRadius property.
Declaration
public static DependencyProperty CornerRadiusProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
DockPositionProperty
The DependencyProperty for DockPosition property.
Declaration
public static readonly DependencyProperty DockPositionProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
HeaderProperty
The DependencyProperty for Header property.
Declaration
public static readonly DependencyProperty HeaderProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
HeaderTemplateProperty
The DependencyProperty for HeaderTemplate property.
Declaration
public static readonly DependencyProperty HeaderTemplateProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
IconHeightProperty
Identifies the IconHeight dependency property. The DependencyProperty for IconHeight property.
Declaration
public static DependencyProperty IconHeightProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
IconVisibilityProperty
Identifies the IconVisibility dependency property. The DependencyProperty for IconVisibility property.
Declaration
public static DependencyProperty IconVisibilityProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
IconWidthProperty
Identifies the IconWidth dependency property. The DependencyProperty for IconWidth property.
Declaration
public static DependencyProperty IconWidthProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ItemMarginProperty
Identifies the ItemMargin dependency property. The DependencyProperty for ItemMargin property.
Declaration
public static DependencyProperty ItemMarginProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
LegendPositionProperty
The DependencyProperty for LegendPosition property.
Declaration
public static readonly DependencyProperty LegendPositionProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
OffsetXProperty
Identifies the OffsetX dependency property. The DependencyProperty for OffsetX property.
Declaration
public static readonly DependencyProperty OffsetXProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
OffsetYProperty
Identifies the OffsetY dependency property. The DependencyProperty for OffsetY property.
Declaration
public static readonly DependencyProperty OffsetYProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
OrientationProperty
The DependencyProperty for Orientation property.
Declaration
public static readonly DependencyProperty OrientationProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
SeriesProperty
The DependencyProperty for Series property.
Declaration
public static readonly DependencyProperty SeriesProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ToggleSeriesVisibilityProperty
Identifies the ToggleSeriesVisibility dependency property. The DependencyProperty for ToggleSeriesVisibility property.
Declaration
public static DependencyProperty ToggleSeriesVisibilityProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
Properties
CheckBoxVisibility
Gets or sets a value that determines whether to show/hide CheckBox in legend item.
Declaration
public Visibility CheckBoxVisibility { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Visibility | Windows.UI.Xaml.Visibility |
CornerRadius
Gets or sets the CornerRadius of legend's border.
Declaration
public CornerRadius CornerRadius { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.CornerRadius |
DockPosition
Gets or sets the position of the ChartLegend.
Declaration
public ChartDock DockPosition { get; set; }
Property Value
Type | Description |
---|---|
ChartDock |
Header
Gets or sets the header for the legend.
Declaration
public object Header { get; set; }
Property Value
Type |
---|
System.Object |
HeaderTemplate
Gets or sets the legend header template.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.DataTemplate | Windows.UI.Xaml.DataTemplate |
IconHeight
Gets or sets height of the legend icon.
Declaration
public double IconHeight { get; set; }
Property Value
Type |
---|
System.Double |
IconVisibility
Gets or sets the visibility of the legend icon.
Declaration
public Visibility IconVisibility { get; set; }
Property Value
Type | Description |
---|---|
Windows.UI.Xaml.Visibility | Windows.UI.Xaml.Visibility |
IconWidth
Gets or sets width of the legend icon.
Declaration
public double IconWidth { get; set; }
Property Value
Type |
---|
System.Double |
ItemMargin
Gets or sets the margin for legend item.
Declaration
public Thickness ItemMargin { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Thickness |
LegendPosition
Gets or sets the legend position in the chart.
Declaration
public LegendPosition LegendPosition { get; set; }
Property Value
Type | Description |
---|---|
LegendPosition |
Remarks
This is works for 2D charts alone.
OffsetX
Gets or sets the value used to move the ChartLegend on x-coordinate.
Declaration
public double OffsetX { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
This property is working for dock position as Floating only.
OffsetY
Gets or sets the value used to move the ChartLegend on y-coordinate.
Declaration
public double OffsetY { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
This property is working for dock position as Floating only.
Orientation
Gets or sets the orientation of chart legend.
Declaration
public ChartOrientation Orientation { get; set; }
Property Value
Type | Description |
---|---|
ChartOrientation |
Series
Gets or sets the series value to get data point based legend items.
Declaration
public ChartSeriesBase Series { get; set; }
Property Value
Type |
---|
ChartSeriesBase |
ToggleSeriesVisibility
Gets or sets a value indicating whether ToggleSeriesVisibility is enabled.
Declaration
public bool ToggleSeriesVisibility { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
Clone()
Returns the instance of ChartLegend class.
Declaration
public DependencyObject Clone()
Returns
Type | Description |
---|---|
Windows.UI.Xaml.DependencyObject | object. |
OnPointerExited(PointerRoutedEventArgs)
Called when the pointer leaved from the chart legend.
Declaration
protected override void OnPointerExited(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | Event args. |
OnPointerMoved(PointerRoutedEventArgs)
Called when the pointer moved on the LegendItem.
Declaration
protected override void OnPointerMoved(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | Event args. |
OnPointerPressed(PointerRoutedEventArgs)
Called when the pointer pressed on the LegendItem.
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | Event args. |