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

feat(bokeh): Server side HoverTool for rasterized/datashaded plots with selector #6422

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
db72f06
add custom hover tool for rasterized plot
hoxbro Oct 25, 2024
b0496de
Update datashader to not send all data to frontend
hoxbro Oct 25, 2024
567e7cb
cleanup
hoxbro Oct 25, 2024
debc0ea
add xy to hovertool
hoxbro Oct 25, 2024
238e620
Merge branch 'main' into inspect
hoxbro Oct 25, 2024
560e562
clean up
hoxbro Oct 25, 2024
dbcfecf
add support for Jupyter Notebook
hoxbro Oct 25, 2024
3914656
update datashader test
hoxbro Oct 25, 2024
8f71e46
Updates to pass raster tests
hoxbro Oct 25, 2024
2775f06
Update lookup data in _update_hover
hoxbro Oct 25, 2024
042b695
Have selector_columns
hoxbro Oct 25, 2024
9a4b0d6
Make mixin
hoxbro Oct 25, 2024
b2a65f1
Add Server Hover for datashade element
hoxbro Oct 28, 2024
f1e9f10
Support self.hover_tooltips
hoxbro Oct 28, 2024
ca34132
fix: when no data is selected
hoxbro Oct 28, 2024
2fbd755
Add back __index__
hoxbro Oct 29, 2024
d318e6d
Align datashade.add_selector_data
hoxbro Oct 29, 2024
c0bdd6e
Add first implementation of dynspread
hoxbro Oct 29, 2024
b9931a6
Add valueerror if selector contains any kdims.
hoxbro Oct 31, 2024
ec8e6ae
dynspread for image
hoxbro Oct 31, 2024
aedb7b2
simplify for-loop
hoxbro Oct 31, 2024
ed433d8
Refactor sel_data in spread
hoxbro Oct 31, 2024
2f0e822
Merge branch 'main' into inspect
hoxbro Nov 5, 2024
201b75c
Add test for xarray_dataset with alpha
hoxbro Nov 5, 2024
24b2fc0
clean up holoviews/tests/ui/bokeh/test_hover.py
hoxbro Nov 5, 2024
4a6feca
add test for datashade and selector
hoxbro Nov 5, 2024
9612f21
increase size of selector test
hoxbro Nov 5, 2024
e6574eb
Add test for column name matches RGBA
hoxbro Nov 5, 2024
98dfb3b
Update to use inputs
hoxbro Nov 5, 2024
394c873
dont overwrite existing data in dynspread with selector
hoxbro Nov 5, 2024
002f392
Add test for spread with selector
hoxbro Nov 5, 2024
356007b
rename selector test
hoxbro Nov 5, 2024
04ae8de
extra assert for xarray dataset
hoxbro Nov 5, 2024
f36a4ab
Add UI test for hovertool
hoxbro Nov 5, 2024
8804bfb
Remove anti-pattern wait_until + expect
hoxbro Nov 5, 2024
43741fb
Move import into ui test
hoxbro Nov 5, 2024
fb4ddd1
fix unrelated error message
hoxbro Nov 6, 2024
10d4272
Add rasterize support for ds.by and selector
hoxbro Nov 6, 2024
5b9bc46
Use hold for server too
hoxbro Nov 8, 2024
909577a
Add pytest fixture rng
hoxbro Nov 13, 2024
4e00229
Merge branch 'main' into inspect
hoxbro Nov 13, 2024
8fe1e26
remove anti-pattern wait_until(lambda: expect(...))
hoxbro Nov 13, 2024
27d9ed2
Update AggState
hoxbro Nov 15, 2024
8f4ce24
Fix problem with datashade + ds.by + selector
hoxbro Nov 15, 2024
a24e561
misc small changes
hoxbro Nov 15, 2024
31e30f5
Merge branch 'main' into inspect
hoxbro Nov 15, 2024
725d46b
Revert dims change
hoxbro Nov 15, 2024
9b5342b
Merge branch 'main' into inspect
hoxbro Nov 16, 2024
db0cdcb
Use data.sizes for transpose
hoxbro Nov 19, 2024
21e3f3e
Small changes
hoxbro Nov 19, 2024
f0e513c
Update test
hoxbro Nov 19, 2024
99b32db
Add support for dynspread + rasterize + ds.by
hoxbro Nov 19, 2024
c636bd5
Join Image + ImageStack
hoxbro Nov 19, 2024
4eb0189
add spreading test for rasterize/datashade + ds.by
hoxbro Nov 19, 2024
08dc4b1
Test that x and y has a value
hoxbro Nov 20, 2024
9e71910
Set alpha to 0 for all dimensions when converting form uint32 to 4 uint8
hoxbro Nov 20, 2024
c139777
Update test to match alpha=0 change
hoxbro Nov 20, 2024
f4dd02d
expr_state -> agg_state
hoxbro Nov 21, 2024
e818c4d
Check for hv_created in tool tags
hoxbro Nov 21, 2024
3922f79
Merge branch 'main' into inspect
hoxbro Dec 17, 2024
8f4378e
refactor alpha dimension detection
hoxbro Dec 17, 2024
48f91a5
Remove RGBA in hover
hoxbro Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update datashader test
  • Loading branch information
