Class ChartAnnotation
Represents an annotation, a user-defined HTML element that can be added to a chart. This class provides options for customizing these annotations to enhance their visual appeal.
Inherited Members
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChartAnnotation : ChartSubComponent, ISubcomponentTracker, IChartElement
Constructors
ChartAnnotation()
Declaration
public ChartAnnotation()
Properties
ContentTemplate
Gets or sets the content template for the annotation. The content template can be any HTML element, allowing for a flexible and customizable way to display additional information or visuals on the chart.
Declaration
public RenderFragment ContentTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | The template content is applied for the chart annotation based on the custom template provided by the user that is being rendered. The default value is null. |
Remarks
The ContentTemplate is used to define a custom template for the chart annotation.
Examples
<SfChart Title="Olympic Medals">
<ChartAnnotations>
<ChartAnnotation X="250" Y="100" CoordinateUnits="Units.Pixel">
<ContentTemplate>
<div>Annotation in Pixel</div>
</ContentTemplate>
</ChartAnnotation>
</ChartAnnotations>
...
</SfChart>
CoordinateUnits
Gets or sets the annotation’s coordinate units, either in Pixel or Point.
Declaration
public Units CoordinateUnits { get; set; }
Property Value
Type | Description |
---|---|
Units | One of the Units enumerations that specifies the coordinate units of an annotation. The options include:
|
Remarks
Adjust the CoordinateUnits property to control how the annotation is positioned on the chart.
Choosing Pixel
makes the annotation placement more absolute relative to the control's boundaries,
whereas Point
allows it to respond dynamically to data changes and axis scaling.
Description
Gets or sets information about the annotation for assistive technology.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string providing additional details or context about the annotation that can be utilized by assistive technology. |
Remarks
Use the Description property to convey useful information to screen readers and other accessibility tools.
Region
Gets or sets the regions to insert annotations in relation to a series or a chart.
Declaration
public Regions Region { get; set; }
Property Value
Type | Description |
---|---|
Regions | One of the Regions enumerations that specifies the regions of an annotation. The options include:
|
Remarks
Adjust the Region property to change where and how annotations are displayed on the chart.
X
Gets or sets the X-coordinate value for the annotation.
Declaration
public object X { get; set; }
Property Value
Type | Description |
---|---|
System.Object | If the coordinate unit is set to Point, this property specifies the axis value. Otherwise, it specifies the pixel or percentage of the coordinate. The default value is zero. |
Remarks
This property determines the horizontal position of the annotation based on the defined coordinate units.
When the CoordinateUnits is set to Units.Pixel
, the X
value represents the
number of pixels from the chart's left boundary. If set to Units.Point
, it corresponds to a value
along the horizontal axis.
XAxisName
Gets or sets the name of the horizontal axis associated with the annotation.
Declaration
public string XAxisName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the horizontal axis. |
Remarks
This property requires the presence of the 'Axes' of the chart.
Y
Gets or sets the Y-coordinate value for the annotation.
Declaration
public string Y { get; set; }
Property Value
Type | Description |
---|---|
System.String | If the coordinate unit is set to Point, this property specifies the axis value. Otherwise, it specifies the pixel or percentage of the coordinate. The default value is zero. |
Remarks
This property determines the vertical position of the annotation based on the defined coordinate units.
When the CoordinateUnits is set to Units.Pixel
, the Y
value represents the
number of pixels from the chart's top boundary. If set to Units.Point
, it corresponds to a value
along the vertical axis.
YAxisName
Gets or sets the name of the vertical axis associated with the annotation.
Declaration
public string YAxisName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the vertical axis. |
Remarks
This property requires the presence of the 'Axes' of the chart.
Methods
OnInitialized()
Declaration
protected override void OnInitialized()
OnParametersSet()
Declaration
protected override void OnParametersSet()