SilverSeva
Posts: 3
Joined: Fri Feb 19, 2021 11:54 am

Pie Chart Grouping Data

Hello,

I dont know if i doing something wrong or just dont get it but, i'm trying to create a simple PIE chart and passing to it not parsed data.

I'm trying to group the data by its name and then just sum the total of each group (simething, i think, very simple), but the chart is showing each point.

I tried adding dataGrouping: { forced: true } without any success and it's driving me crazy.

How is the grouping data work? Or i need to parse the data myself to group it?

Here is the example: https://jsfiddle.net/SilverSeva/o0j2exas/13/

Any help is apreciated.
Thanks in advance.
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Pie Chart Grouping Data

Hi,
Welcome to our forum and thanks for contacting us with your question!

What do you want to achieve by grouping data, could you explain more preciously?
Do you really need to show series type pie in a stock chart?

This topic it's colerated with your case, it could be usefull.
viewtopic.php?t=43651

I'm waiting for news from you.
Best regards.
Sebastian Hajdus
Highcharts Developer
SilverSeva
Posts: 3
Joined: Fri Feb 19, 2021 11:54 am

Re: Pie Chart Grouping Data

Hi Sebastian and thanks for the answer.

I'm recieving the data from the API, where i need to show the count by each type of data.
Imagine i have Apples, Oranges y Pineapples. I pretend to know how many there is of each of them.

the data comes in the following form:

data: [{
name: "Apple"
}, {
name: "Apple"
}, {
name: "Apple"
}, {
name: "Orange"
}, {
name: "Orange"
}, {
name: "Pineapple"
}, {
name: "Pineapple"
}]

Because im recieving data not grouped, and hence the question if I need to format the data (backend or fronend) or highcharts is it capable of doing it for me, in visual form. Merging same types of data by some property.

I want to show in PIE chart how many of each there are.

It is possible? Can Highcharts group the data automatically in some way?

Thanks,
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Pie Chart Grouping Data

Hi,
Thanks for the message.

As for data grouping, it will not work for the pie series in the stock chart.
https://api.highcharts.com/highstock/pl ... taGrouping

There you can read about data grouping and see examples of how data grouping works.
https://www.highcharts.com/docs/stock/d ... a-grouping
https://www.highcharts.com/demo/stock/data-grouping

The highcharts have a way to parse data with some options like data.parsed.
https://api.highcharts.com/highcharts/data.parsed
https://www.highcharts.com/docs/working ... data-intro

Best regards.
Sebastian Hajdus
Highcharts Developer
SilverSeva
Posts: 3
Joined: Fri Feb 19, 2021 11:54 am

Re: Pie Chart Grouping Data

Thank you very much for the info

Best regards
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Pie Chart Grouping Data

You're welcome!
In case of any further questions, feel free to contact us again.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Usage”