Hi guys,
have a list of society and establishment. Each society have only one headquarter and all of his other implantation are called establishment.
I represent on ArcGIS a map to see all of the establishment of many societies.
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.
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.
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.
But i've a problem, if the establishment is alone (because the society have not another establishment in the world) the chart works :
but if I have 2 or more establishment, the chart do not work :
Here is my code :
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 += "<p style='text-align: center; line-height: 0.1;'><strong><span style='font-size: 30px; font-family: Calibri, sans-serif; color: rgb(1, 42, 132);'>"+"Date d'ouverture"+Concatenate(match_arr, "<br>")+"Date fermeture"+Concatenate(match_larr, "<br>")+"</span></strong></p>"
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&height=600&v=2&c=" + param_url
HTML += `<img src='${chart_url}' /></div>`
return {
type : 'text',
text : HTML
}
If anyone has a solution to help me please ! have a nice day