Skip to content

Reset control

Reset control adds a simple button to stock toolbar, which upon click will remove all drawings/annotations as well as indicators added to chart.

Like any other control, it should be instantiated using new() syntax, and pushed into toolbar’s controls list:

let toolbar = am5stock.StockToolbar.new(root, {
container: document.getElementById("chartcontrols"),
stockChart: stockChart,
controls: [
am5stock.DrawingControl.new(root, {
stockChart: stockChart
}),
am5stock.ResetControl.new(root, {
stockChart: stockChart
})
]
});
Open in CodePen

Reset control is aligned to right by default.

If we’d like it to go left - with the rest of the controls - we can set its align: "left" setting.

let toolbar = am5stock.StockToolbar.new(root, {
container: document.getElementById("chartcontrols"),
stockChart: stockChart,
controls: [
am5stock.DrawingControl.new(root, {
stockChart: stockChart
}),
am5stock.ResetControl.new(root, {
stockChart: stockChart,
align: "left"
})
]
});