I'm creating a pie chart on an ArcGIS Hub page. There are six categories that I want to display in my pie chart, but when I build the chart, three categories are grouped together in an Other category.
Here is the Excel spreadsheet that I've uploaded to AGOL to create the feature layer which feeds the pie chart:
However, this is how the chart renders when I use Material as my Category and Length as my Value for the pie chart:
I've also tried using the JSON option to specify my chart definition as follows:
{
"type": "pie",
"datasets": [
{
"name": "dataset1",
"query": {
"orderByFields": "Length__miles__sum DESC",
"groupByFieldsForStatistics": "Material",
"outStatistics": [
{
"statisticType": "sum",
"onStatisticField": "Length__miles_",
"outStatisticFieldName": "Length__miles__sum"
}
]
},
"url": "URL WOULD BE HERE, BUT I REMOVED"
}
],
"series": [
{
"source": "dataset1",
"category": {
"field": "Material",
"label": "Material"
},
"value": {
"field": "Length__miles__sum",
"label": "Length (miles)"
}
}
],
"style": {
"padding": {
"top": 30,
"bottom": 10
},
"pie": {
"expand": 0
},
"colors": [
"#484C70",
"#93B7BE",
"#E0CA3C",
"#A799B7",
"#048A81",
"#CD8987"
]
}
}
However, I couldn't find any documentation that specified how I might add additional slices to my pie chart. If anyone has experience doing this, I'd greatly appreciate some help. Thanks
Solved! Go to Solution.
Hello,
I asked a colleague for insight on your issue and he said you can add:
"overrides": {
"groupPercent": 2 <--- whatever percentage it is
}
"About groupPercent, if there is more than one slice whose percentage of the pie is less than this number, those slices will be grouped together into one slice. This is the "other" slice. It will always be the last slice in a pie."
At line 49, put a comma after the closing bracket, hit return, then add the overrides object. He says you'll have to figure out the actual percentage you need as it's currently defaulting to 5%.
Hello,
I asked a colleague for insight on your issue and he said you can add:
"overrides": {
"groupPercent": 2 <--- whatever percentage it is
}
"About groupPercent, if there is more than one slice whose percentage of the pie is less than this number, those slices will be grouped together into one slice. This is the "other" slice. It will always be the last slice in a pie."
At line 49, put a comma after the closing bracket, hit return, then add the overrides object. He says you'll have to figure out the actual percentage you need as it's currently defaulting to 5%.
Thank you Klara! Your solution worked perfectly!
Is there any documentation that you or your colleague can point me to that has some of this information because I wasn't able to find it when I was initially tackling this. There are a few additional things I'm hoping to do to customize my charts... like removing the border that currently exists around the Chart frame (maybe that's not possible, but I'd like to try).
Admittedly, I'm a little over my head when it comes to chart JSON. I'm not sure we have a lot of formal documentation, but there is a sandbox here: https://esri.github.io/cedar/, which links you to the cedar library. I don't know if that really covers the type of documentation you need. The underlying charting technology is https://docs.amcharts.com/3/javascriptcharts, but there will be limitations on what can and cannot be overwritten.
No problem. Thanks for the additional resources and for the solution!