I am from Pakistan
panel widgets.DateRangeSlider not working . Following is the code snap
Nauman Ahmad Khan @khannaum 16:30
date range values not selected and resulted to None
date_range_slider = pn.widgets.DateRangeSlider(
name='Date',
start=cust_group_by_work_projected.ddate.min(), end=cust_group_by_work_projected.ddate.max(),
value=(cust_group_by_work_projected.ddate.min(), cust_group_by_work_projected.ddate.max())
)
pn.extension()
test_new=cust_group_by_work_projected.hvplot(y='Count',x='complaint_type' ,
groupby=['RBU','complaint_type','ddate'],legend=False)
pn.panel(test_new, widgets={'ddate': date_range_slider})
help required why daterangeslider not working
ddate is None
So the issue here is that HoloViews does not understand the DateRangeSlider widget values, it is only set up to perform a simple select. Therefore we have to manually apply the range selection after we’ve constructed the object, it should go something like this. Since your example does not include the data I’ve not tested this yet:
date_range_slider = pn.widgets.DateRangeSlider(
name='Date',
start=cust_group_by_work_projected.ddate.min(), end=cust_group_by_work_projected.ddate.max(),
value=(cust_group_by_work_projected.ddate.min(), cust_group_by_work_projected.ddate.max())
)
test_new = cust_group_by_work_projected.hvplot(x='complaint_type', y='Count', groupby=['RBU','complaint_type'], hover_cols=['ddate'], legend=False)
test_date = test_new.apply.select(ddate=date_range_slider.param.value)
hv_panel = pn.panel(test_new)
hv_panel[1][0].append(date_range_slider)
hv_panel
Basically we construct the object but do not yet group by ‘ddate’, we then use .apply.select
to apply the date selection to the object and then add the date range widget to the layout returned by panel. Hope that makes some sense.
i applied the code but the result is same
You have to remove the ‘ddate’ from the groupby: groupby=['RBU','complaint_type']
Compalints and RBU selection and date range selection perfectly working
in Notebook and panel .show option
but when i save it as html with following options
from bokeh.resources import INLINE
#hv.extension(‘bokeh’)
#panel_object = pn.pane.HoloViews(hv_panel)
hv_panel.save(‘Customer Complaints_Report55’, embed=True, resources=INLINE)
Compalints and RBU selection working but not date range selection in html
Are some JS script required in this case. Kindly guide.
Range selection won’t work when embedded because there isn’t a discrete number of states to embed. If you want it to work you will have to run a live bokeh server.