Hi,
It seems my Arcade Script to create a pop up line chart has broken. The chart is visible in the popup, however no data populates. I am stumped because it was working fine a few weeks ago. Could someone please look at my code and help me troubleshoot?
Thanks,
// Set variable to MRNLINK IDS
var Road = $feature.MRNLINKID
// Set variable to related table (notice FeatureSetByRelationshipName)
var Table = FeatureSetByRelationshipName($feature, "ADT_Data_Merge", ['Mean_ADT', 'Year'], false)
// filter through table, matching the table's STATIONID with road variable)
var AADT = OrderBy(Filter(Table, 'StationID = @Road'), 'Year')
// this was copied and pasted from AGO community post, I only changed certain variables
var chartValues = {}
var chartNames = []
for (var f in AADT) {
chartValues[Text(f.Year,'0000')] = Text(f.Mean_ADT,'###,###')
Push(chartNames, f.Year)
}
return {
type: 'media',
title : 'AADT by Year',
description : 'Annual average daily traffic by year for this road',
attributes : chartValues, // replace this dictionary with your own key-value pairs,
mediaInfos: [{
type : 'linechart', //linechart | barchart | piechart | columnchart
//title : '',
//caption : '',
altText : 'line chart showing traffic counts by year', //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
}
}]
}
Brooke
Solved! Go to Solution.
I figured it out! I think this may have to do with the June update which asks for numerical values when configuring a chart, but I'm not totally sure. I adjusted line 7 to call a numerical value, and the chart works! I hope this helps someone.
for (var f in AADT) {
chartValues[Text(f.Year,'0000')] = Number(f.Mean_ADT,'###,###')
I figured it out! I think this may have to do with the June update which asks for numerical values when configuring a chart, but I'm not totally sure. I adjusted line 7 to call a numerical value, and the chart works! I hope this helps someone.
for (var f in AADT) {
chartValues[Text(f.Year,'0000')] = Number(f.Mean_ADT,'###,###')