Class Legend
Inherited Members
Namespace: Syncfusion.JavaScript.DataVisualization.Models
Assembly: Syncfusion.EJ.dll
Syntax
public class Legend : EJTagHelper
Constructors
Legend()
Declaration
public Legend()
Properties
Alignment
Gets or sets the Alignment of the legend, which provides an option to align the legend items either near, far or center.
Declaration
[JsonProperty("alignment")]
[JsonConverter(typeof(StringEnumConverter))]
public TextAlignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
TextAlignment |
Remarks
Horizontal alignment of the legend.
Background
Gets or sets the Background of the legend, which customizes the color or image of the legend background.
Declaration
[JsonProperty("background")]
public string Background { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Background for the legend. Use this property to add a background image or background color for the legend.
Border
Gets or sets the Border of the legend, which provides an option to customize all four borders of legend.
Declaration
[JsonProperty("border")]
public ChartBorder Border { get; set; }
Property Value
Type | Description |
---|---|
ChartBorder |
Remarks
Options for customizing the legend border.
ColumnCount
Gets or sets the Column count value of the legend, which displays the legend items in columns based on column count.
Declaration
[JsonProperty("columnCount")]
public int? ColumnCount { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Remarks
Number of columns to arrange the legend items.
EnableScrollbar
Gets or sets the value of EnableScrollbar property of the legend, which enables the scroll bar for legend based on size.
Declaration
[JsonProperty("enableScrollbar")]
public bool EnableScrollbar { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Controls whether legend has to use scrollbar or not. When enabled, scroll bar appears depending upon size and position properties of legend.
Fill
Gets or sets the Fill color of the legend, which provides an option to customize fill color of legend item shape.
Declaration
[JsonProperty("fill")]
public string Fill { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Fill color for the legend items. By using this property, it displays all legend item shapes in same color. Legend items representing invisible series is displayed in gray color.
Font
Gets or sets the Font used for legend, which provides an option to customize legend text size, color, opacity, family and style.
Declaration
[JsonProperty("font")]
public ChartFont Font { get; set; }
Property Value
Type | Description |
---|---|
ChartFont |
Remarks
Options to customize the font used for legend item text.
IsReversed
Gets or sets the value of IsReversed, which customizes the legend items to be displayed from right to left.
Declaration
[JsonProperty("isReversed")]
public bool IsReversed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Enabled or disables RTL for legend items.
ItemPadding
Gets or sets the ItemPadding value of the legend, which specifies the default gap between each legend items.
Declaration
[JsonProperty("itemPadding")]
public int ItemPadding { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Gap or padding between the legend items.
ItemStyle
Gets or sets the Style of the legend items, which provides an option to customize legend item style height and width.
Declaration
[JsonProperty("itemStyle")]
public ItemStyle ItemStyle { get; set; }
Property Value
Type | Description |
---|---|
ItemStyle |
Remarks
Options to customize the style of legend items.
Location
Gets or sets the Location of the legend, which places the legend based on specified x, y location.
Declaration
[JsonProperty("location")]
public Location Location { get; set; }
Property Value
Type | Description |
---|---|
Location |
Remarks
Options to customize the location of chart legend. Legend is placed in provided location only when value of position property is custom.
Opacity
Gets or sets the Opacity of the legend, which provides an option to customize the opacity of legend items.
Declaration
[JsonProperty("opacity")]
public double Opacity { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
Opacity of the legend.
Position
Gets or sets the Position of the legend, which provides an option to customize the position of legend items.
Declaration
[JsonProperty("position")]
[JsonConverter(typeof(StringEnumConverter))]
public LegendPosition Position { get; set; }
Property Value
Type | Description |
---|---|
LegendPosition |
Remarks
Places the legend at specified position. Legend can be placed at left, right, top or bottom of the chart area. To manually specify the location of legend, set custom as value to this property.
RowCount
Gets or sets the RowCount value of the legend, which displays the legend items in rows based on row count.
Declaration
[JsonProperty("rowCount")]
public int? RowCount { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Remarks
Number of rows to arrange the legend items.
Shape
Gets or sets the Shape of the legend, which specifies the shape for all the legend items to be rendered.
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("shape")]
public ChartShape Shape { get; set; }
Property Value
Type | Description |
---|---|
ChartShape |
Remarks
Shape of the legend items. Default shape for pie and doughnut series is circle and all other series uses rectangle.
Size
Gets or sets the Size of the legend, which provides an option to customize the legend size height and width.
Declaration
[JsonProperty("size")]
public ModelSize Size { get; set; }
Property Value
Type | Description |
---|---|
ModelSize |
Remarks
Options to customize the size of the legend.
TextOverflow
Gets or sets the TextOverflow of the legend, which provides an option to render legend items without any overlap.
Declaration
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("textOverflow")]
public TextOverflow TextOverflow { get; set; }
Property Value
Type | Description |
---|---|
TextOverflow |
Remarks
Specifies the action taken when the legend width is more than the textWidth.
TextWidth
Gets or sets the TextWidth of the legend, which specifies the default width of each legend item texts.
Declaration
[JsonProperty("textWidth")]
public int TextWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Text width for legend item.
Title
Gets or sets the Title of the legend, which provides an option to customize the title text of legend.
Declaration
[JsonProperty("title")]
public LegendTitle Title { get; set; }
Property Value
Type | Description |
---|---|
LegendTitle |
Remarks
Options to customize the legend title.
ToggleSeriesVisibility
Gets or sets the value of ToggleSeriesVisibility property of the legend, which controls the visibility of series.
Declaration
[JsonProperty("toggleSeriesVisibility")]
public bool ToggleSeriesVisibility { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Controls whether series visibility should be toggled by clicking the legend or not.
Visible
Gets or sets the value of Visible property of the legend, which controls the visibility of all legend items.
Declaration
[JsonProperty("visible")]
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Controls the visibility of the legend.
Methods
ShouldSerializeBorder()
Declaration
public bool ShouldSerializeBorder()
Returns
Type | Description |
---|---|
System.Boolean |
ShouldSerializeFont()
Declaration
public bool ShouldSerializeFont()
Returns
Type | Description |
---|---|
System.Boolean |
ShouldSerializeItemSize()
Declaration
public bool ShouldSerializeItemSize()
Returns
Type | Description |
---|---|
System.Boolean |
ShouldSerializeLocation()
Declaration
public bool ShouldSerializeLocation()
Returns
Type | Description |
---|---|
System.Boolean |
ShouldSerializeSize()
Declaration
public bool ShouldSerializeSize()
Returns
Type | Description |
---|---|
System.Boolean |