I am creating a hub for aquatic barrier data, and I would like my pie chart to be color coded from green to red. Is it possible to change the pie slice colors within the chart?
Thank you!
Solved! Go to Solution.
Hi Kathleen,
Yes it is possible.
{
"type": "pie",
"datasets": [
{
"url": "https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0",
"query": {
"orderByFields": "Number_of_SUM DESC",
"groupByFieldsForStatistics": "Type",
"outStatistics": [
{
"statisticType": "sum",
"onStatisticField": "Number_of",
"outStatisticFieldName": "Number_of_SUM"
}
]
}
}
],
"series": [
{
"category": {
"field": "Type",
"label": "Type"
},
"value": {
"field": "Number_of_SUM",
"label": "Number of Students"
}
}
],
/* Add in this style piece. You will want as many hex colours as items in your pie chart. It colours the slices in the same order as they're listed */
"style": {
"colors": [
"#f6eff7",
"#dbc9e1",
"#67a9cf",
"#02818a",
"#1c9099",
"#016c59"
]
}
}
*Edited to add some more clarity
Hi Kathleen,
Yes it is possible.
{
"type": "pie",
"datasets": [
{
"url": "https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0",
"query": {
"orderByFields": "Number_of_SUM DESC",
"groupByFieldsForStatistics": "Type",
"outStatistics": [
{
"statisticType": "sum",
"onStatisticField": "Number_of",
"outStatisticFieldName": "Number_of_SUM"
}
]
}
}
],
"series": [
{
"category": {
"field": "Type",
"label": "Type"
},
"value": {
"field": "Number_of_SUM",
"label": "Number of Students"
}
}
],
/* Add in this style piece. You will want as many hex colours as items in your pie chart. It colours the slices in the same order as they're listed */
"style": {
"colors": [
"#f6eff7",
"#dbc9e1",
"#67a9cf",
"#02818a",
"#1c9099",
"#016c59"
]
}
}
*Edited to add some more clarity