holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.66k stars 396 forks source link

PointDraw empty_value field not respected when using style mapping #6242

Open TheoMathurin opened 1 month ago

TheoMathurin commented 1 month ago

On HoloViews 1.18.3, style mapping using vdims does not work properly because empty_value is not set correctly. Updates are correctly taken into account though.

In the following example, default size is 0 instead of 10.

import holoviews as hv
from holoviews import opts, streams
from holoviews.plotting.links import DataLink
import panel as pn

hv.extension('bokeh')

data = ([0, 0.5, 1], [0, 0.5, 0], [6, 8, 4])
points = hv.Points(data, vdims='size').redim.range(x=(-.1, 1.1), y=(-.1, 1.1))
point_stream = streams.PointDraw(data=points.columns(), num_objects=10, source=points, empty_value=10)
point_stream.add_subscriber(lambda **kwargs: print(kwargs))
table = hv.Table(points, ['x', 'y'], 'size')
DataLink(points, table)

pn.Row((points + table).opts(
    opts.Layout(merge_tools=False),
    opts.Points(active_tools=['point_draw'], color='k', height=400,
                size='size', tools=['hover'], width=400),
    opts.Table(editable=True))).servable()

Capture vidéo du 21-05-2024 11:00:13