Back to Devexpress

DxRangeSelectorChart.Sorted Property

blazor-devexpress-dot-blazor-dot-dxrangeselectorchart-6c6d1be2.md

latest3.8 KB
Original Source

DxRangeSelectorChart.Sorted Property

Specifies whether series point connectors follow the visual argument order or original data source order. Applies only to line series.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(false)]
[Parameter]
public bool Sorted { get; set; }

Property Value

TypeDefaultDescription
Booleanfalse

true to connect series points in argument order; false to draw connectors in their original sequence from the data source.

|

Remarks

DxRangeSelectorChart automatically sorts the argument axis numerically or chronologically.

Line series connectors follow the original data source order. If you plot unsorted data, the connectors may go backward or intersect. For example, if your dataset lists May 1st before April 18th, the corresponding connector line is plotted from right to left.

This behavior can be useful for specific scenarios, such as plotting raw experimental data. If it does not match your intentions, set the Sorted property to true. This makes the chart render connectors based on the visual argument order (left-to-right or right-to-left).

Note

Setting the Sorted property to true forces the chart control to re-sort incoming data, even if it is already sorted. If your data is already sorted, leave it out or set it to false to improve performance.

razor
<DxRangeSelector Data="DataSource">
    <DxTitleSettings Text="Sorted=&quot;true&quot;" />
    <DxRangeSelectorChart Sorted="true">
        <DxChartLineSeries ArgumentField="@((SaleInfo s)=>s.Date)"
                           ValueField="@((SaleInfo s)=>s.Amount)" />
    </DxRangeSelectorChart>
</DxRangeSelector>

@code {
    List<SaleInfo> DataSource { get; set; } = new List<SaleInfo>();

    protected override void OnInitialized() {
        DataSource = Data.Sales.GetMonthlySales();
    }
}
csharp
public class SaleInfo(DateTime date, int amount)
{
    public DateTime Date { get; set; } = date;
    public int Amount { get; set; } = amount;
}
csharp
public static class Sales
{
    private static readonly List<SaleInfo> MonthlySales = [
        new(new DateTime(2025, 9, 1), 600),
        new(new DateTime(2025, 1, 1), 400),
        new(new DateTime(2025, 2, 1), 1200),
        new(new DateTime(2025, 3, 1), 2500),
        new(new DateTime(2025, 10, 1), 800),
        new(new DateTime(2025, 4, 1), 1300),
        new(new DateTime(2025, 5, 1), 1700),
        new(new DateTime(2025, 11, 1), 1200),
        new(new DateTime(2025, 12, 1), 2700),
        new(new DateTime(2025, 6, 1), 800),
        new(new DateTime(2025, 7, 1), 1800),
        new(new DateTime(2025, 8, 1), 2500),
        ];

    public static List<SaleInfo> GetMonthlySales() => MonthlySales;
}

Note the following limitations for the Sorted property:

  • While this property can be used with all chart types, it only affects the appearance of line series.
  • Automatic sorting of series points works only for numeric or date arguments. Line series with string arguments remain unchanged, regardless of this property’s value.

See Also

DxRangeSelectorChart Class

DxRangeSelectorChart Members

DevExpress.Blazor Namespace