<?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 [Arcade] Integrate array variable with a chart in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-integrate-array-variable-with-a-chart/m-p/1506595#M60312</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;have a list of society and establishment. Each society have only one headquarter and all of his other implantation are called establishment.&lt;/P&gt;&lt;P&gt;I represent on ArcGIS a map to see all of the establishment of many societies.&lt;/P&gt;&lt;P&gt;And i write a code to allow my users when clicking on a point to see all of the other establishment on the pop-up box who opened by clicking on the point.&lt;/P&gt;&lt;P&gt;next in my code i retrieve the year of creation of each establishment and (if exist) the year of closing of the establishment who are closed.&lt;/P&gt;&lt;P&gt;Finally i want to use quickchart.io to made a GANTT chart like to see all of the opening and closing year of each establishment linked to the establishment that the user clicked on.&lt;/P&gt;&lt;P&gt;But i've a problem, if the establishment is alone (because the society have not another establishment in the world) the chart works :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonBOCQUET_0-1721306743756.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110033i0186B794F8013CD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonBOCQUET_0-1721306743756.png" alt="JasonBOCQUET_0-1721306743756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if I have 2 or more establishment, the chart do not work :&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonBOCQUET_2-1721306774561.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110035i0700DD42C20D82E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonBOCQUET_2-1721306774561.png" alt="JasonBOCQUET_2-1721306774561.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var date_crea = $feature.ets_date_creation

var date_ferm = $feature.date_fin_ets_def



var fs = FeatureSetByName($map, "Ancienneté d'implantation siège", ['ets_date_creation', 'ets_siren'], false)
var ls = FeatureSetByName($map, "Ancienneté d'implantation siège", ['date_fin_ets_def', 'ets_siren'], false)
var filt_fs = Filter(fs, `ets_siren = '${$feature['ets_siren']}'`)
var filt_ls = Filter(ls, `ets_siren = '${$feature['ets_siren']}'`)

var match_arr = []
for (var f in filt_fs) {
  var match_arr_change = Left(f['ets_date_creation'],4)
  var date_crea_int = Number(match_arr_change)
  Push(match_arr, date_crea_int)
}

var match_larr = []
for (var f in filt_ls) {
  var match_larr_change = Left(f['date_fin_ets_def'],4)
  var date_fin_int = Number(match_larr_change)

  if (date_fin_int==0){
    date_fin_int=2024
  }
  Push(match_larr, date_fin_int)
  }


var HTML = ""
HTML += "&amp;lt;p style='text-align: center; line-height: 0.1;'&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;span style='font-size: 30px; font-family: Calibri, sans-serif; color: rgb(1, 42, 132);'&amp;gt;"+"Date d'ouverture"+Concatenate(match_arr, "&amp;lt;br&amp;gt;")+"Date fermeture"+Concatenate(match_larr, "&amp;lt;br&amp;gt;")+"&amp;lt;/span&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;"



var param_charts = {
  type: 'horizontalBar',
  
  data: {
    labels: match_arr,
    datasets: [{
      data: 
        [[match_arr, match_larr]],
    },]
  },
  options: {
    legend: {
      display: false
    },
    annotation: {
      annotations: [{
        type: 'line',
        mode: 'vertical',
        scaleID: 'x-axis-0',
        value: 2030,
        borderColor: 'red',
        borderWidth: 1,
        label: {
          enabled: true,
          content: 'Deadline',
          position: 'top'
        }
      }]
    },
    scales: {
      xAxes: [{
        position: 'top',
        ticks: {
          min: 1900,
          max: 2030,
        }
      }],
    },
  },
}
var param_url = URLEncode(Text(param_charts)) 
var chart_url="https://quickchart.io/chart" + "?width=600&amp;amp;height=600&amp;amp;v=2&amp;amp;c=" + param_url
HTML += `&amp;lt;img src='${chart_url}' /&amp;gt;&amp;lt;/div&amp;gt;`

