Class Chart3DLegendSettings
Gets or sets the legend customization options for the SfChart3D component.
Implements
Inherited Members
Namespace: Syncfusion.Blazor.Chart3D
Assembly: Syncfusion.Blazor.dll
Syntax
public class Chart3DLegendSettings : Chart3DSubComponent, IChart3DSubcomponentTracker, IChart3DLegendBase
Remarks
Use this class to customize the legend appearance in the SfChart3D. The legend can be positioned at the top, left, bottom, or right of the chart area.
Examples
<SfChart3D>
<Chart3DSeriesCollection>
<Chart3DSeries XName="Browser" YName="Users" DataSource="@StatisticsDetails">
</Chart3DSeries>
</Chart3DSeriesCollection>
<Chart3DPrimaryXAxis ValueType="Syncfusion.Blazor.Chart3D.ValueType.Category">
</Chart3DPrimaryXAxis>
<Chart3DLegendSettings Alignment="Alignment.Center" Background="red" Visible="true" Width="350px" Height="50px" Position="LegendPosition.Bottom" ShapeHeight="20" ShapeWidth="20"
ToggleVisibility="false" Reverse="true">
<Chart3DLegendBorder Color="red" Width="2"></Chart3DLegendBorder>
<Chart3DLegendMargin Bottom="5" Left="5" Top="5" Right="5"></Chart3DLegendMargin>
<Chart3DLegendTextStyle FontFamily="Arial" Color="Gray" FontStyle="Bold" FontWeight="600" FontSize="14px" Opacity="0.9" TextOverflow="TextOverflow.Trim"></Chart3DLegendTextStyle>
<Chart3DLegendTitleStyle FontFamily="Arial" Color="Gray" FontStyle="Bold" FontWeight="600" FontSize="14px" Opacity="0.9" TextOverflow="TextOverflow.Trim"></Chart3DLegendTitleStyle>
</Chart3DLegendSettings>
</SfChart3D>
@code {
public class Statistics
{
public string Browser { get; set; }
public double Users { get; set; }
public string Color { get; set; }
}
public List<Statistics> StatisticsDetails = new List<Statistics>
{
new Statistics { Browser = "Chrome", Users = 65.3, Color = "red" },
new Statistics { Browser = "Safari", Users = 18.3, Color = "blue" },
new Statistics { Browser = "Edge", Users = 5, Color = "green" },
new Statistics { Browser = "Firefox", Users = 3, Color = "orange" },
new Statistics { Browser = "Samsung Internet", Users = 2.6, Color = "yellow" },
new Statistics { Browser = "Opera", Users = 2.4, Color = "pink" },
};
}
Constructors
Chart3DLegendSettings()
Declaration
public Chart3DLegendSettings()
Properties
AccessibilityDescription
Gets or sets the description for accessibility purposes, particularly when focused on the legend element by screen readers.
Declaration
public string AccessibilityDescription { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the accessibility description for the legend. The default value is empty string. |
Remarks
Use this property to provide a description for the legend element for accessibility purposes.
Alignment
Gets or sets the alignment of the legend.
Declaration
public Alignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
Alignment | One of the Alignment enumerations that specifies the legend alignment. Options include: |
Remarks
The alignment of the legend works as follows:
Near
: Aligns the legend to the top-left of the 3D chart if Position isLegendPosition.Top
and to the right-top of the 3D chart if Position isLegendPosition.Right
.Center
: Aligns the legend to the top center of the 3D chart if Position isLegendPosition.Top
and to the right center of the 3D chart if Position isLegendPosition.Right
.Far
: Aligns the legend to the top-right of the 3D chart if Position isLegendPosition.Top
and to the right-bottom of the 3D chart if Position isLegendPosition.Right
.
AllowPaging
Gets or sets a value indicating whether to enable the pages for the legend item.
Declaration
public bool AllowPaging { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend content should be paged with respective contents; otherwise, false. The default value is true. |
Remarks
When set to true, the legend elements will display in the respective page. This is different from the default.
Background
Gets or sets the background color of the SfChart3D legend area.
Declaration
public string Background { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value specifying the background color of the SfChart3D legend area. The default value is "transparent". |
Remarks
The value can be specified in hex or rgba format, following valid CSS color string conventions.
ContainerPadding
Gets or sets an instance of Chart3DLegendContainerPadding which specifies the padding for the legend container.
Declaration
public Chart3DLegendContainerPadding ContainerPadding { get; set; }
Property Value
Type | Description |
---|---|
Chart3DLegendContainerPadding | The default value is an instance of Chart3DLegendContainerPadding allowing customization of left, right, top, and bottom paddings. |
Remarks
The Chart3DLegendContainerPadding class provides options to customize the left, right, top, and bottom paddings of the 3D chart legend container. Adjusting these paddings controls the space between the legend container and the surrounding elements.
EnableHighlight
Gets or sets a value indicating whether to enable highlighting when hovered over the legend element.
Declaration
public bool EnableHighlight { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if highlight options are enabled; otherwise, false. The default value is false. |
Remarks
If set to true, when hovered over the legend element, the respective series will be highlighted.
Height
Gets or sets the height for the legend.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the height of the legend element. The default value is null. Based on the legend position, the height of the legend will be calculated. |
Remarks
Accepts values in either pixels or percentage.
IsInversed
Gets or sets a value indicating whether to inverse legend item content (image and text).
Declaration
public bool IsInversed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend content should be inversed; otherwise, false. The default value is false. |
Remarks
When set to true, the legend element will display the text before the associated shape. This is different from the default, where the shape is shown first, followed by the text.
ItemPadding
Gets or sets the padding between legend items.
Declaration
public double ItemPadding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding between legend items. The default value is 0. |
Remarks
Use this property to increase or decrease the padding between legend items.
MaximumLabelWidth
Gets or sets the maximum width of the individual legend item after which they get trimmed, wrapped, or clipped.
Declaration
public double MaximumLabelWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the maximum width for the legend text. The default value is null. |
Remarks
Use this property to set the maximum width of the individual legend item. If the legend text exceeds the specified width, it will be trimmed, wrapped, or clipped based on the TextOverflow property.
MaximumTitleWidth
Gets or sets the maximum width of the legend title after which they get trimmed, wrapped, or clipped.
Declaration
public double MaximumTitleWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Specifies the maximum width for the legend title. The default value is 100. |
Remarks
Use this property to set the maximum width of the legend title. If the legend title exceeds the specified width, it will be trimmed, wrapped, or clipped based on the TextOverflow property.
Mode
Gets or sets the mode of the legend in the SfChart3D.
Declaration
public Chart3DLegendMode Mode { get; set; }
Property Value
Type | Description |
---|---|
Chart3DLegendMode | One of the Chart3DLegendMode enumeration that specifies the position of the legend. The options include: |
Remarks
Use this property to display the legend based on the series or data points in the SfChart3D.
Opacity
Gets or sets the opacity of the legend background.
Declaration
public double Opacity { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the opacity of the legend background. The default value is 1. |
Remarks
The provided background color will be rendered with the applied opacity value.
Padding
Gets or sets the padding around the legend collection.
Declaration
public double Padding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding around the legend collection. The default value is 8. |
Remarks
Use this property to increase or decrease the padding around the legend collection.
Position
Gets or sets the position of the legend in the SfChart3D.
Declaration
public LegendPosition Position { get; set; }
Property Value
Type | Description |
---|---|
LegendPosition | One of the LegendPosition enumerations that specifies the position of the legend. Options include: |
Remarks
Use this property to position the legend at the top, left, bottom, or right of the SfChart3D. By default, the legend will be placed at the bottom of the SfChart3D.
Reverse
Gets or sets a value indicating whether to reverse the order of legend items.
Declaration
public bool Reverse { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend items should be reversed; otherwise, false. The default value is false. |
Remarks
If set to true, the last series in the collection will be placed first.
ShapeHeight
Gets or sets the height of the legend shape.
Declaration
public double ShapeHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the height of the legend shape. The default value is 10. |
Remarks
Use this property to customize the height of the legend shape.
ShapePadding
Gets or sets the padding between the legend shape and legend text.
Declaration
public double ShapePadding { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the padding between the legend shape and legend text. The default value is 8. |
Remarks
Set this property to increase or decrease the padding between the legend shape and legend text to enhance the visual appearance.
ShapeWidth
Gets or sets the width of the legend shape.
Declaration
public double ShapeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double representing the width of the legend shape. The default value is 10. |
Remarks
Use this property to customize the width of the legend shape.
TextOverflow
Gets or sets the text overflow behavior to employ when the individual legend text overflows the legend bounds or MaximumLabelWidth.
Declaration
public LabelOverflow TextOverflow { get; set; }
Property Value
Type | Description |
---|---|
LabelOverflow | One of the LabelOverflow enumeration values that specifies the text overflow option. The options include: The default value is Ellipse. |
Remarks
Use this property to set the text overflow behavior when the individual legend text overflows the legend bounds or MaximumLabelWidth.
TextStyle
Gets or sets an instance of Chart3DLegendTextStyle that specifies the text style of the legend.
Declaration
public Chart3DLegendTextStyle TextStyle { get; set; }
Property Value
Type | Description |
---|---|
Chart3DLegendTextStyle | The default value is an instance of Chart3DLegendTextStyle. |
Remarks
The legend text font and alignment can be customized using this instance of Chart3DLegendTextStyle.
TextWrap
Gets or sets the text wrap behavior when the individual legend text overflows the legend bounds or MaximumLabelWidth.
Declaration
public TextWrap TextWrap { get; set; }
Property Value
Type | Description |
---|---|
TextWrap | One of the TextWrap enumeration values that specify the text wrap option. The options include: |
Remarks
This property is applicable only when TextOverflow is set to LabelOverflow.Ellipse.
Title
Gets or sets the title for the SfChart3D legend.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string value representing the title of the legend. The default value is an empty string. |
Remarks
33 Use this property to provide brief information about the legend content.
TitlePosition
Gets or sets the position of the legend title in the SfChart3D. The possible values are:
Declaration
public Chart3DLegendTitlePosition TitlePosition { get; set; }
Property Value
Type | Description |
---|---|
Chart3DLegendTitlePosition | Accepts one of the Chart3DLegendTitlePosition enumerations. The default value is Top. |
Remarks
Use this property to position the legend title at the top, left, bottom, or right of the legend area. This is only applicable when the Title property is set.
TitleStyle
Gets or sets the font style for the legend title in the SfChart3D.
Declaration
public Chart3DLegendTitleStyle TitleStyle { get; set; }
Property Value
Type | Description |
---|---|
Chart3DLegendTitleStyle | Accepts an instance of Chart3DLegendTitleStyle class. The default value is an instance of Chart3DLegendTitleStyle. |
Remarks
Use this class to customize the font style of the legend title in the SfChart3D to enhance the visual appearance. It is only applicable when the Title property is set.
ToggleVisibility
Gets or sets a value indicating whether the series' visibility collapses on the legend click.
Declaration
public bool ToggleVisibility { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the series' visibility collapses on the legend click; otherwise, false. The default value is true. |
Remarks
If set to true, the series' visibility collapses on the legend click. Otherwise based on the SelectionMode or HighlightMode the series selection or highlight will be toggled.
Visible
Gets or sets a value indicating the visibility of the legend.
Declaration
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the legend is visible; otherwise, false. The default value is true. |
Remarks
When the Name has been set, the legend will be visible by default.
Width
Gets or sets the width for the legend.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the width of the legend. Based on the legend position, the width will be calculated. The default value is null. |
Remarks
Accepts values in either pixels or percentage.
Methods
OnInitialized()
Declaration
protected override void OnInitialized()