Select to view content in your preferred language

arcade popup chart with X/Y values

567
2
03-18-2024 08:58 PM
PierreloupDucroix
Frequent Contributor

Hello,

is it possible to create a popup chart in arcade, that shows X/Y coordinates, and not only Y numerical value for each X field.

Explanation : in the mapviewer, I can create a chart by referencing a numerical field and the corresponding numerical values :

PierreloupDucroix_0-1710819923984.png

Here you can see that the X values are correctly distributed along the X axis.

However, when trying to replicate such a chart in Arcade, I cannot get the same result. Here is my code :

var rels = FeatureSetByRelationshipName($feature, "mesures")
var attributes = {}
var fieldNames = [];
for (var rel in rels){
    var X = text(rel.X)
    attributes[X] = rel.Z
    Push(fieldNames, rel.X)
};
return {
  type: 'media',
  title : 'title',
  description : 'desc',
  attributes : attributes,  // replace this dictionary with your own key-value pairs,
  mediaInfos: [{
    type : 'linechart', //linechart | barchart | piechart | columnchart
    //title : '',
    //caption : '',
    altText : '', //altText will be read by screen readers
    value : {
      fields: fieldNames,  // choose what attributes to use in the chart
      //normalizeField : '',  // the name of the attribute to normalize by or value 
    }	  
  }]
}

As far as I understand, I have to create a dictionary of key/value pairs for the attributes, and then a field name list for the fieldNames. Since the keys in my attributes' dictionary have to be a string, then the result (X values) is not distributed along the X axis, but only put side by side.

Is there a way to achieve that ?

CEO of MAGIS
2 Replies
juanrios87
New Contributor

I am having the same problem. My data has decimal values and I want to distribute them on a uniform scale on the x-axis. Additionally, it only shows the first 10 out of 20 data points. Have you been able to solve it in any way?

0 Kudos
PierreloupDucroix
Frequent Contributor

Hi,

no, I did not find any solution yet

CEO of MAGIS
0 Kudos