On Aug 1, 2018, at 06:05, 'omearac' via Bokeh Discussion - Public <bokeh@continuum.io> wrote:
I'm seeing the same bug, however it totally broke all my callbacks and they don't work anymore. Furthermore the fix suggested by matpap here: Error message on the browser console when using CustomJS with args in serve mode · Issue #7970 · bokeh/bokeh · GitHub to simply remove the args parameter in the CustomJS callback is totally useless if you're passing various other Bokeh objects (such as other plot objects to be changed) and dont just want to chanhe properties of the cb_obj.
I upgraded from 0.12.15 because of the bug where the DataTable cannot be edited because of a comment Bryan made saying many bugs have been fixed for the tables since May.
Honestly this should be high priority on the bugfix issues since CustomJS callbacks are one of the maain features which makes Bokeh (imo) interesting and usable for any type of user interaction.
On Sunday, July 29, 2018 at 11:21:22 PM UTC+2, Angelo Fausti Neto wrote:
Thanks Bryan, the bug is not critical, I mean despite the error message everything else works. I can live with that for the moment. Is there a procedure to link this thread with the github issue?
Best,
> On Jul 29, 2018, at 1:06 PM, Bryan Van de ven <bry...@anaconda.com> wrote:
>
> Hi,
>
> I agrees that appears to be the same bug. I don't have any workarounds to offer you at the moment, except perhaps to try other older versions of Bokeh which might not have the bug.
>
> Thanks,
>
> Bryan
>
>> On Jul 28, 2018, at 21:39, Angelo Fausti <angelo...@gmail.com> wrote:
>>
>>
>> Update: I think what I am seeing
>>
>> document.js:412 Uncaught Error: reference {"id":"58779667-2eb0-40c1-ab52-d3b1928cd2a0","type":"Div"} isn't known (not in Document?)
>>
>> is related to this issue
>>
>> Error message on the browser console when using CustomJS with args in serve mode · Issue #7970 · bokeh/bokeh · GitHub
>>
>> and similar errors are seen in the js_events.py example at https://github.com/bokeh/bokeh/blob/master/examples/howto/
>>
>> Anyways, the code to reproduce it is:
>>
>> from bokeh.io import curdoc
>> from bokeh.plotting import figure
>> from bokeh.models.callbacks import CustomJS
>> from bokeh.models.widgets import Div
>> from bokeh.layouts import widgetbox, column
>>
>> title = Div(text="")
>>
>> plot = figure()
>>
>> callback = CustomJS(args={'title': title}, code="""title.text='Reset event ocurred.'""")
>>
>> plot.js_on_event('reset', callback)
>>
>> layout = column(widgetbox(title), plot)
>>
>> curdoc().add_root(layout)
>>
>> Run as
>>
>> bokeh serve \-\-log\-level debug app\.py
>>
>> with bokeh 0\.13\.0
>>
>> thanks,
>>
>> Angelo Fausti
>>
>>
>>> On Thu, Jul 26, 2018 at 6:50 PM, Angelo Fausti <angelo\.\.\.@gmail\.com> wrote:
>>>
>>> So, the error I had before
>>>
>>> document\.js:412 Uncaught Error: reference \{"id":"58779667\-2eb0\-40c1\-ab52\-d3b1928cd2a0","type":"Div"\} isn't known \(not in Document?\)
>>>
>>> happens at
>>>
>>> plot\.js\_on\_event\('reset', callback\)
>>>
>>> as the message suggests I tried to configure the callback after adding the Div widget to the bokeh document, like this:
>>>
>>> from bokeh\.io import curdoc
>>> from bokeh\.plotting import figure
>>> from bokeh\.models\.callbacks import CustomJS
>>> from bokeh\.models\.widgets import Div
>>> from bokeh\.layouts import widgetbox, column
>>>
>>> title = Div\(text=""\)
>>>
>>> plot = figure\(\)
>>>
>>> callback = CustomJS\(args=\{'title': title\}, code="""title\.text='Reset event ocurred\.'"""\)
>>>
>>> layout = column\(widgetbox\(title\), plot\)
>>>
>>> curdoc\(\)\.add\_root\(layout\)
>>>
>>> plot\.js\_on\_event\('reset', callback\) \# moved this line to here
>>>
>>>
>>> But then I get another error in the JS console:
>>>
>>> connection\.js:178 \[bokeh\] Failed to repull session Error: reference \{"id":"338aa405\-4f2e\-4292\-b044\-a63141bd2c38","type":"CustomJS"\} isn't known \(not in Document?\)
>>>
>>> and this time the app does not show up in the browser\.
>>>
>>> In both cases I'm running the server with \-\-log\-level debug but there's nothing in the bokeh server logs\.
>>>
>>> bokeh serve --log-level debug app.py
>>>
>>> I would appreciate any help to understand what is going on.
>>>
>>> thanks,
>>>
>>> Angelo Fausti
>>>
>>>
>>>> On Fri, Jul 20, 2018 at 5:03 PM, Angelo Fausti <angelo...@gmail.com> wrote:
>>>>
>>>>
>>>> So, the following code works, I managed to update the Div text property when the plot reset tool is used. But I am getting this error in the JS console:
>>>>
>>>> document.js:412 Uncaught Error: reference {"id":"58779667-2eb0-40c1-ab52-d3b1928cd2a0","type":"Div"} isn't known (not in Document?)
>>>>
>>>> why is that?
>>>>
>>>>
>>>> from bokeh.io import curdoc
>>>> from bokeh.plotting import figure
>>>> from bokeh.models.callbacks import CustomJS
>>>> from bokeh.models.widgets import Div
>>>> from bokeh.layouts import widgetbox, column
>>>>
>>>> title = Div(text="")
>>>>
>>>> plot = figure()
>>>>
>>>> callback = CustomJS(args={'title': title}, code="""title.text='Reset event ocurred.'""")
>>>>
>>>> plot.js_on_event('reset', callback)
>>>>
>>>> layout = column(widgetbox(title), plot)
>>>>
>>>> curdoc().add_root(layout)
>>>>
>>>> I would like to do something similar in my bokeh application that's why I am running with bokeh server.
>>>>
>>>> Bokeh version 0.13.0
>>>>
>>>> thanks,
>>>>
>>>> Angelo Fausti
>>>>
>>>>
>>>>> On Fri, Jul 20, 2018 at 2:51 PM, Angelo Fausti <angelo...@gmail.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have CustomJS calback attached to a datasource that I use to recompute an average whenever the selection changes.
>>>>>
>>>>> http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#customjs-for-model-property-events
>>>>>
>>>>> self.pcircle.data_source.on_change('selected', self.calculate_avg_temp)
>>>>>
>>>>> def calculate_avg_temp(self, attr, old, new):
>>>>> index = new['1d']['indices']
>>>>> if len(index) == 0:
>>>>> return
>>>>> index.sort()
>>>>> self.update_ave_temp(np.mean(np.array(self.cds.data['temperatures'])[index]))
>>>>>
>>>>>
>>>>> and it works fine.
>>>>>
>>>>>
>>>>> Then I would like to clear the selection and reset the average value.
>>>>>
>>>>> Can I use a CustomJS callback for the plot reset tool? is there an example for that? or do you recommend another method.
>>>>>
>>>>> thank you,
>>>>>
>>>>> Angelo Fausti
>>>>>
>>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
>> To post to this group, send email to bo...@continuum.io.
>> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAD%3DOK5OZxsQjBV9Jo-KyGXE5cpRMu%3DyXb5mkQ%3Dj9oA63YM-nKw%40mail.gmail.com\.
>> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/A8335B6B-9E47-471C-A703-C298919206A6%40anaconda.com\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e7e2197c-f834-4e58-9002-536b5c443539%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.