I’d like my DataCube to startup with all rows expanded. I thought I’d be able to do this by setting the
collapsed parameter of its
grouping argument to False, but apparently that’s the default and it doesn’t have the desired effect.
I was then looking into whether I could set the initial value of the
target ColumnDataSource to accomplish this goal, but also no luck. See the (not so minimal) working example below, in which I put in a button to allow me to examine the current value of
target, and after seeing what it was when fully expanded, I set this as the initial value and re-ran, but this just gave the same initial target as before.
Am I missing a simpler way to do this? Why aren’t my 2 attempts successful?
from bokeh.io import output_file, show, curdoc from bokeh.models import Button, DataCube, ColumnDataSource, StringFormatter, TableColumn, GroupingInfo, SumAggregator from bokeh.layouts import row source = ColumnDataSource(data=dict( d0=['A', 'E', 'E', 'E', 'J', 'J', 'M'], d1=['B', 'C', 'D', 'H', 'K', 'L', 'N'], px=[10, 20, 30, 40, 50, 60, 70 ], )) #target = ColumnDataSource(data=dict(row_indices=, labels=)) # initial target = ColumnDataSource(data=dict(row_indices=[, 0, [1, 2, 3], 1, 2, 3, [4, 5], 4, 5, , 6], labels=['A', 'B', 'E', 'C', 'D', 'H', 'J', 'K', 'L', 'M', 'N'])) # after finding out this was what target was equal to after expanding all rows of the datacube formatter = StringFormatter(font_style='bold') columns = [ TableColumn(field='d1', title='Name', width=40, sortable=False, formatter=formatter), TableColumn(field='px', title='Price', width=40, sortable=False), ] grouping = [ GroupingInfo(getter='d0'), ] def callback(): print(cube.target.data) cube = DataCube(source=source, columns=columns, grouping=grouping, target=target) button = Button() button.on_click(callback) curdoc().add_root(row(button, cube))