I have chart data that can, in theory, be applicable to a bubble chart or a radar (scatterpolar) chart. I have a function that transforms the data x
/y
/marker.size
values (for a bubble chart) to r
& theta
values (for scatterpolar)
However when I update the chart (using Plotly.react
), I get an error that reads:
set_convert.js:174 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
at Object.ax.setGeometry (set_convert.js:174)
at Polar.webpackJsonp../node_modules/plotly.js/src/plots/polar/polar.js.proto.updateAngularAxis (polar.js:504)
at Polar.webpackJsonp../node_modules/plotly.js/src/plots/polar/polar.js.proto.updateLayout (polar.js:273)
at Polar.webpackJsonp../node_modules/plotly.js/src/plots/polar/polar.js.proto.plot (polar.js:91)
at Object.plot (index.js:45)
at webpackJsonp../node_modules/plotly.js/src/plot_api/subroutines.js.exports.drawData (subroutines.js:560)
at Object.webpackJsonp../node_modules/plotly.js/src/lib/index.js.lib.syncOrAsync (index.js:390)
at webpackJsonp../node_modules/plotly.js/src/plot_api/plot_api.js.exports.plot (plot_api.js:385)
at Object.webpackJsonp../node_modules/plotly.js/src/registry.js.exports.call (registry.js:221)
at Object.webpackJsonp../node_modules/plotly.js/src/plots/plots.js.plots.doAutoMargin (plots.js:1809)
The code that it errors out on is:
ax.setGeometry = function() {
/* ...snip... */
switch(axType) {
case 'linear':
/* ...snip... */
case 'category':
var catLen = ax._categories.length; // ERRORS OUT HERE
var _period = ax.period ? Math.max(ax.period, catLen) : catLen;
c2rad = t2rad = function(v) { return v * 2 * Math.PI / _period; };
rad2c = rad2t = function(v) { return v * _period / Math.PI / 2; };
ax.range = [0, _period];
break;
}
/* ...snip... */
};
I’m not sure what I’m doing wrong…