Customize pie chart color in Arcade media popup?

376
3
07-21-2023 11:21 AM
Jay_Gregory
Occasional Contributor III

I'm working on a map where when a user clicks on a State, they get a chart of congressional district breakdown for that state.  So far it's been easy, but I can't customize the colors of my pie chart colors.  I would like to have red and blue slices for the district breakdown, but can't figure out how.  Any ideas?

Furthermore, anyone know how to have tooltips on the chart without hovering over a slice?

 

var clicked = $feature.STATE_ABBR;
var districts = FeatureSetByName($map, "USA 118th Congressional Districts (All Territories)")
var f = Filter(districts, "STATE_ABBR = @clicked")
var party = GroupBy(f, "PARTY", {name: "count", expression: 'PARTY', statistic: "COUNT"});
var chartValues = {};
var chartTitles = [];
for (var blah in party){
  chartValues[blah.PARTY]=blah.count
  Push(chartTitles, blah.PARTY)
}
return {
  type: "media",
  title: "Congressional district breakdown by state",
  altText: "Congressional district breakdown by state",
  attributes: chartValues,
   style:{
      colors:[
        "#f6eff7",
        "#dbc9e1",
      ]
    },
  mediaInfos:[{
    type: 'piechart',
    value:{
      fields:chartTitles,
      tooltipField: "PARTY"
    }
  }]
}

 

 

3 Replies
RussRoberts
Esri Notable Contributor
0 Kudos
Marshal
New Contributor III

Any idea when this will get added to ArcGIS Enterprise?  Thanks for any insight!

0 Kudos
RussRoberts
Esri Notable Contributor

This will roll out with the 11.3 Enterprise release which should be coming out in Q2 2024.