Class ChartSorting
Configures the sorting option for the chart.
Namespace: Syncfusion.Blazor.Charts
Assembly: Syncfusion.Blazor.dll
Syntax
public class ChartSorting : ChartSubComponent, ISubcomponentTracker
Examples
This example shows how to sort a chart by the "Y" property in asscending order.
<SfChart @ref=”Chart” DataSource=”Data”>
<ChartSorting PropertyName ="Y" Direction ="SortDirection.Descending"/>
…
</SfChart>
Constructors
ChartSorting()
Declaration
public ChartSorting()
Properties
Direction
Get and set the sorting direction for the chart data. The available direction are,
- Ascending Sort from smallest to largest. For example, from A to Z.
- Descending Sort from largest to smallest. For example, from Z to A.
Declaration
public ListSortDirection Direction { get; set; }
Property Value
Type | Description |
---|---|
ListSortDirection | An ListSortDirection that specifies the sort order for the chart data. The possible values are:
The default value is Ascending. |
Remarks
This property is essential for defining the sorting behavior of the chart data.
Examples
// This example demonstrates how to sort the chart data in descending order based on the X axis values.
<SfChart>
<ChartSorting PropertyName="X" Direction="ListSortDirection.Descending"></ChartSorting>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartSeriesCollection>
<ChartSeries DataSource="@SalesReports" XName="X" YName="YValue" Type="ChartSeriesType.Column"></ChartSeries>
</ChartSeriesCollection>
</SfChart>
PropertyName
Gets or sets the property name being used as the sorting criterion.
Declaration
public string PropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string specifying the property name for sorting, such as x, y, high, low, open, close, or size fields of the chart data source. The default value is |
Remarks
This property determines the field by which the chart data should be sorted.
Examples
// This example demonstrates how to sort the chart data in ascending order based on the X axis values.
<SfChart>
<ChartSorting PropertyName="X" Direction="ListSortDirection.Descending"></ChartSorting>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartSeriesCollection>
<ChartSeries DataSource="@SalesReports" XName="X" YName="YValue" Type="ChartSeriesType.Column"></ChartSeries>
</ChartSeriesCollection>
</SfChart>