Dashboards: chart color change in JSON (AGO Assistant) to sync throughout Dashboard

665
1
06-15-2021 08:39 PM
GeorgiaCummins
New Contributor III

Hi guys, 

I have been working on a Dashboard for a little while. I have quite a few charts that all pull from different layers in my map. These layers have the same spatial files with the same feature names, BUT just with different data depending on the subject (total funding, population etc)

I was hoping to find a way to automatically change the chart colours to match a feature. For example through an if statement. If feature equals this then color it red, etc. 

I think this might have to be done in the JSON behind the dashboard using AGO Assistant https://ago-assistant.esri.com/ 

Is anybody able to guide me in the right direction as to where in the JSON this might work and how to format it?

Thank you

0 Kudos
1 Reply
AdejumoBidemi
New Contributor III

Hi,

 You can use arcade to do the color change using a function

 

var color_map = {
  'funding': '#ff0000', // red
  'population': '#00ff00', // green
  'credit': '#0000ff' // blue
};

function findColor(field) {
  return color_map[field];
}

 

 

 

 

0 Kudos