Use a table column as a delimimter for chart series

Hello
Is it possible to use a table column as a delimimter for chart series.
I have a table like this:
I want to add a chart series for each category.
If I have understood correctly, the table should look like this in order to be displayed correctly by syncfusion:
Can I display the chart without reformatting the table? In this case I would have to teach syncfusion that the category column is the separator.
Regards,
Matthias

3 Replies 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team May 4, 2021 04:01 PM UTC

Hi Matthias, 

Greetings from Syncfusion. 

We suggest you to split the data into separate array based on category in chart load event and assign its values to each series data source. We have prepared sample based on your requirement.  

Code Snippet : 

<ChartComponent load={this.load.bind(this)}> 
</ChartComponent> 
load(args){ 
      let data1 = [], data2 =[]; 
      for(let i = 0; i<data.length; i++){ 
        if(data[i].Category == "Temperature") 
            data1.push(data[i]); 
        else 
            data2.push(data[i]); 
      } 
      args.chart.series[0].dataSource = data1; 
      args.chart.series[1].dataSource = data2; 
    }; 

Screenshot :  

 


Kindly revert us if you have any concerns. 

Regards, 
Durga G 


Marked as answer

MA Matthias May 5, 2021 07:44 AM UTC

Hi,

Thank you very much for the answer.

I had now also achieved the result with the DataManager query.
However, the proposed solution will probably be the better one.


DG Durga Gopalakrishnan Syncfusion Team May 6, 2021 06:34 AM UTC

Hi Mat, 

Most welcome. Please get back to us if you need any further assistance. We are always happy in assisting you. 

Regards, 
Durga G

Loader.
Up arrow icon