Closed MarcSkovMadsen closed 4 years ago
I'd moved it to HoloViews on purpose.
Ahh. I just saw that. Sorry.
I thought it was me being tired after all those efforts getting rangeXY working. So I thought I posted in wrong Repo.
A bit more detail on what your example looks like would be very helpful.
Ah sorry, I see you posted the file, sorry about that.
I see the issue, you are trying to create a widget from the RangeXY stream, is that intentional? Streams cannot currently be used that way, but I suppose we could change that.
Hi @philippjfr . The problem is I cannot find a reference example of how develop a reactive dashboard in Panel with
based on a parametrized class. All the examples only have the individual parts. So I don't know how they can work together. But I'm trying to make it work. But it's guess work.
How would I make rangeXY work? And why does it work in a notebook and not with panel serve
? If it works in the notebook it's natural to me think think i have a correct implementation.
Could you give me some kind of hint on how to solve this. I've spent maybe 8 hours now trying to get it working.
I think the next step for me would be to systematic go though the different tutorials of HoloViews, hvplot, streams, param and panel. Because I need to know them all in order to work efficiently with Panel. I just started out skimming the Panel docs, developing a bit, reading some more Panel docs and what I needed of the rest.
But there is actually a lot of concepts to understand and master before you can get things to work together. And how the different things work together is not yet that obvious to me. For example I have a feeling that I could implement a dashboard in HoloViews alone with a rangeXY stream. I could also develop it in Panel. But the two ways are different. So when I read the documentation of both I'm not yet cabable of understanding how things should be done the Panel way.
And I have a feeling that when I have this working I have the reference example of how all my dashboards would be implemented. They would just be variations of this with maybe more widgets, streams and plots/ tables in some cases.
Thanks
Okay this turns out not be your fault at all. It's a bug in Panel afterall. Just a quick tip though, you are declaring rangexy as a class attribute:
rangexy = hv.streams.RangeXY()
This isn't ideal because if you serve the app to multiple people they'll all share the same instance of RangeXY. I'd replace that with:
rangexy = param.ClassSelector(class_=hv.streams.RangeXY, default=hv.streams.RangeXY())
I'll push a fix for the bug in a second though.
Actually there also is a second issue, you are returning the x_range as part of the layout:
return pn.Column(
__doc__,
self.param.categories,
self.scatter_plot_view,
self.bar_chart_view,
self.rangexy,
sizing_mode="stretch_width",
)
This is problematic on the server because it ends up syncing the widget state back to Python and tries to edit the parameter. We need to make sure that it never tries to set stream parameter values.
Okay this turns out not be your fault at all. It's a bug in Panel afterall. Just a quick tip though, you are declaring rangexy as a class attribute:
rangexy = hv.streams.RangeXY()
This isn't ideal because if you serve the app to multiple people they'll all share the same instance of RangeXY. I'd replace that with:
rangexy = param.ClassSelector(class_=hv.streams.RangeXY, default=hv.streams.RangeXY())
I'll push a fix for the bug in a second though.
Thanks. Thats a level of detail I had not grasped. I guess I forgot because I have been working with Streamlit lately and there the python script is run on each change and not once by the server.
I actually thought the script was read/ evaluated once for each session. Now I learned its not.
And i'm so happy it was not my fault :-)
Actually there also is a second issue, you are returning the x_range as part of the layout:
return pn.Column( __doc__, self.param.categories, self.scatter_plot_view, self.bar_chart_view, self.rangexy, sizing_mode="stretch_width", )
This is problematic on the server because it ends up syncing the widget state back to Python and tries to edit the parameter. We need to make sure that it never tries to set stream parameter values.
Thanks. It was only there for testing purposes right now. Is should not be in there for the final version.
Thanks. Thats a level of detail I had not grasped. I guess I forgot because I have been working with Streamlit lately and there the python script is run on each change and not once by the server.
Actually I'm wrong about that if you run it with panel serve
or bokeh serve
it is indeed reevaluated.
@philippjfr . I've tested the new master and it works and the rangeXY works and no exceptions are raised.
But just for your info. The log shows entries like
2019-12-18 19:20:40,377 Cannot apply patch to 3107 which is not in the document anymore
You've previously told me I should just ignore them. So I will.
Thanks for the help.
I really wish I could do something about those warnings easily. They are indeed totally harmless but somewhat disconcerting nonetheless.
Hi
I'm trying to make a reactive dashboard. I now have my dashboard working great in a Jupyter Notebook. But when I run it via 'panel serve' it raises the below 'exception'.
Maybe it's me that misunderstands something. I've tried many different ways of implementing this as cannot find a reference example.
I've attached the source code, notebook and data.
issue_rangexy.zip
and a small video that shows it works fine in the notebook. But when you start interacting with panel serve it raises the exception.