How to trigger zoom in and zoom out in plotly chart using user created on click buttons?

南楼画角 提交于 2020-01-25 10:13:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!