Accessing Pivot Chart series data

Hello

I am trying to access the data that makes up the data series of a pivot chart.  I can do this by using the ChartSeriesCreated event and then accessing the series data within the args (see below).

This is OK, but it means I am processing the series data every time there is a change to the chart.  I would much rather have a button that the user can click that then accesses the series data of the chart that is currently displayed.

I do not seem to be able to figure out how to do this?  Is this possible?

Thank you




3 Replies 1 reply marked as answer

SS Saranya Sivan Syncfusion Team March 10, 2021 05:28 PM UTC

Hi Richard, 
  
Based on your requirement we have prepared a sample to access the chart series on a button click . Please check the below sample for your reference. 
  
  
Code Snippet: 
  
   public Syncfusion.Blazor.Charts.ChartSeries chartSeries { get; set; } 
    private void ChartSeriesCreated(ChartSeriesCreatedEventArgs args) 
    { 
        foreach (var series in args.Series) 
        { 
            chartSeries = series; 
        } 
    } 
  
    public void DisplaySeries(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) 
    { 
        Console.WriteLine(chartSeries); //Here you can access the chart series 
    } 
  
  
We hope the above sample meets your requirements. Please let us know if you have concern. 
  
Regards, 
Saranya Sivan. 



DI Ditchford March 11, 2021 12:43 AM UTC

Hello

Thanks for your response, however, the method you suggest is how am I am currently doing it.  I am trying to avoid storing the series data every time the chart changes.  Is there no way to access the series data of the chart directly, i.e. something like:

MyPivotChart.Datasource.ChartSeries....

The above would mean specifying an @ref="MyPivotChart" somewhere in the razor, but I am not sure if that is even possible.

Its OK if the answer is no, I am just trying to avoid the method described, unless that is the only option.

Thanks


SS Saranya Sivan Syncfusion Team March 11, 2021 01:41 PM UTC

Hi Richard, 
 
We would like to inform that the event `ChartSeriesCreated` is the only option to access and modify the chart series. And it couldn’t be accessed by any instance.   
  
Regards, 
Saranya. 
 
 


Marked as answer
Loader.
Up arrow icon