0👍
You could remove duplicates from your list using this function
function remove_duplicates_safe(arr) {
var seen = {};
var ret_arr = [];
for (var i = 0; i < arr.length; i++) {
if (!(arr[i] in seen)) {
ret_arr.push(arr[i]);
seen[arr[i]] = true;
}
}
return ret_arr;
}
You can then do something like this or make any logic you need
var listNoDuplicates = remove_duplicates_safe(this.Chart);
replace this line
for (var i = 0; i < this.Chart.length; i++) {
with this line
for (var i = 0; i < listNoDuplicates.length; i++) {
Source:stackexchange.com