Closed
Description
Hi there,
While writing Plotly.NET bindings for the new autorange options from plotly.js 2.26 i encountered this problem for setting minallowed
and maxallowed
values on the radialaxis
attribute.
this is a minimal sample:
var data = [{"type":"scatterpolar","showlegend":true,"mode":"markers","r":[0,1,2,3,4,5,6,7,8,9,10],"theta":[0,10,20,30,40,50,60,70,80,90,100],"marker":{}}];
var layout = {"polar":{"radialaxis":{"maxallowed":8,"minallowed":4}}};
Plotly.newPlot('some-div', data, layout);
this results in the following error:
Uncaught Error: Something went wrong with axis scaling
at t.setScale (plotly-2.26.2.min.js:8:592067)
at doAutoRange (plotly-2.26.2.min.js:8:480137)
at N.doAutoRange (plotly-2.26.2.min.js:8:764495)
at N.updateLayout (plotly-2.26.2.min.js:8:763490)
at N.plot (plotly-2.26.2.min.js:8:761038)
at Object.plot (plotly-2.26.2.min.js:8:752832)
at e.drawData (plotly-2.26.2.min.js:8:460712)
at f.syncOrAsync (plotly-2.26.2.min.js:8:350231)
at e._doPlot (plotly-2.26.2.min.js:8:438077)
at e.newPlot (plotly-2.26.2.min.js:8:431260)
note that setting these props va autorangeoptions
works just fine:
var data = [{"type":"scatterpolar","showlegend":true,"mode":"markers","r":[0,1,2,3,4,5,6,7,8,9,10],"theta":[0,10,20,30,40,50,60,70,80,90,100],"marker":{}}];
var layout = {"polar":{"radialaxis":{"autorangeoptions":{"maxallowed":8,"minallowed":4}}}};
Plotly.newPlot('some-other-div', data, layout);
here is a jsfiddle: https://jsfiddle.net/63e8qsxn/
note also, jfc, that setting only minallowed
and maxallowed
on cartesian (2D and 3D) plots also works just fine, e.g.:
var data = [{"type":"scatter","showlegend":true,"mode":"markers","x":[0,1,2,3,4,5,6,7,8,9,10],"y":[0,1,2,3,4,5,6,7,8,9,10],"marker":{},"line":{}}];
var layout = {"xaxis":{"maxallowed":8,"minallowed":4},"yaxis":{"maxallowed":8,"minallowed":4}};