Skip to main content
All docs
V24.2

DxRangeSelectorChart Class

Defines a nested chart component in DxRangeSelector.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public class DxRangeSelectorChart :
    DxComplexSettingsComponent<DxRangeSelectorChart, RangeSelectorChartModel>,
    IComponentContainer<IXYChartSeriesModel>,
    IModelProvider<RangeSelectorChartValueAxisModel>

Remarks

The DevExpress Blazor Range Selector component allows you to visualize data as a chart. Follow the steps below to display a chart:

  1. Use the DxRangeSelector.Data property to bind the component to a data source.
  2. Declare a DxRangeSelectorChart object.
  3. Add an appropriate series object to the chart markup and populate the chart with arguments and values.

Range Selector - Display a Chart

Run Demo

Series

The DxRangeSelectorChart component supports the same series types as the Blazor DxChart component. To create a series, choose a series type and specify its ArgumentField and ValueField properties.

The following code snippet creates a chart with bars where each bar corresponds to a country’s population (see the image above):

<DxRangeSelector Width="700px"
                 Height="300px"
                 Data="@Data">
    <DxTitleSettings Text="Population by Country, 2023" />
    <DxRangeSelectorChart>
        <DxChartBarSeries ArgumentField="@((PopulationPoint s) => s.Country)"
                          ValueField="@((PopulationPoint s) => s.Value)" />
    </DxRangeSelectorChart>
</DxRangeSelector>

@code {
    List<PopulationPoint> Data;
    protected override void OnInitialized() {
        Data = GetData();
    }
}

Refer to the following article for more information about available series types: Series Types in Blazor Charts.

Component-Level Settings

The DxRangeSelectorChart class includes properties that allow you to configure series-specific settings. The list below contains available options:

BarGroupPadding | BarGroupWidth
Specify the bar series appearance.
MinBubbleSize | MaxBubbleSize
Specify diameters of the smallest and biggest points (bubbles) in bubble series.
NegativesAsZeroes
Specifies whether DxRangeSelectorChart treats negative values as zeroes in stacked series.

You can also use TopIndent and BottomIndent properties to position a series on a chart pane. These properties define indents between the topmost/lowest series points and the background’s top/bottom edges.

Range Selector - Chart Indents

<DxRangeSelector Width="500px"
                 Height="200px"
                 Data="@Data">
    <DxTitleSettings Text="Population by Country, 2023" />
    <DxRangeSelectorChart TopIndent="0.5" BottomIndent="0.5">
        <DxChartBarSeries ArgumentField="@((PopulationPoint s) => s.Country)"
                          ValueField="@((PopulationPoint s) => s.Value)" />
    </DxRangeSelectorChart>
    <DxRangeSelectorBackground Color="#ebf9fa" />
</DxRangeSelector>

@code {
    List<PopulationPoint> Data;
    protected override void OnInitialized() {
        Data = GetData();
    }
}

Axes

The Range Selector allows you to configure axes for the DxRangeSelectorChart component. You can use the following objects:

DxRangeSelectorChartValueAxis
Defines a value axis. This axis does not support visual elements (for example, ticks or labels) and does not include any nested components.
DxRangeSelectorScale
Defines a scale similar to a DxChartArgumentAxis object in the DxChart component. The scale supports multiple visual elements configurable with nested objects.

The DxRangeSelectorChart component automatically creates its axes based on the data type of the first series in the markup. You can also use DxRangeSelectorChartValueAxis.ValueType and DxRangeSelectorScale.ValueType properties to explicitly specify the axis data type.

The following code snippet casts values specified as strings to the Numeric type and customizes scale labels:

Range Selector - Axis Configuration

<DxRangeSelector Width="1200px"
                 Height="300px"
                 Data="@Data">
    <DxTitleSettings Text="Population by Country, 2023" />
    <DxRangeSelectorChart>
        <DxRangeSelectorChartValueAxis ValueType="ChartAxisDataType.Numeric" />
        <DxChartBarSeries ArgumentField="@((PopulationPoint s) => s.Country)"
                          ValueField="@((PopulationPoint s) => s.Value)" />
    </DxRangeSelectorChart>
    <DxRangeSelectorScale>
        <DxRangeSelectorScaleLabel TopIndent="0">
            <DxFontSettings Weight="600" Color="#5f368d" Size="14" />
        </DxRangeSelectorScaleLabel>
    </DxRangeSelectorScale>
