On Apr 10, 2017, at 09:12, Mateusz Paprocki <mpaprocki@continuum.io> wrote:
Hi,
On Mon, Apr 10, 2017 at 11:00 AM, <lukas.schrangl@tuwien.ac.at> wrote:
Hi,
I want to subclass ColumnDataSource. However, when trying to use this source for plotting (in a jupyter notebook), I get
Javascript error adding output!
Error: Model `NbColumnDataSource' does not exist. This could be due to a widget or a custom model not being registered before first usage.
See your browser Javascript console for more details.
The subclass definition is as simple as possible (for now),
class NbColumnDataSource(bokeh.models.ColumnDataSource):
pass
Is there a trick to subclassing? When looking at the source code for the source included in bokeh I colud not see one…
every model in bokeh has to have a corresponding model implementation in bokehjs. You can override this behavior by implementing NbColumnDataSource as:
class NbColumnDataSource(bokeh.models.ColumnDataSource):
__subtype__ = "NbColumnDataSource"
__view_model__ = "ColumnDataSource"
...
This is how e.g. Figure model is implemented (see bokeh.plotting.figure). I'm pretty sure you won't be able to add new properties to a model if it's implemented like this.
Mateusz
Best,
Lukas
--
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/a3a230d8-f565-4992-9ce2-caa0dfdd9caa%40continuum.io\.
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/CANFzp8guzaMXNdap%2BXjrdaz-JDVRN_Aq_%2BiK8ekdBQJ3pyYEJw%40mail.gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.