How to include data strings in JSON chart tooltips?

322
0
07-24-2023 10:59 AM
Labels (1)
AndrewBurchill
New Contributor

Hello! I am trying to create a simple JSON bar chart in the ESRI ArcGIS Online Hub pages. My data is very simple, each row is a unique date, a numeric value, and then a text comment (a string). Here's what it looks like:

DateValueComment
7/24/20231541"this is a made up comment!"
7/23/20231442"another made up text bit"


Displaying the graph seems easy, but I want the text-based comment to display in the tooltip. I have figured out how to use the "overrides" feature to change the tooltip text and even include info like the y-axis value, but I can't figure out how to access the text strings and display them dynamically.

{
  "type": "bar",
"overrides": {
  "graphs": [{
    "balloonText": "<strong>[[Comment]]</strong><br />[[Actual_sum]]"
  }]
}
  "datasets": [
    {
      "name": "dataset1",
      "query": {
        "orderByFields": "Value_sum DESC",
        "groupByFieldsForStatistics": "Date",
        "outStatistics": [
          {
            "statisticType": "sum",
            "onStatisticField": "Value",
            "outStatisticFieldName": "Value_sum"
          }
        ]
      },
      "url": "https://XXX/FeatureServer/0"
    }
  ],
  "series": [
    {
      "source": "dataset1",
      "category": {
        "field": "Date",
        "label": "Date"
      },
      "value": {
        "field": "Value_sum",
        "label": "Value"
      }
    }
  ],
  "style": {
    "colors": [
      "#0079c1"
    ]
  }
}

 
Does anyone know how to do this? It seems like the easiest example, but I'm stumped.

0 Replies