</DxRangeSelector>

@code {
    List<PopulationPoint> Data;
    protected override void OnInitialized() {
        Data = GetData();
    }
}

Refer to DxRangeSelectorChartValueAxis and DxRangeSelectorScale class descriptions for more information about axes in the Range Selector.

Customization

This section describes settings that allow you to customize the appearance of the DxRangeSelectorChart component and its container.

Palette

The <DxRangeSelector> component allows you to create a custom palette for chart series. To apply a palette, assign it to the Palette property.

When the number of series exceeds the number of palette colors, you can use the PaletteExtensionMode property to specify how to extend the palette.

The following code snippet applies a custom palette to DxRangeSelectorChart series and changes the palette’s extension mode:

Range Selector - Chart Palette

@using System.Linq.Expressions
<div style="display:flex;">
    <label style="padding-right:10px;padding-top:2px;">Palette Extension Mode:</label>
    <DxComboBox Data="Enum.GetValues<ChartPaletteExtensionMode>()"
                @bind-Value="@ExtensionMode" />
</div>

<DxRangeSelector Width="100%"
                 Data="@Data"
                 ValueChangeMode="RangeSelectorValueChangeMode.OnHandleMove">
    <DxRangeSelectorChart Palette="@Palette"
                          PaletteExtensionMode="@ExtensionMode">
        @CreateChartAreaSeries(s => s.Y1)
        @CreateChartAreaSeries(s => s.Y2)
        @CreateChartAreaSeries(s => s.Y3)
    </DxRangeSelectorChart>
    <DxRangeSelectorScale TickInterval="50" />
</DxRangeSelector>

@code {
    ChartPaletteExtensionMode ExtensionMode { get; set; } = ChartPaletteExtensionMode.Alternate;
    string[] Palette => new string[] { "#5f368d", "#28a745" };

    IEnumerable<RangePoint> Data = Enumerable.Empty<RangePoint>();
    protected override void OnInitialized() {
        Data = GenerateData();
    }

    private RenderFragment CreateChartAreaSeries(Expression<Func<RangePoint, double>> valueField) =>
        @<DxChartAreaSeries ArgumentField="@(s => s.Arg)"
                            ValueField="@(valueField)">
        </DxChartAreaSeries>
    ;
}

Background and Shutters

The Range Selector allows you to customize the chart’s background area. Use DxRangeSelectorBackground class properties to display an image or set the background color. You can also configure color settings for shutters that cover unselected ranges. To change the shutter color, use the DxRangeSelectorShutter.Color property.

The following code snippet sets the background color to #e3faf9 and the shutter color to #1bc2bb:

Range Selector - Chart Customization

<DxRangeSelector Width="1200px"
                 Height="300px"
                 Data="@Data">
    <DxTitleSettings Text="Population by Country, 2023" />
    <DxRangeSelectorChart>
        <DxRangeSelectorChartValueAxis ValueType="ChartAxisDataType.Numeric" />
        <DxChartBarSeries ArgumentField="@((PopulationPoint s) => s.Country)"
                          ValueField="@((PopulationPoint s) => s.Value)" />
    </DxRangeSelectorChart>
    <DxRangeSelectorBackground Color="#e3faf9" />
    <DxRangeSelectorShutter Color="#1bc2bb" />
</DxRangeSelector>

@code {
    List<PopulationPoint> Data;
    protected override void OnInitialized() {
        Data = GetData();
    }
}

Refer to DxRangeSelectorBackground and DxRangeSelectorShutter class descriptions for more information and examples.

Inheritance

Object
ComponentBase
DxSettingsComponent<DevExpress.Blazor.Internal.RangeSelectorChartModel>
DxComplexSettingsComponent<DxRangeSelectorChart, DevExpress.Blazor.Internal.RangeSelectorChartModel>
DxRangeSelectorChart
See Also