Plotly.js: Better error handling in treemap

Created on 27 Oct 2019  路  3Comments  路  Source: plotly/plotly.js

Hi,

When given data for treemap is somehow flawed, Plotly terminates with error. I think there needs to be some error handling.

In my case, plotting stops here with Cannot read property 'data' of undefined.
https://github.com/plotly/plotly.js/blob/990a96050bbab12e1e405d0974985b2fea54d2e6/src/traces/treemap/plot.js#L87

This is because calc has failed to build cd.hierarchy, but plotOne expects hierarchy to be there.

Since treemap doesn't have axis, I don't know what a blank treemap plot would look like, but I suppose that's waht we need here.

bug

All 3 comments

Could you please share a codepen?

Thanks for reporting @deecay !!

The equivalent sunburst trace behaves better: https://codepen.io/etpinard/pen/mddMOZo

... probably due to this block:

https://github.com/plotly/plotly.js/blob/6c3646a3c23d1c76611d794008bf24db7b687237/src/traces/sunburst/plot.js#L99-L101

that we could copy over to treemap/plot.js.

Was this page helpful?
0 / 5 - 0 ratings