Change axis range of a bokeh plot in javascript

Hallo!

I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.

I was able to add a callback to my plot, so that I can get the current range in javascript:

callback for x range change

myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""

var start = xrange.get(“start”)

var end = xrange.get(“end”)

“”")
Is there a way, how I can change the range of this plot now in javascript?
I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.

Thanks for any hints or pointers to the relevant documentation!
LG
Georg

Hi Georg,

BokehJS models are Backbone models. So in addition to the .get method, they have a corresponding .set method to set the values, e.g.:

  xrange.set("start", 10)

or

  xrange.set({"start": 10, "end": 20})

Thanks,

Bryan

···

On Dec 21, 2015, at 6:37 AM, Georg Holzmann <[email protected]> wrote:

Hallo!

I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.

I was able to add a callback to my plot, so that I can get the current range in javascript:

# callback for x range change
myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""
  var start = xrange.get("start")
  var end = xrange.get("end")
""")

Is there a way, how I can change the range of this plot now in javascript?
I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.

Thanks for any hints or pointers to the relevant documentation!
LG
Georg

--
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/e592b0d4-d8cc-4110-b9f5-a6a4c0beed78%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hallo Bryan!

Thanks a lot, that worked! It seems that I always tried the wrong syntax :wink:

Thanks to all of you for your great work on bokeh!
LG
Georg

···

On Tuesday, December 29, 2015 at 12:12:02 AM UTC+1, Bryan Van de ven wrote:

Hi Georg,

BokehJS models are Backbone models. So in addition to the .get method, they have a corresponding .set method to set the values, e.g.:

    xrange.set("start", 10)

or

    xrange.set({"start": 10, "end": 20})

Thanks,

Bryan

On Dec 21, 2015, at 6:37 AM, Georg Holzmann [email protected] wrote:

Hallo!

I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.

I was able to add a callback to my plot, so that I can get the current range in javascript:

callback for x range change

myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""

var start = xrange.get(“start”)

var end = xrange.get(“end”)

“”")

Is there a way, how I can change the range of this plot now in javascript?

I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.

Thanks for any hints or pointers to the relevant documentation!

LG

Georg


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/e592b0d4-d8cc-4110-b9f5-a6a4c0beed78%40continuum.io.

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

Georg,

I am glad it worked! We really ought to have this documented better. If you have the time an inclination, a pull request to add some info about using Backbone objected in the context of Bokeh callbacks would certainly be welcome. (But I also understand not everyone has the time or inclination!)

Thanks,

Bryan

···

On Dec 29, 2015, at 3:12 AM, Georg Holzmann <[email protected]> wrote:

Hallo Bryan!

Thanks a lot, that worked! It seems that I always tried the wrong syntax :wink:

Thanks to all of you for your great work on bokeh!
LG
Georg

On Tuesday, December 29, 2015 at 12:12:02 AM UTC+1, Bryan Van de ven wrote:
Hi Georg,

BokehJS models are Backbone models. So in addition to the .get method, they have a corresponding .set method to set the values, e.g.:

        xrange.set("start", 10)

or

        xrange.set({"start": 10, "end": 20})

Thanks,

Bryan

> On Dec 21, 2015, at 6:37 AM, Georg Holzmann <[email protected]> wrote:
>
> Hallo!
>
> I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.
>
> I was able to add a callback to my plot, so that I can get the current range in javascript:
>
> # callback for x range change
> myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""
> var start = xrange.get("start")
> var end = xrange.get("end")
> """)
>
> Is there a way, how I can change the range of this plot now in javascript?
> I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.
>
> Thanks for any hints or pointers to the relevant documentation!
> LG
> Georg
>
> --
> 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/e592b0d4-d8cc-4110-b9f5-a6a4c0beed78%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 [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/8c146650-ca7f-4e31-85c7-3ef2497a9c5b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hallo Bryan!

I have not used Backbone before, that’s why I did not guess the right syntax.

Is there any possibility to auto-generate docs for the Javascript interface? (like it is done with python docstrings, doxygen, etc.)
Because it is not so easy for new users to contribute documentation for the underlying coffeescript/backbone/etc. code … I would be happy to contribute docs and code when I have more experience with bokeh!

LG

Georg

···

On Tuesday, December 29, 2015 at 6:05:49 PM UTC+1, Bryan Van de ven wrote:

Georg,

I am glad it worked! We really ought to have this documented better. If you have the time an inclination, a pull request to add some info about using Backbone objected in the context of Bokeh callbacks would certainly be welcome. (But I also understand not everyone has the time or inclination!)

Thanks,

Bryan

On Dec 29, 2015, at 3:12 AM, Georg Holzmann [email protected] wrote:

Hallo Bryan!

Thanks a lot, that worked! It seems that I always tried the wrong syntax :wink:

Thanks to all of you for your great work on bokeh!

LG

Georg

On Tuesday, December 29, 2015 at 12:12:02 AM UTC+1, Bryan Van de ven wrote:

Hi Georg,

BokehJS models are Backbone models. So in addition to the .get method, they have a corresponding .set method to set the values, e.g.:

    xrange.set("start", 10)

or

    xrange.set({"start": 10, "end": 20})

Thanks,

Bryan

On Dec 21, 2015, at 6:37 AM, Georg Holzmann [email protected] wrote:

Hallo!

I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.

I was able to add a callback to my plot, so that I can get the current range in javascript:

callback for x range change

myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""
var start = xrange.get(“start”)
var end = xrange.get(“end”)
“”")

Is there a way, how I can change the range of this plot now in javascript?
I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.

Thanks for any hints or pointers to the relevant documentation!
LG
Georg


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/e592b0d4-d8cc-4110-b9f5-a6a4c0beed78%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 [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/8c146650-ca7f-4e31-85c7-3ef2497a9c5b%40continuum.io.

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

Hi Georg,

That's a good instinct, and it may be possible to do so from the JS direcly. However I will mention that one of or medium-term priorities is to bring the python and JS libraries into complete alignment. Once that is done, the public JS models would have only and exactly the same attributes as the python models. At that point we could derive JS docs (using python tools) from the python models very easily.

Bryan

···

On Dec 30, 2015, at 2:44 AM, Georg Holzmann <[email protected]> wrote:

Hallo Bryan!

I have not used Backbone before, that's why I did not guess the right syntax.
Is there any possibility to auto-generate docs for the Javascript interface? (like it is done with python docstrings, doxygen, etc.)
Because it is not so easy for new users to contribute documentation for the underlying coffeescript/backbone/etc. code ... I would be happy to contribute docs and code when I have more experience with bokeh!

LG
Georg

On Tuesday, December 29, 2015 at 6:05:49 PM UTC+1, Bryan Van de ven wrote:
Georg,

I am glad it worked! We really ought to have this documented better. If you have the time an inclination, a pull request to add some info about using Backbone objected in the context of Bokeh callbacks would certainly be welcome. (But I also understand not everyone has the time or inclination!)

Thanks,

Bryan

> On Dec 29, 2015, at 3:12 AM, Georg Holzmann <[email protected]> wrote:
>
> Hallo Bryan!
>
> Thanks a lot, that worked! It seems that I always tried the wrong syntax :wink:
>
> Thanks to all of you for your great work on bokeh!
> LG
> Georg
>
>
> On Tuesday, December 29, 2015 at 12:12:02 AM UTC+1, Bryan Van de ven wrote:
> Hi Georg,
>
> BokehJS models are Backbone models. So in addition to the .get method, they have a corresponding .set method to set the values, e.g.:
>
> xrange.set("start", 10)
>
> or
>
> xrange.set({"start": 10, "end": 20})
>
> Thanks,
>
> Bryan
>
> > On Dec 21, 2015, at 6:37 AM, Georg Holzmann <[email protected]> wrote:
> >
> > Hallo!
> >
> > I want to change the (x -) axis range of a bokeh plot in javascript, but could not find a way how to do that so far.
> >
> > I was able to add a callback to my plot, so that I can get the current range in javascript:
> >
> > # callback for x range change
> > myplot.x_range.callback = CustomJS(args=dict(xrange=myplot.x_range), code="""
> > var start = xrange.get("start")
> > var end = xrange.get("end")
> > """)
> >
> > Is there a way, how I can change the range of this plot now in javascript?
> > I tried to set various attributes on the xrange object above and searched through the documentation, but nothing worked so far.
> >
> > Thanks for any hints or pointers to the relevant documentation!
> > LG
> > Georg
> >
> > --
> > 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/e592b0d4-d8cc-4110-b9f5-a6a4c0beed78%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 [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/8c146650-ca7f-4e31-85c7-3ef2497a9c5b%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 [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/06436252-c84d-4339-b759-baa93e977294%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.