<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Creating an Arcade pop-up bar chart in Map Viewer in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/creating-an-arcade-pop-up-bar-chart-in-map-viewer/m-p/1290684#M52303</link>
    <description>&lt;P&gt;Hi, I'm wondering if any Arcade experts can help me please? Using the below expression, I am able to list out the average rainfall in mm prior to a defect report date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var weather = FeatureSetByName($map, "Weather Stations", ["*"], false)
 
var station = $feature.Closest_WeatherStation
var defectdate = $feature.Reported_Date___Time
var startDate = DateAdd(defectdate, -30, "days");
var endDate = DateAdd(defectdate, -1, "days");
var query = "Station = @station AND Date_Field &amp;gt;= @startDate AND Date_Field &amp;lt;= @endDate "
var filtered_weather = Filter(weather, query)
 
var return_lines = [

Count(filtered_weather) + " days forecast",

]

for(var d in filtered_weather) {

Push(return_lines, "Total Rainfall " + d.Daily_Total_Rainfall__0900_0900 + " mm")
}
return Concatenate(return_lines, Textformatting.NewLine)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, rather than a list, I would like to display my results in a bar chart, displaying the date on the x axis and the total rainfall in mm on the y axis. Is anyone able to help with this please?&lt;/P&gt;&lt;P&gt;I have tried this following the page &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/part-2-introducing-arcade-pop-up-content-elements/" target="_blank"&gt;Part 2: Introducing Arcade Pop-up Content Elements (esri.com)&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var chartValues = {}
var chartNames = []
for (var f in return_lines) {
        chartValues[f.Date_Field] = f.Daily_Total_Rainfall__0900_0900
        Push(chartNames, f.Date_Field)
    }

return {
    type: 'media',
    title : 'Rainfall by Date',
    description : 'Chart showing total rainfall 30 days prior to defect report date',
    attributes : chartValues,  // replace this dictionary with your own key-value pairs,
    mediaInfos: [{
        type : 'columnchart', //linechart | barchart | piechart | columnchart
        //title : '',
        //caption : '',
        altText : 'bar chart showing crime counts by category', //altText will be read by screen readers
        value : {
          fields: chartNames,  // choose what attributes to use in the chart
          //normalizeField : '',  // the name of the attribute to normalize by or value 
        }	  
      }]
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i'm only getting this output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat206_0-1684493007185.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71142iDD7DBD6B49AAE7AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat206_0-1684493007185.png" alt="cat206_0-1684493007185.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat206_1-1684493038161.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71143i9A7689F919D3E3C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat206_1-1684493038161.png" alt="cat206_1-1684493038161.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 10:44:04 GMT</pubDate>
    <dc:creator>cat206</dc:creator>
    <dc:date>2023-05-19T10:44:04Z</dc:date>
    <item>
      <title>Creating an Arcade pop-up bar chart in Map Viewer</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/creating-an-arcade-pop-up-bar-chart-in-map-viewer/m-p/1290684#M52303</link>
      <description>&lt;P&gt;Hi, I'm wondering if any Arcade experts can help me please? Using the below expression, I am able to list out the average rainfall in mm prior to a defect report date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var weather = FeatureSetByName($map, "Weather Stations", ["*"], false)
 
var station = $feature.Closest_WeatherStation
var defectdate = $feature.Reported_Date___Time
var startDate = DateAdd(defectdate, -30, "days");
var endDate = DateAdd(defectdate, -1, "days");
var query = "Station = @station AND Date_Field &amp;gt;= @startDate AND Date_Field &amp;lt;= @endDate "
var filtered_weather = Filter(weather, query)
 
var return_lines = [

Count(filtered_weather) + " days forecast",

]

for(var d in filtered_weather) {

Push(return_lines, "Total Rainfall " + d.Daily_Total_Rainfall__0900_0900 + " mm")
}
return Concatenate(return_lines, Textformatting.NewLine)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, rather than a list, I would like to display my results in a bar chart, displaying the date on the x axis and the total rainfall in mm on the y axis. Is anyone able to help with this please?&lt;/P&gt;&lt;P&gt;I have tried this following the page &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/part-2-introducing-arcade-pop-up-content-elements/" target="_blank"&gt;Part 2: Introducing Arcade Pop-up Content Elements (esri.com)&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var chartValues = {}
var chartNames = []
for (var f in return_lines) {
        chartValues[f.Date_Field] = f.Daily_Total_Rainfall__0900_0900
        Push(chartNames, f.Date_Field)
    }

return {
    type: 'media',
    title : 'Rainfall by Date',
    description : 'Chart showing total rainfall 30 days prior to defect report date',
    attributes : chartValues,  // replace this dictionary with your own key-value pairs,
    mediaInfos: [{
        type : 'columnchart', //linechart | barchart | piechart | columnchart
        //title : '',
        //caption : '',
        altText : 'bar chart showing crime counts by category', //altText will be read by screen readers
        value : {
          fields: chartNames,  // choose what attributes to use in the chart
          //normalizeField : '',  // the name of the attribute to normalize by or value 
        }	  
      }]
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i'm only getting this output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat206_0-1684493007185.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71142iDD7DBD6B49AAE7AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat206_0-1684493007185.png" alt="cat206_0-1684493007185.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat206_1-1684493038161.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/71143i9A7689F919D3E3C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat206_1-1684493038161.png" alt="cat206_1-1684493038161.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 10:44:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/creating-an-arcade-pop-up-bar-chart-in-map-viewer/m-p/1290684#M52303</guid>
      <dc:creator>cat206</dc:creator>
      <dc:date>2023-05-19T10:44:04Z</dc:date>
    </item>
  </channel>
</rss>

