Black Lives Matter. Please consider donating to Black Girls Code today.

Disable Zoom Events in JavaScript

How to disable zoom events in JavaScript charts.


Building AI apps or dashboards with Plotly.js? Chart Studio enables 1-click export, editing and sharing of Plotly.js charts. If building a full-stack app with Plotly.js, you might save time by building with Dash instead. Schedule a Dash Enterprise demo.

Install Dash Enterprise on Azure | Install Dash Enterprise on AWS


New to Plotly?

Plotly is a free and open-source graphing library for JavaScript. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.

function makeplot() {
    Plotly.d3.csv("https://raw.githubusercontent.com/plotly/datasets/master/2014_apple_stock.csv", function(data){ processData(data) } );

};
    
function processData(allRows) {

    console.log(allRows);
    var x = [], y = [], standard_deviation = [];

    for (var i=0; i < allRows.length; i++) {
        row = allRows[i];
        x.push( row['AAPL_x'] );
        y.push( row['AAPL_y'] );
    }
    console.log( 'X',x, 'Y',y, 'SD',standard_deviation );
    makePlotly( x, y, standard_deviation );
}

function makePlotly( x, y, standard_deviation ){
    var plotDiv = document.getElementById("myDiv");
    var traces = [{
        x: x, 
        y: y
    }];

    var layout = { 
        title: 'Plotting CSV data from AJAX call',
        xaxis: {fixedrange: true}
    };

    Plotly.newPlot('myDiv', traces, layout);
};
  makeplot();

function makeplot() {
    Plotly.d3.csv("https://raw.githubusercontent.com/plotly/datasets/master/2014_apple_stock.csv", function(data){ processData(data) } );

};

function processData(allRows) {

    var x = [], y = [], standard_deviation = [];

    for (var i=0; i < allRows.length; i++) {
        row = allRows[i];
        x.push( row['AAPL_x'] );
        y.push( row['AAPL_y'] );
    }
    makePlotly( x, y, standard_deviation );
}

function makePlotly( x, y, standard_deviation ){
    var plotDiv = document.getElementById("myDiv");
    var traces = [{
        x: x,
        y: y
    }];

    var layout = {
        title: 'Plotting CSV data from AJAX call',
        yaxis: {fixedrange: true},
        xaxis : {fixedrange: true}
    };

    Plotly.newPlot('myDiv', traces, layout);
};
  makeplot();