Class ChartCategory
Provides options to customize the category for the multilevel labels.
Inherited Members
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChartCategory : ChartSubComponent, ISubcomponentTracker
Remarks
This component allows you to adjust properties related to individual categories, enhancing the organizational clarity of chart labels.
Constructors
ChartCategory()
Declaration
public ChartCategory()
Properties
CustomAttributes
Gets or sets the custom attributes for multi-level labels.
Declaration
public object CustomAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An object that represents custom attributes for multi-labels. |
Remarks
The provided custom attribute can be accessed by the user from the OnAxisMultiLevelLabelRender event arguments for further actions or modifications.
Examples
This example demonstrates how to modify the text style of a multi-level label using custom attributes from the 'OnAxisMultiLevelLabelRender' event.
<SfChart>
<ChartEvents OnAxisMultiLevelLabelRender="OnMultiLevelLabelRender"></ChartEvents>
<ChartMultiLevelLabels>
<ChartMultiLevelLabel>
<ChartCategories>
<ChartCategory Start="-0.5" End="3.5" Text="Half yearly 1" MaximumTextWidth=50 CustomAttributes="@customAtt"></ChartCategory>
<ChartCategory Start="3.5" End="7.5" Text="Half yearly 2" MaximumTextWidth=50></ChartCategory>
</ChartCategories>
</ChartMultiLevelLabel>
</ChartMultiLevelLabels>
...
</SfChart>
@code {
object customAtt = new ChartAxisMultiLevelLabelTextStyle
{
FontFamily = "Roboto",
FontWeight = "600",
Color = "Red",
Size = "14px"
};
public void OnMultiLevelLabelRender(AxisMultiLabelRenderEventArgs args)
{
if (args.CustomAttributes != null)
{
args.TextStyle = (ChartAxisMultiLevelLabelTextStyle)args.CustomAttributes;
}
}
}
End
Gets or sets the end value of the multi-level label.
Declaration
public object End { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The end value of the multi-level label, specifying where the label range terminates. |
Remarks
This property sets the end of a single multi-level label. It accepts the value based on the provided ValueType and axis labels.
MaximumTextWidth
Gets or sets the maximum width of the text for multi-level labels.
Declaration
public double MaximumTextWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The maximum width of the text for multi-level labels. The default value is 0. |
Remarks
If the text exceeds this value, the overflow is handled based on the multi-level label's "TextOverflow" setting.
Start
Gets or sets the start value of the multi-level labels.
Declaration
public object Start { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The start value of the multi-level label, determining where the label range begins. |
Remarks
This property sets the start of a single multi-level label. It accepts the value based on the provided ValueType and axis labels.
Text
Gets or sets the text for the multi-level labels.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the text for the multi-level labels. The default value is an empty string. |
Remarks
This property specifies the label text that will be displayed for a multi-level category in the chart. You can set this to any descriptive text necessary to identify the category.
Type
Gets or sets the border type for the individual multi-level label.
Declaration
public BorderType Type { get; set; }
Property Value
Type | Description |
---|---|
BorderType | One of the BorderType enumerations that specifies the border type for the individual multi-level label. The options include:
|
Remarks
The multi-level label for this category will be rendered with the specified border type.
Methods
OnInitialized()
Declaration
protected override void OnInitialized()
OnParametersSet()
Declaration
protected override void OnParametersSet()