HOW TO
In ArcGIS Dashboards, displaying numerical summaries such as total time in an indicator element highlights important values to viewers. Time displayed in hours and minutes can provide clearer interpretations as compared to time recorded in hours with decimals. This format can be configured through the advanced formatting capabilities of the element and this article provides the workflow. In this example, the indicator element is initially configured to display total time in hours and later converted to hours and minutes.

.
var <duration> = $datapoint.<field_name> * 60
var <hours> = Floor(<duration> / 60)
var <minutes> = Floor(<duration> % 60)
var <output> = <hours> + ' hours, ' + <minutes> + ' minutes'
The code below assigns the final variable from Step 5(a) to the middleText property. In this example, the <output> variable is set to time_final.
middleText: time_final,
The middle text value is updated in the preview area of the indicator element.

The following code block shows the complete expression used in this workflow, with blank properties and comments removed.
var total_minutes = $datapoint.SUM_TOTAL_TIME * 60
var hrs = Floor(total_minutes / 60)
var mins = Floor(total_minutes % 60)
var time_final = hrs + ' hours, ' + mins + ' minutes'
return {
topText: 'Total time :',
topTextMaxSize: 'medium',
middleText: time_final,
middleTextMaxSize: 'large'
}

> Save to save the changes.Article ID: 000037605
Get help from ArcGIS experts
Start chatting now