Class SfChart
Implements
Inherited Members
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class SfChart : SfDataBoundComponent, ISubcomponentTracker, IHandleEvent
Constructors
SfChart()
Declaration
public SfChart()
Properties
AllowMultiSelection
Option for enable to allow the multi select of the chart component.
Declaration
public bool AllowMultiSelection { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Background
Gets and sets the background color of the chart that accepts value in hex and rgba as a valid CSS color string.
Declaration
public string Background { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value that specifies the background color of the chart. |
BackgroundImage
Gets and sets the background image for chart.
Declaration
public string BackgroundImage { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the URL or path to the background image. The default value is empty. |
ChartScrollBarContent
Declaration
public ScrollbarContent ChartScrollBarContent { get; set; }
Property Value
Type | Description |
---|---|
Syncfusion.Blazor.Charts.Internal.ScrollbarContent |
ChildContent
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment |
CustomClass
Gets and sets the custom class for the chart.
Declaration
public string CustomClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is empty. |
DataSource
Specifies the DataSource for the chart. It can be an array of JSON objects or an instance of DataManager.
Declaration
public IEnumerable<object> DataSource { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | An array of objects or an instance of DataManager that represents the data source for the chart. |
Description
Gets and sets the access text for chart title.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
EnableAnimation
Option for enable the animation for chart.
Declaration
public bool EnableAnimation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableAutoIntervalOnBothAxis
Gets and sets both axis interval will be calculated automatically with respect to the zoomed range.
Declaration
public bool EnableAutoIntervalOnBothAxis { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableRtl
Gets or sets the right to left direction that defines the text writing and user interface (UI) elements direction in layout.
Declaration
public bool EnableRtl { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableSideBySidePlacement
Option for enable the side by side placement.
Declaration
public bool EnableSideBySidePlacement { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Height
The height of the chart as a string accepts input both as '100px' or '100%'. If specified as '100%, chart renders to the full height of its parent element.
Declaration
public string Height { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is |
HighlightColor
Gets and sets the highlight color for the data point when user hover the data point.
Declaration
public string HighlightColor { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
HighlightMode
Gets and sets the highlight mode of the chart component.
Declaration
public HighlightMode HighlightMode { get; set; }
Property Value
Type | Description |
---|---|
HighlightMode | The highlight mode of the chart component. |
HighlightPattern
Gets and sets the highlight pattern of the chart component.
Declaration
public SelectionPattern HighlightPattern { get; set; }
Property Value
Type | Description |
---|---|
SelectionPattern | The highlighting pattern for the series or data point in the chart. |
ID
Defines id of the chart component.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
IsMultiSelect
Option for enable the multi select of the chart component.
Declaration
public bool IsMultiSelect { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsTransposed
Gets and sets whether the chart should be render in transposed manner or not.
Declaration
public bool IsTransposed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Palettes
Gets and sets the palette for the chart series.
Declaration
public string[] Palettes { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | Accepts the string array that specifies the palette for chart series. |
Query
Specifies query to select data from DataSource. This property is applicable only when the DataSource is SfDataManager
.
Declaration
public Query Query { get; set; }
Property Value
Type | Description |
---|---|
Query | An object of the type Query that represents the query to be selected the data from data source. |
SelectionMode
Gets and sets the selection mode of the chart component.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
SelectionMode | One of the SelectionMode enumeration values that specifies the mode of selection in chart component. |
SelectionPattern
Gets and sets the selection pattern of the chart component.
Declaration
public SelectionPattern SelectionPattern { get; set; }
Property Value
Type | Description |
---|---|
SelectionPattern | The selection pattern for the series or data point in the chart. |
SubTitle
Gets and sets the sub title of the chart component.
Declaration
public string SubTitle { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. The default value is empty. |
TabIndex
Gets and sets the tabIndex for chart title.
Declaration
public double TabIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value representing the tab index of chart. The default value is |
Theme
Gets and sets the theme for the chart.
Declaration
public Theme Theme { get; set; }
Property Value
Type | Description |
---|---|
Theme | Accepts the value from the Theme enum. |
Title
Gets and sets the title of the chart component.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
UseGroupingSeparator
Option for enable the group separator for yaxis label.
Declaration
public bool UseGroupingSeparator { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Width
The width of the chart as a string accepts input as both like '100px' or '100%'. If specified as '100%, chart renders to the full width of its parent element.
Declaration
public string Width { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
ClearSort()
Clears the sorting applied to the chart.
Declaration
public void ClearSort()
Examples
<SfButton OnClick="ClearSort" IsToggle="true" IsPrimary="true">ClearSort</SfButton>
<SfChart @ref=”Chart” DataSource=”Data”>
<ChartSorting PropertyName ="X" Direction ="ListSortDirection.Ascending "/>
…
</SfChart>
@code {
public SfChart Chart;
public void ClearSort()
{
Chart.ClearSort();
}
}
ExportAsync(ExportType, String, Nullable<PdfPageOrientation>, Boolean)
The method is used to perform the export functionality for the rendered chart.
Declaration
public Task ExportAsync(ExportType type, string fileName, Nullable<PdfPageOrientation> orientation = null, bool allowDownload = true)
Parameters
Type | Name | Description |
---|---|---|
ExportType | type | Specifies the export type for the rendered chart. |
System.String | fileName | Specifies the filename. |
System.Nullable<Syncfusion.PdfExport.PdfPageOrientation> | orientation | Specifies the portrait or landscape orientation of the page. |
System.Boolean | allowDownload | Specifies whether to download or not. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Export the chart with sepcifies export type. |
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Overrides
OnInitialized()
Declaration
protected override void OnInitialized()
OnParametersSet()
Declaration
protected override void OnParametersSet()
PrintAsync(ElementReference)
The method is used to perform the print functionality in chart.
Declaration
public Task PrintAsync(ElementReference elementRef = null)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.ElementReference | elementRef |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Print the chart. |
RefreshAsync(Boolean)
The method is used to re-render the chart.
Declaration
public Task RefreshAsync(bool shouldAnimate = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | shouldAnimate |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RemoveTooltipData()
Declaration
public void RemoveTooltipData()
Sort(String, ListSortDirection)
Sorts the chart data based on the property name and direction specified.
Declaration
public void Sort(string propertyName, ListSortDirection direction)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | Specifies property name for the sorting. |
ListSortDirection | direction | Specifies sorting direction for the chart data . |
Examples
This example shows how to sort a chart by the "Y" property in descending order.
<SfButton OnClick="SortChart" IsToggle="true" IsPrimary="true">SortChart</SfButton>
<SfChart @ref=”Chart” DataSource=”Data”>
<ChartSorting PropertyName ="X" Direction ="ListSortDirection.Ascending "/>
…
</SfChart>
@code{
public SfChart Chart;
public void SortChart()
{
Chart.Sort(‘Y’, ListSortDirection.Descending);
}
}