问题
I am building an angular application. In which we need to create on click buttons for zooming in and zooming out for plotly chart. We can zoom in zoom out in plotly chart using buttons on hoverable mode bar but this is not required for our application. We want to zoom in and zoom out the chart using user created on click buttons. Is there a way to trigger actions of hoverable mode bar zoom in and out using on click buttons? if not then what are the other ways to do? any suggestion is appreciated.
Code in .ts file
basicChart() {
var trace1 = {
x: ['2020-10-04', '2021-11-04', '2023-12-04'],
y: [90, 40, 60],
type: 'scatter'
};
var data = [trace1];
var layout = {
title: 'Chart',
showlegend: false
};
Plotly.newPlot('myDiv', data, layout);
}
来源:https://stackoverflow.com/questions/59817118/how-to-trigger-zoom-in-and-zoom-out-in-plotly-chart-using-user-created-on-click