I would like to add 3 buttons(Hide/Remove/Settings) to the Legend:
- Hide button should have onclick event to hide series/indicator,
- Remove button should have onclick event to remove(not hide) series/indicator,
- Settings button should have onclick event to show popup for edit settings of the series/indicator.
Code:
legend: {
enabled: true,
useHTML:true,
labelFormatter: function () {
return this.name + ' <button onclick="indicator_hide()">Hide</button>' + '<button onclick="indicator_remove()">Remove</button>' + '<button onclick="indicator_settings()">Settings</button>';
}
Code for button
function indicator_hide(){
if(chart.series[0].visible==true){
chart.series[0].visible=false
} else{
chart.series[0].visible=true
}
}
I created a chart, see the link below.