return { 
	type : 'text', 
	text : HTML
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;If anyone has a solution to help me please ! have a nice day&lt;/SPAN&gt;&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;</description>
    <pubDate>Thu, 18 Jul 2024 12:46:45 GMT</pubDate>
    <dc:creator>JasonBOCQUET</dc:creator>
    <dc:date>2024-07-18T12:46:45Z</dc:date>
    <item>
      <title>[Arcade] Integrate array variable with a chart</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-integrate-array-variable-with-a-chart/m-p/1506595#M60312</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;have a list of society and establishment. Each society have only one headquarter and all of his other implantation are called establishment.&lt;/P&gt;&lt;P&gt;I represent on ArcGIS a map to see all of the establishment of many societies.&lt;/P&gt;&lt;P&gt;And i write a code to allow my users when clicking on a point to see all of the other establishment on the pop-up box who opened by clicking on the point.&lt;/P&gt;&lt;P&gt;next in my code i retrieve the year of creation of each establishment and (if exist) the year of closing of the establishment who are closed.&lt;/P&gt;&lt;P&gt;Finally i want to use quickchart.io to made a GANTT chart like to see all of the opening and closing year of each establishment linked to the establishment that the user clicked on.&lt;/P&gt;&lt;P&gt;But i've a problem, if the establishment is alone (because the society have not another establishment in the world) the chart works :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonBOCQUET_0-1721306743756.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110033i0186B794F8013CD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonBOCQUET_0-1721306743756.png" alt="JasonBOCQUET_0-1721306743756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if I have 2 or more establishment, the chart do not work :&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JasonBOCQUET_2-1721306774561.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110035i0700DD42C20D82E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JasonBOCQUET_2-1721306774561.png" alt="JasonBOCQUET_2-1721306774561.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var date_crea = $feature.ets_date_creation

var date_ferm = $feature.date_fin_ets_def



var fs = FeatureSetByName($map, "Ancienneté d'implantation siège", ['ets_date_creation', 'ets_siren'], false)
var ls = FeatureSetByName($map, "Ancienneté d'implantation siège", ['date_fin_ets_def', 'ets_siren'], false)
var filt_fs = Filter(fs, `ets_siren = '${$feature['ets_siren']}'`)
var filt_ls = Filter(ls, `ets_siren = '${$feature['ets_siren']}'`)

var match_arr = []
for (var f in filt_fs) {
  var match_arr_change = Left(f['ets_date_creation'],4)
  var date_crea_int = Number(match_arr_change)
  Push(match_arr, date_crea_int)
}

var match_larr = []
for (var f in filt_ls) {
  var match_larr_change = Left(f['date_fin_ets_def'],4)
  var date_fin_int = Number(match_larr_change)

  if (date_fin_int==0){
    date_fin_int=2024
  }
  Push(match_larr, date_fin_int)
  }


var HTML = ""
HTML += "&amp;lt;p style='text-align: center; line-height: 0.1;'&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;span style='font-size: 30px; font-family: Calibri, sans-serif; color: rgb(1, 42, 132);'&amp;gt;"+"Date d'ouverture"+Concatenate(match_arr, "&amp;lt;br&amp;gt;")+"Date fermeture"+Concatenate(match_larr, "&amp;lt;br&amp;gt;")+"&amp;lt;/span&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;"



var param_charts = {
  type: 'horizontalBar',
  
  data: {
    labels: match_arr,
    datasets: [{
      data: 
        [[match_arr, match_larr]],
    },]
  },
  options: {
    legend: {
      display: false
    },
    annotation: {
      annotations: [{
        type: 'line',
        mode: 'vertical',
        scaleID: 'x-axis-0',
        value: 2030,
        borderColor: 'red',
        borderWidth: 1,
        label: {
          enabled: true,
          content: 'Deadline',
          position: 'top'
        }
      }]
    },
    scales: {
      xAxes: [{
        position: 'top',
        ticks: {
          min: 1900,
          max: 2030,
        }
      }],
    },
  },
}
var param_url = URLEncode(Text(param_charts)) 
var chart_url="https://quickchart.io/chart" + "?width=600&amp;amp;height=600&amp;amp;v=2&amp;amp;c=" + param_url
HTML += `&amp;lt;img src='${chart_url}' /&amp;gt;&amp;lt;/div&amp;gt;`

return { 
	type : 'text', 
	text : HTML
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;If anyone has a solution to help me please ! have a nice day&lt;/SPAN&gt;&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;</description>
      <pubDate>Thu, 18 Jul 2024 12:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-integrate-array-variable-with-a-chart/m-p/1506595#M60312</guid>
      <dc:creator>JasonBOCQUET</dc:creator>
      <dc:date>2024-07-18T12:46:45Z</dc:date>
    </item>
  </channel>
</rss>

