jupyterlab/jupyterlab-hdf5

Add support for 1-dimensional datasets

JonjonHays opened this issue · 3 comments

Currently if a user tries to open a 1-dimensional datatset, a tab will open but nothing will be displayed. I get the following stacktrace in the console:

backend.js:6 RangeError: Invalid array length
    at t._drawBodyRegion (datagrid.js:2323)
    at t._draw (datagrid.js:2249)
    at t._paint (datagrid.js:2229)
    at t.scrollTo (datagrid.js:813)
    at t._syncScrollState (datagrid.js:1093)
    at t.onResize (datagrid.js:954)
    at t.e.processMessage (widget.js:488)
    at t.processMessage (datagrid.js:870)
    at w (index.js:436)
    at Object.n [as sendMessage] (index.js:172)

Instead, a single column should be displayed containing the 1-dimensional data, as well as the index column. I was able to display the index column and an empty data column by making the following small modification:

this._colCount = shape[1] ? shape[1] : 1;

However, I haven't yet figured out how to populate the single data column, so I reverted the change in my working branch, and will leave this as an open issue for now.

I'm half sort-of waiting on someone who said they'd submit a PR with proper n-D support. But this should be easy enough to get in in the meantime

That's me! =p I'm actually about to submit an in-progress PR for n-dimensional support a bit later tonight. I fiddled with this 1D issue for a little while in an attempt to get it in with this PR, but wasn't able to figure it out right away so I just went ahead and opened an issue. It might be the case that this gets handled when adding n-d support to the frontend, so I'll get this initial PR in and we can figure out where to go from there. Cheers!

This should be handled by the work done in #41 and #43, so I'm closing