Chartjs-Chart.js: Can I change the "OriginalOptions" variable within the chartjs-zoom-plugin?

0👍

Yes, I can confirm this as of chartjs-plugin-zoom 0.7.7, with all the caveats regarding undocumented features. There is discussion here and a practical example of overriding storeOriginalOptions(chart) in Eliz’s fiddle, with the critical portion being:

var originalOptions = chart.$zoom._originalOptions;
helpers.each(chart.scales, function(scale) {
    if (!originalOptions[scale.id]) {
        originalOptions[scale.id] = helpers.clone(scale.options);
    }
});

So if needed, you can edit properties on $zoom directly. If you know the IDs assigned to your scales and just want to reset to whatever range the axes are currently set to, then you can further shorten the copying of scales into _originalOptions:

chart.$zoom._originalOptions = {
    myXID: chart.options.scales.xAxes[0],
    myYID: chart.options.scales.yAxes[0],
};

Leave a comment