Skip to main content
All docs
V24.2

DxChart<T>.SelectPoints(Int32, T[]) Method

Selects specific series points.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public void SelectPoints(
    int seriesIndex,
    params T[] points
)

Parameters

Name Type Description
seriesIndex Int32

The series position in chart markup.

points T[]

Data points.

Remarks

Set the DxChart.PointSelectionMode property to Single or Multiple to enable point selection in <DxChart>.

Call the following methods to manage point selection in code:

SelectPoints
Select specific series points in code.
DeselectPoints
Deselect specific series points in code.
ClearSelectionAsync()
Resets selection in the entire Chart component.

SelectPoints and DeselectPoints method overloads accept a single or multiple data points as parameters. The Chart component applies point selection based on the corresponding SelectionMode property value:

When you call SelectPoints or DeselectPoints method overloads, <DxChart> raises the SelectionChanged event. You can obtain information about the selected point in the event handler.

Example

The following code snippet selects and deselects points of the specified series on button clicks:

DxChart - Point Selection in Code

<DxChart Data="@DataSource"
         @ref="chart"
         Width="900px"
         PointSelectionMode="ChartSelectionMode.Multiple">
    <DxChartBarSeries ArgumentField="@((StatisticPoint v) => v.Country)"
                      ValueField="@((StatisticPoint v) => v.Population24)"
                      Name="2024" />
    <DxChartLineSeries ArgumentField="@((StatisticPoint v) => v.Country)"
                       ValueField="@((StatisticPoint v) => v.Population23)"
                       Name="2023" />
    <DxChartLegend Orientation="Orientation.Vertical"
                   HorizontalAlignment="HorizontalAlignment.Right"
                   Position="RelativePosition.Outside" />
    <DxChartTitle Text="Population by Country" />
</DxChart>

<DxButton Text="Select points"
          Click="SelectPoints"
          RenderStyleMode="ButtonRenderStyleMode.Outline" />
<DxButton Text="Deselect points"
          Click="DeselectPoints"
          RenderStyleMode="ButtonRenderStyleMode.Outline" />

@code {
    DxChart<StatisticPoint> chart;
    IEnumerable<StatisticPoint> DataSource = Enumerable.Empty<StatisticPoint>();
    protected override void OnInitialized() {
        DataSource = GenerateData();
    }

    void SelectPoints() {
        // Pass the series index (order) as a parameter
        chart.SelectPoints(0, DataSource.First(), DataSource.Last());
        // Pass the series name as a parameter
        chart.SelectPoints("2024", DataSource.First(), DataSource.Last());
    }
    void DeselectPoints() {
        // Pass the series index (order) as a parameter
        chart.DeselectPoints(0, DataSource.First());
        // Pass the series name as a parameter
        chart.DeselectPoints("2024", DataSource.First());
    }
}
See Also