Creating a custom TickFormatter, getting "model not registered before first usage"

Hi,

As suggested by Bryan in a GH topic (desired_num_ticks not working when using custom x_range · Issue #3193 · bokeh/bokeh · GitHub), I’m trying to build a custom TickFormatter. My goal is to plot financial times series with “broken” x axis (that is, the series has gaps on weekends and holidays which I wish not to be plotted, which is currently impossible with the Datetime plot).

I cloned & compiled the dev repo just fine. However, I’m having some issues defining a new TickFormatter. I just copied and pasted the PrintfTickFormatter class and the corresponding coffeescript file and renamed the copied code as “DateGapTickFormatter”. This is the JS console output when I try instantiating the new TickFormatter:

Module `DateGapTickFormatter’ does not exists. The problem may be two fold. Either a model was requested that’s available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn’t registered before first usage.

Is there anything else I need to do besides defining the TickFormatter class and the coffeescript?

Hi,

···

On Sun, Nov 29, 2015 at 4:14 PM, [email protected] wrote:

Hi,

As suggested by Bryan in a GH topic (https://github.com/bokeh/bokeh/issues/3193), I’m trying to build a custom TickFormatter. My goal is to plot financial times series with “broken” x axis (that is, the series has gaps on weekends and holidays which I wish not to be plotted, which is currently impossible with the Datetime plot).

I cloned & compiled the dev repo just fine. However, I’m having some issues defining a new TickFormatter. I just copied and pasted the PrintfTickFormatter class and the corresponding coffeescript file and renamed the copied code as “DateGapTickFormatter”. This is the JS console output when I try instantiating the new TickFormatter:

Module `DateGapTickFormatter’ does not exists. The problem may be two fold. Either a model was requested that’s available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn’t registered before first usage.

Is there anything else I need to do besides defining the TickFormatter class and the coffeescript?

yes, you have to add appropriate entry to bokehjs/src/coffee/common/base.coffee (you should easily see the pattern there). However, I recommend to follow the other Brian’s advice and try to use our new custom models machinery (as described in the issue).

Mateusz

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/19584812-2de1-4483-a073-cb6e36fbd1a2%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.