Creating a ImageURL in BokehJS

I have been trying to create a ImageURL in JavaScript, as follows:

var star = Bokeh.ImageURL({url: ‘http://bokeh.pydata.org/en/latest/_static/images/logo.png’, x: 5, y: 10, w: 20, h: 20, anchor: ‘center’})

As far as I can tell, this follows the conventions of translating keyword arguments from Python to JS.

Using the latest BokehJS library, 0.12.5, I get the error:

Uncaught TypeError: this.setv is not a function

at Object.HasProps (has_props.js:145)

at Object.Model (model.js:15)

at Object.Glyph (glyph.js:315)

at Object.ImageURL (image_url.js:199)

at eval (eval at HasProps (has_props.js:144), <anonymous>:1:18)

at Object.HasProps (has_props.js:144)

at Object.Model (model.js:15)

at Object.Glyph (glyph.js:315)

at Object.ImageURL (image_url.js:199)

When I break in the function HasProps, indeed no setv function exists (this points to window.Bokeh). I am unsure if this is because I called it wrong or for some other error.

Thanks for any help!

Doh, I was so busy focusing on translating from Python to JS directly I forgot new! Haha :slight_smile:

···

On Tuesday, 16 May 2017 06:26:41 UTC-7, Dominic Kuang wrote:

I have been trying to create a ImageURL in JavaScript, as follows:

var star = Bokeh.ImageURL({url: ‘http://bokeh.pydata.org/en/latest/_static/images/logo.png’, x: 5, y: 10, w: 20, h: 20, anchor: ‘center’})

As far as I can tell, this follows the conventions of translating keyword arguments from Python to JS.

Using the latest BokehJS library, 0.12.5, I get the error:

Uncaught TypeError: this.setv is not a function

at Object.HasProps (has_props.js:145)
at Object.Model (model.js:15)
at Object.Glyph (glyph.js:315)
at Object.ImageURL (image_url.js:199)
at eval (eval at HasProps (has_props.js:144), <anonymous>:1:18)
at Object.HasProps (has_props.js:144)
at Object.Model (model.js:15)
at Object.Glyph (glyph.js:315)
at Object.ImageURL (image_url.js:199)

When I break in the function HasProps, indeed no setv function exists (this points to window.Bokeh). I am unsure if this is because I called it wrong or for some other error.

Thanks for any help!

Hi,

···

On Tue, May 16, 2017 at 6:12 PM, [email protected] wrote:

Doh, I was so busy focusing on translating from Python to JS directly I forgot new! Haha :slight_smile:

forgetting new is a very common and annoying mistake. I think it’s possible to throw an error if object is constructed without new, but we take advantage of Bokeh.Model(...) syntax in a few places, e.g. in Range1d(start, end) which produces new Range1d({start: start, end: end}).

Mateusz

On Tuesday, 16 May 2017 06:26:41 UTC-7, Dominic Kuang wrote:

I have been trying to create a ImageURL in JavaScript, as follows:

var star = Bokeh.ImageURL({url: ‘http://bokeh.pydata.org/en/latest/_static/images/logo.png’, x: 5, y: 10, w: 20, h: 20, anchor: ‘center’})

As far as I can tell, this follows the conventions of translating keyword arguments from Python to JS.

Using the latest BokehJS library, 0.12.5, I get the error:

Uncaught TypeError: this.setv is not a function

at Object.HasProps (has_props.js:145)
at Object.Model (model.js:15)
at Object.Glyph (glyph.js:315)
at Object.ImageURL (image_url.js:199)
at eval (eval at HasProps (has_props.js:144), <anonymous>:1:18)
at Object.HasProps (has_props.js:144)
at Object.Model (model.js:15)
at Object.Glyph (glyph.js:315)
at Object.ImageURL (image_url.js:199)

When I break in the function HasProps, indeed no setv function exists (this points to window.Bokeh). I am unsure if this is because I called it wrong or for some other error.

Thanks for any help!

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/68f87158-a18c-4716-a8ee-5e310f22c149%40continuum.io.

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