Skip to content
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
Merged

Allow changes to columns in bokeh CDS #2666

merged 6 commits into from
May 8, 2018

Conversation

philippjfr
Copy link
Member

@philippjfr 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.

@philippjfr philippjfr added tag: backend: bokeh type: enhancement Minor feature or improvement to an existing feature labels May 8, 2018
.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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@philippjfr philippjfr merged commit 253a31b into master May 8, 2018
@philippjfr philippjfr deleted the column_changes branch July 4, 2018 11:13
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tag: backend: bokeh type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants