Привет, я новичок в Highchart, javascript, jquery, html, json массив, json объект Я пытаюсь добавить еще один json объект к каждому json объекту внутри json массив, возможно ли это сделать в javascript используя pu sh? Кто-нибудь может направить меня, я буду очень признателен, спасибо
Текущий jsonArray с json объектом внутри
[{showInLegend: false, type: 'column',
name: 'Test1',
id: 'Test1',
data: [10, 10]
},{showInLegend: false, type: 'column',
name: 'Test2',
id: 'Test2',
data: [120, 120]
},{showInLegend: false, type: 'column',
name: 'Test3',
id: 'Test3',
data: [320, 120]
}]
Я хочу добавить это в каждый json объект внутри jsonarray
tooltip: {
pointFormatter: function () {
return this.series.name + '<br/><span style="color:#273c75"><b> Amount : </b> </span>$' + this.y.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
Ожидаемый результат
[{showInLegend: false, type: 'column',
name: 'Test1',
id: 'Test1',
data: [10, 10],tooltip: {
pointFormatter: function () {
return this.series.name + '<br/><span style="color:#273c75"><b> Amount : </b> </span>$' + this.y.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
},{showInLegend: false, type: 'column',
name: 'Test2',
id: 'Test2',
data: [120, 120],tooltip: {
pointFormatter: function () {
return this.series.name + '<br/><span style="color:#273c75"><b> Amount : </b> </span>$' + this.y.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
},{showInLegend: false, type: 'column',
name: 'Test3',
id: 'Test3',
data: [320, 120],tooltip: {
pointFormatter: function () {
return this.series.name + '<br/><span style="color:#273c75"><b> Amount : </b> </span>$' + this.y.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
}]