Search code examples
plotly

Plotly.js: Initial Zoom


I have 256 data points. When the plot first appears I'd like the x axis to be automatically zoomed to a specific range along the X axis. Is there a way? Must I punch down to D3 somehow?


Solution

  • Something like:

    Plotly.plot('graph', [{
      /* some data trace */
    }], {
      xaxis: {
        range: [0, 1]  // to set the xaxis range to 0 to 1
      }
    });
    

    More info in the plotly.js chart attributes reference.