New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changes to columns in bokeh CDS #2666

Merged
merged 6 commits into from May 8, 2018

Conversation

Projects
None yet
2 participants
@philippjfr
Member

philippjfr commented May 8, 2018

This PR eliminates a long-standing limitation in updating plots with elements where the dimensions change. Specifically the code that updates a CDS now checks whether the data needs to be replaced completely, which occurs in one of two conditions 1) there is a new column which does not match the length of old columns or 2) there is an old column which is not being updated which does not match the updated columns in length.

Here are some examples of what this allows (note the changes in the axis label and table column header):

curve_update
table_update

Technically we could just always replace the data completely but a) that can be inefficient and b) it breaks shared_datasource. I've double checked shared sources are not affected by this change.

.travis.yml Outdated
@@ -29,7 +29,7 @@ install:
- conda info -a
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION flake8 scipy=1.0.0 numpy freetype nose pandas=0.22.0 jupyter ipython=5.4.1 param matplotlib=2.1.2 xarray
- source activate test-environment
- conda install -c conda-forge iris plotly flexx ffmpeg --quiet
- conda install -c conda-forge iris plotly flexx ffmpeg netcdftime --quiet

This comment has been minimized.

@philippjfr

philippjfr May 8, 2018

Member

Unrelated to this PR but apparently required to get tests passing again.

philippjfr added some commits May 8, 2018

length = [len(v) for v in source.data.values() if isinstance(v, (list, np.ndarray))]
not_updated = [k for k in source.data if k not in data]
new = [k for k in data if k not in source.data]
if ((not_updated and new_length and any(len(source.data[n]) != new_length[0] for n in not_updated))

This comment has been minimized.

@jlstevens

jlstevens May 8, 2018

Member

Not sure you need the initial not_updated as any([]) evaluates to false.

This comment has been minimized.

@jlstevens

jlstevens May 8, 2018

Member

I think that is also true for the check against new.

@philippjfr philippjfr merged commit 253a31b into master May 8, 2018

4 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.0007%) to 83.353%
Details
s3-reference-data-cache Test data is cached.
Details

@philippjfr philippjfr deleted the column_changes branch Jul 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment