<?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] Using Date Type of data in a chart by using tierce API in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-using-date-type-of-data-in-a-chart-by-using/m-p/1505724#M60250</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a code to retrieve and list all of the rows who have the same ID that the point i'm clicking on and showing this list on the pop-up box of the point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I want to use this code to retrieve a list of establishment who have a common ID with the establishment that i'm clicking on and see what are they opening and closing date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that i found quickchart (i already use it for other case, work very well) propose a GANTT chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var date_crea = $feature.ets_date_creation
var Ending = Date('2024-07-16')
var fs = FeatureSetByName($map, "Ancienneté d'implantation siège", ['ets_date_creation', 'ets_siren'], false)
var filt_fs = Filter(fs, `ets_siren = '${$feature['ets_siren']}'`)

var match_arr = []
for (var f in filt_fs) {
  Push(match_arr, Text(f['ets_date_creation'],'YYYY MM DD'))
}

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;"+Concatenate(match_arr, "&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: [
        [date_crea, Ending],
      ],
    }, ],
  },
  options: {
    legend: {
      display: false
    },
    annotation: {
      annotations: [{
        type: 'line',
        mode: 'vertical',
        scaleID: 'x-axis-0',
        value: Date('2021-10-30'),
        borderColor: 'red',
        borderWidth: 1,
        label: {
          enabled: true,
          content: 'Deadline',
          position: 'top'
        }
      }]
    },
    scales: {
      xAxes: [{
        position: 'top',
        type: 'time',
        time: {
          unit: 'month',
          parser : 'YYYY-MM-DD'
        },
        ticks: {
          min: date_crea,
          max: Ending,
        }
      }],
    },
  },
}
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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i call "date_crea" (the creation date) to make the&amp;nbsp;left terminal of the X axis, it works the API recognize the date. But when i use the creation date in the data to create the content on the chart, i see nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have an idea to see my data on the chart ?&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2024 10:15:17 GMT</pubDate>
    <dc:creator>JasonBOCQUET</dc:creator>
    <dc:date>2024-07-16T10:15:17Z</dc:date>
    <item>
      <title>[Arcade] Using Date Type of data in a chart by using tierce API</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-using-date-type-of-data-in-a-chart-by-using/m-p/1505724#M60250</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a code to retrieve and list all of the rows who have the same ID that the point i'm clicking on and showing this list on the pop-up box of the point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I want to use this code to retrieve a list of establishment who have a common ID with the establishment that i'm clicking on and see what are they opening and closing date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do that i found quickchart (i already use it for other case, work very well) propose a GANTT chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var date_crea = $feature.ets_date_creation
var Ending = Date('2024-07-16')
var fs = FeatureSetByName($map, "Ancienneté d'implantation siège", ['ets_date_creation', 'ets_siren'], false)
var filt_fs = Filter(fs, `ets_siren = '${$feature['ets_siren']}'`)

var match_arr = []
for (var f in filt_fs) {
  Push(match_arr, Text(f['ets_date_creation'],'YYYY MM DD'))
}

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;"+Concatenate(match_arr, "&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: [
        [date_crea, Ending],
      ],
    }, ],
  },
  options: {
    legend: {
      display: false
    },
    annotation: {
      annotations: [{
        type: 'line',
        mode: 'vertical',
        scaleID: 'x-axis-0',
        value: Date('2021-10-30'),
        borderColor: 'red',
        borderWidth: 1,
        label: {
          enabled: true,
          content: 'Deadline',
          position: 'top'
        }
      }]
    },
    scales: {
      xAxes: [{
        position: 'top',
        type: 'time',
        time: {
          unit: 'month',
          parser : 'YYYY-MM-DD'
        },
        ticks: {
          min: date_crea,
          max: Ending,
        }
      }],
    },
  },
}
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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i call "date_crea" (the creation date) to make the&amp;nbsp;left terminal of the X axis, it works the API recognize the date. But when i use the creation date in the data to create the content on the chart, i see nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have an idea to see my data on the chart ?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 10:15:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-using-date-type-of-data-in-a-chart-by-using/m-p/1505724#M60250</guid>
      <dc:creator>JasonBOCQUET</dc:creator>
      <dc:date>2024-07-16T10:15:17Z</dc:date>
    </item>
  </channel>
</rss>

