Back to Devexpress

DxPolarChart<T>.SeriesClick Event

blazor-devexpress-dot-blazor-dot-dxpolarchart-1-12c5f986.md

latest4.2 KB
Original Source

DxPolarChart<T>.SeriesClick Event

Fires when a user clicks a series.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public EventCallback<PolarChartSeriesClickEventArgs> SeriesClick { get; set; }

Event Data

The SeriesClick event's data class is PolarChartSeriesClickEventArgs. The following properties provide information specific to this event:

PropertyDescription
PointReturns the clicked point.
SeriesReturns the clicked series.

Remarks

Handle the SeriesClick event to obtain information about the clicked series point. Event arguments store information about the clicked point and the series to which the point belongs.

The following code example displays the clicked point’s argument, value, and series name:

razor
<DxPolarChart Data=@DataSource 
              UseSpiderWeb="true"
              SeriesClick="OnClick">
    @foreach(var info in SeriesInfos) {
        <DxPolarChartLineSeries Name="@name" ArgumentField="@argumentField" ValueField="@valueField"/>
    }
</DxPolarChart>

@country produces @pointValue million tons of @fruit.

@code {
    string fruit;
    object pointValue, country;
    void OnClick(PolarChartSeriesClickEventArgs args) {
        if (args.Point != null) {
            fruit = args.Series.Name;
            pointValue = args.Point.Value;
            country = args.Point.Argument;
        }
    }

    public class SeriesInfo {
        public string Name { get; set; }
        public Expression<Func<SpiderPoint, object>> ValueField { get; set; }

        public SeriesInfo (string name, Expression<Func<SpiderPoint, object>> valueField) {
            Name = name;
            ValueField = valueField;
        }
    }

    IEnumerable<SeriesInfo> SeriesInfos = new List<SeriesInfo>() {
        new SeriesInfo("Apples", i => i.Apples),
        new SeriesInfo("Grapes", i => i.Grapes),
        new SeriesInfo("Lemons", i => i.Lemons),
        new SeriesInfo("Oranges", i => i.Oranges),
    };

    IEnumerable<SpiderPoint> DataSource = Enumerable.Empty<SpiderPoint>();

    protected override void OnInitialized () {
        DataSource = ChartSpiderDataProvider.GenerateData();
        SelectedSeries = SeriesTypes.FirstOrDefault();
    }
}
csharp
namespace BlazorDemo.Data {
    public class SpiderPoint {
        public string Arg { get; set; }
        public double Apples { get; set; }
        public double Grapes { get; set; }
        public double Lemons { get; set; }
        public double Oranges { get; set; }

        public SpiderPoint(string arg, double apples, double grapes, double lemons, double oranges) {
            Arg = arg;
            Apples = apples;
            Grapes = grapes;
            Lemons = lemons;
            Oranges = oranges;
        }
    }
}
csharp
using System.Collections.Generic;
using BlazorDemo.Data;

namespace BlazorDemo.DataProviders.Implementation {
    public class ChartSpiderDataProvider : IChartSpiderDataProvider {
        public List<SpiderPoint> GenerateData() {
            return new List<SpiderPoint>() {
                new SpiderPoint("USA", 4.21, 6.22, 0.8, 7.47),
                new SpiderPoint("China", 3.33, 8.65, 1.06, 5),
                new SpiderPoint("Turkey", 2.6, 4.25, 0.78, 1.71),
                new SpiderPoint("Italy", 2.2, 7.78, 0.52, 2.39),
                new SpiderPoint("India", 2.16, 2.26, 3.09, 6.26),
            };
        }
    }
}

See Also

DxPolarChart<T> Class

DxPolarChart<T> Members

DevExpress.Blazor Namespace