Select to view content in your preferred language

Value conversion in a dashboard pie chart?

198
1
10-07-2024 10:17 AM
hannahisreeding
Emerging Contributor

Does anyone know to set up a value conversion in a pie chart? I know we can do this easily for indicators and gauges, but that I might need to use a data expression for the pie chart. I have no idea how to set that up.

I have a field called Calc_Length and it is in feet, but I need to convert it to miles for my pie chart.

I know that I need to multiple my Calc_Length by 0.00018939 to get it in miles. 

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

You'd need to use a data expression for this, which is frankly a bit of overkill just to show the values multiplied by that decimal. But I don't see another way of doing it, so here's what it'd look like:

// get your layer
var fs = FeatureSetByPortalItem(
  Portal('https://arcgis.com'), //or your portal URL if you're not using AGOL
  'itemid of the feature service',
  0, // the layer index
  ['Calc_Length', 'objectid'],
  false
)

return Distinct(
  fs,
  [
    {name: 'objectid', expression: 'objectid'},
    {name: 'miles', expression: 'Calc_Length * 0.00018939'}
  ]
)

 

- Josh Carlson
Kendall County GIS
0 Kudos