<?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 MapViewer Arcade Popup Chart Only Rendering as Piechart in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/mapviewer-arcade-popup-chart-only-rendering-as/m-p/1571435#M62951</link>
    <description>&lt;P&gt;I have a webmap I am attempted to set up a new pop-up element within. I have wrote in the following code, however it will only fully render if I change the type to piechart. Otherwise it only renders the background of the chart area but none of the data. I use the same code to also populate a fieldlist from the data in the same fashion and this works without fail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas or suggestions would be welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var use = FeatureSetById($map, "19403d43feb-layer-16");

var ptr = $feature.PTR_str;

var spec = Filter(use, "PTR = @ptr")
if(Count(spec) == 0){
  return {
    type : 'text',
    text: 'No Usage History Available'
  }
}

var spec2 = OrderBy(spec, "bill_date ASC")



var mos = Dictionary({
  '0' : 'January',
  '1' : 'February',
  '2' : 'March',
  '3' : 'April',
  '4' : 'May',
  '5' : 'June',
  '6' : 'July',
  '7' : 'August',
  '8' : 'September',
  '9' : 'October',
  '10' : 'November',
  "11" : 'December'
})


var atts = {}
var fldIns = []
var flds = []
var mo
var yr
var nm
var usage

for(var row in spec2){
  mo = Text(Month(DateOnly(row['bill_date'])))
  yr = Right(Text(Year(DateOnly(row['bill_date']))), 2)
  nm = `${mos[mo]}${yr}`
  usage = row['billed_usage']
  push(fldIns, {fieldName : nm})
  push(flds, nm)
  atts[nm] = usage
}

var element = {
    type: 'media',
    // title : 'The title for all media in the element',
    // description : '',
    attributes : atts,  // replace this dictionary with your own key-value pairs,
    mediaInfos: [{
        type : 'linechart', //linechart | barchart | piechart | columnchart
        //title : 'give your chart a title',
        // caption : '',
        altText : '', //altText will be read by screen readers
        value : {
          fields: flds,  // choose what attributes to use in the chart
          /* colors: [  // values must be an array of [r, g, b, a] values (0-255)
            [122, 190, 229, 255],
            [179, 155, 213, 255],
            [248, 174, 131, 255]
          ], */
          //normalizeField : '',  // the name of the attribute to normalize by or value
        }
      }]
  }


  return element&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Dec 2024 12:01:06 GMT</pubDate>
    <dc:creator>AustinAverill</dc:creator>
    <dc:date>2024-12-27T12:01:06Z</dc:date>
    <item>
      <title>MapViewer Arcade Popup Chart Only Rendering as Piechart</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/mapviewer-arcade-popup-chart-only-rendering-as/m-p/1571435#M62951</link>
      <description>&lt;P&gt;I have a webmap I am attempted to set up a new pop-up element within. I have wrote in the following code, however it will only fully render if I change the type to piechart. Otherwise it only renders the background of the chart area but none of the data. I use the same code to also populate a fieldlist from the data in the same fashion and this works without fail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas or suggestions would be welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var use = FeatureSetById($map, "19403d43feb-layer-16");

var ptr = $feature.PTR_str;

var spec = Filter(use, "PTR = @ptr")
if(Count(spec) == 0){
  return {
    type : 'text',
    text: 'No Usage History Available'
  }
}

var spec2 = OrderBy(spec, "bill_date ASC")



var mos = Dictionary({
  '0' : 'January',
  '1' : 'February',
  '2' : 'March',
  '3' : 'April',
  '4' : 'May',
  '5' : 'June',
  '6' : 'July',
  '7' : 'August',
  '8' : 'September',
  '9' : 'October',
  '10' : 'November',
  "11" : 'December'
})


var atts = {}
var fldIns = []
var flds = []
var mo
var yr
var nm
var usage

for(var row in spec2){
  mo = Text(Month(DateOnly(row['bill_date'])))
  yr = Right(Text(Year(DateOnly(row['bill_date']))), 2)
  nm = `${mos[mo]}${yr}`
  usage = row['billed_usage']
  push(fldIns, {fieldName : nm})
  push(flds, nm)
  atts[nm] = usage
}

var element = {
    type: 'media',
    // title : 'The title for all media in the element',
    // description : '',
    attributes : atts,  // replace this dictionary with your own key-value pairs,
    mediaInfos: [{
        type : 'linechart', //linechart | barchart | piechart | columnchart
        //title : 'give your chart a title',
        // caption : '',
        altText : '', //altText will be read by screen readers
        value : {
          fields: flds,  // choose what attributes to use in the chart
          /* colors: [  // values must be an array of [r, g, b, a] values (0-255)
            [122, 190, 229, 255],
            [179, 155, 213, 255],
            [248, 174, 131, 255]
          ], */
          //normalizeField : '',  // the name of the attribute to normalize by or value
        }
      }]
  }


  return element&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 12:01:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/mapviewer-arcade-popup-chart-only-rendering-as/m-p/1571435#M62951</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2024-12-27T12:01:06Z</dc:date>
    </item>
  </channel>
</rss>

