number issue in JSON chart tooltip/balloontext

102
0
11-27-2020 07:19 PM
NiuZheng
New Contributor

Can any one help to answer two questions? 1) how to configure the number format for value in tooltip? 2) is there a way to convert value on the fly without change its self in data?

I am using JSON chart in Hub.I tested code using https://esri.github.io/cedar/

the value of outStatisticFieldName "MAX_MAX_De_sum" from the query, I want to make sure

  1. its display format to be "#,###.00" in tooltip.
  2. do convert and show new calculated value of "MAX_MAX_De_sum/60".
    I tried the alternative way as suggested by someone here by applying "Cast(MAX_MAX_De as decimal(10,2)) to the "onStatisticField". it works if when using "orderByFields": "FIRST_Str", but always return unknown error (also shows "MAX_MAX_De_sum " is not valid parameter) when using "orderByFields": "MAX_MAX_De_sum DESC"

really appreciated for your help

{
"type": "bar-horizontal",
"numberFormatter":[{
"numberFormat":{"decimalSeparator":".", "thousandsSeparator":",", "precision":-1}

}],
"datasets": [
{
"name": "dataset1",
"query": {
"where": "FIRST_Stre <>' ' and FIRST_Stre <> 'Hwy 7'",
"orderByFields": "MAX_MAX_De_sum DESC",
"groupByFieldsForStatistics": "FIRST_Stre",
"having": "SUM(MAX_MAX_De)>24",
"outStatistics": [
{
"statisticType": "sum",
"onStatisticField": "MAX_MAX_De",
"outStatisticFieldName": "MAX_MAX_De_sum"
}
]
},
"url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/UUID_Delay_Summary_Hourly_pub_view..."
}
],
"series": [
{
"source": "dataset1",
"category": {
"field": "FIRST_Stre",
"label": "Highway"
},
"value": {
"field": "cast(MAX_MAX_De_sum as decimal(10,2))",
"label": "Delay (in sec)"
}
}
],
"style": {
"colors": [
"#026873"
]
},
"overrides": {
"graphs": [{
"valueField" : "MAX_MAX_De_sum",
"balloonText": "[[MAX_MAX_De_sum]]",
"numberFormatter":{"decimalSeparator":".", "thousandsSeparator":",", "precision":2,"numberFormat": "#,###.00"}

}],
"valueAxes": [{
"title": "Elevation (feets)",
"numberFormatter": {
"numberFormat": "#,###.00"
}
}],
"xAxes":[{
"numberFormatter": {
"numberFormat": "#,###.00"
}
}]
}
}

 

Reply
0 Kudos
0 Replies