hoxbro committed Oct 25, 2024
commit 3914656bcfa21fb9a979fec0a75d6ff45ad9f402
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ def _update_hover(self, element):
return
super()._update_hover(element)

def _init_tools(self, element):
tools = super()._init_tools(element)
def _init_tools(self, element, callbacks=None):
tools = super()._init_tools(element, callbacks=callbacks)

hover = None
for tool in tools or ():
17 changes: 9 additions & 8 deletions holoviews/tests/operation/test_datashader.py
Original file line number Diff line number Diff line change
@@ -100,6 +100,7 @@ def point_data():
]
}
df = pd.concat(dists, ignore_index=True)
df["_index"] = np.arange(len(df)) # Used to track index
return df


@@ -1310,12 +1311,12 @@ def test_rasterize_where_agg_no_column(point_plot, agg_input_fn, index_col):
rast_input = dict(dynamic=False, x_range=(-1, 1), y_range=(-1, 1), width=2, height=2)
img = rasterize(point_plot, aggregator=agg_fn, **rast_input)

assert list(img.data) == ["__index__", "s", "val", "cat"]
assert list(img.vdims) == ["val", "s", "cat"] # val first and no index
assert list(img.data) == ["s", "val", "cat", "_index"]
assert list(img.vdims) == ["val", "s", "cat", "_index"] # val first and no __index__

# N=100 in point_data is chosen to have a big enough sample size
# so that the index are not the same for the different agg_input_fn
np.testing.assert_array_equal(img.data["__index__"].data.flatten(), index_col)
np.testing.assert_array_equal(img.data["_index"].data.flatten(), index_col)

img_simple = rasterize(point_plot, aggregator=agg_input_fn("val"), **rast_input)
np.testing.assert_array_equal(img_simple["val"], img["val"])
@@ -1353,14 +1354,14 @@ def test_rasterize_selector(point_plot, sel_fn):
img = rasterize(point_plot, selector=sel_fn("val"), **rast_input)

# Count is from the aggregator
assert list(img.data) == ["Count", "__index__", "s", "val", "cat"]
assert list(img.vdims) == ["Count", "s", "val", "cat"] # no index
assert list(img.data) == ["Count", "s", "val", "cat", "_index"]
assert list(img.vdims) == [Dimension("Count")] # Only the dimension send to the frontend

# The output for the selector should be equal to the output for the aggregator using
# ds.where
img_agg = rasterize(point_plot, aggregator=ds.where(sel_fn("val")), **rast_input)
for c in ["s", "val", "cat"]:
np.testing.assert_array_equal(img[c], img_agg[c])
for c in ["s", "val", "cat", "_index"]:
np.testing.assert_array_equal(img.data[c], img_agg.data[c], err_msg=c)

# Checking the count is also the same
img_count = rasterize(point_plot, **rast_input)
@@ -1379,7 +1380,7 @@ def test_rasterize_with_datetime_column():
rast_input = dict(dynamic=False, x_range=(-1, 1), y_range=(-1, 1), width=2, height=2)
img_agg = rasterize(point_plot, selector=ds.first("Value"), **rast_input)

assert img_agg["Timestamp"].dtype == np.dtype("datetime64[ns]")
assert img_agg.data["Timestamp"].dtype == np.dtype("datetime64[ns]")



Loading