Select to view content in your preferred language

How to use Arcade Expression to dynamically change the value of labels in a dashboard chart

1355
4
Jump to solution
01-10-2022 05:00 AM
Fab_the_lab
Occasional Contributor

Hi!

I have a chart in the dashboard linked to daily Ozone data.

The data is updated via REST API on a feature layer hosted in AGOL.

The chart on the dashboard is linked to that feature layer.

Well that's great.

The problem is that when I made the chart I inserted some labels that remain fixed and I don't know how to change them so that they display the real day to which they refer!

I was forced to use generic labels, like "one day ago, two days ago, etc.). But it's not exactly the best.

Fab_the_lab_1-1641819603558.png

 

Can someone help me?
Could I use Arcade or Phyton to solve the problem?
How can I use json to dynamically change the dashboard? (a bit like Arcgis Online Assistant does)

Any help is appreciated!

1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Oh! I didn't realize that your datapoints were in different fields like that. That would have to be modified at the chart level then, not in the data itself.

I would imagine that this is possible in Python. Check out the Dashboard submodule of the API. If you can identify the chart, I think the data property is what you want.

- Josh Carlson
Kendall County GIS

View solution in original post

4 Replies
jcarlson
MVP Esteemed Contributor

Does the data retain the date information at all?

- Josh Carlson
Kendall County GIS
Fab_the_lab
Occasional Contributor

hi Josh

yes,  
actually I am able to dynamically change the name of the fields in the hosted feature layer. So the answer is yes, the date is stored in the feature layer.

(see the screenshot)

labelfeaturelayer.png

 

 

 

jcarlson
MVP Esteemed Contributor

Oh! I didn't realize that your datapoints were in different fields like that. That would have to be modified at the chart level then, not in the data itself.

I would imagine that this is possible in Python. Check out the Dashboard submodule of the API. If you can identify the chart, I think the data property is what you want.

- Josh Carlson
Kendall County GIS
Fab_the_lab
Occasional Contributor

Okay, I'll take a look. Thanks so much!!  🙂