Help with manually resizing the canvas in my own javascript

Hi all,

I’m hoping someone can point me in the right direction, I may also have missed a section of documentation that covers this, apologies if that’s the case and a link would be gratefully received.

I want a separate action on my page to trigger a resize of the bokeh canvas.

The issue Setting plot_{width,height} doesn't work · Issue #1723 · bokeh/bokeh · GitHub mentions that `

`
Bokeh.Collections(‘Plot’).at(0).set(“plot_width”, 1000)

``

currently doesn’t work.

but @mattpap’s PR #1854, mention that it fixes this issue. However, I didn’t seem to be able to make the above code work on his PR branch.

So I’m wondering:

  • what I’m missing
  • what the workaround is for, say, 0.7.1
    Many thanks,

Sarah Bird

Hi,

···

On Wed, Feb 11, 2015 at 8:48 AM, Sarah Bird [email protected] wrote:

Hi all,

I’m hoping someone can point me in the right direction, I may also have missed a section of documentation that covers this, apologies if that’s the case and a link would be gratefully received.

I want a separate action on my page to trigger a resize of the bokeh canvas.

The issue https://github.com/bokeh/bokeh/issues/1723 mentions that `

`
Bokeh.Collections(‘Plot’).at(0).set(“plot_width”, 1000)

``

currently doesn’t work.

but @mattpap’s PR #1854, mention that it fixes this issue. However, I didn’t seem to be able to make the above code work on his PR branch.

So I’m wondering:

  • what I’m missing
  • what the workaround is for, say, 0.7.1

What browser do you use? Originally I tested fix to #1723 in Chrome and it works perfectly. Now I tested in Firefox and it sometimes works, sometimes fails miserably with “unknown constraint” or “unsatisfiable constraint” from our layout solver (kiwi.js). This needs more investigation. Let me know in the PR, so that we keep relevant discussion in one place.

If you want a workaround for 0.7.1, then basically you have to reimplement fix from [1], i.e. get the canvas object from a plot and call _set_dims([new_width, new_height]). No need to call any rendering functions, because _set_dims() will request render automatically.

[1] https://github.com/bokeh/bokeh/commit/8a4e2fd55c3a0eff027b5ab88cc877cec2e8cb5b

Mateusz

Many thanks,

Sarah Bird

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/3ad6ea9f-d25e-499c-8fb9-f5debe722bf6%40continuum.io.

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

Hi Mateusz,

Thanks so much for your response.

Now that PR #1854 has been merged, this is working for me on Chrome and FF on Ubuntu. Except, as you said, for the “unknown / unsatisfiable” thing which we can discuss on PR.

This is great.

Bird

···

On Tuesday, February 10, 2015 at 11:48:25 PM UTC-8, Sarah Bird wrote:

Hi all,

I’m hoping someone can point me in the right direction, I may also have missed a section of documentation that covers this, apologies if that’s the case and a link would be gratefully received.

I want a separate action on my page to trigger a resize of the bokeh canvas.

The issue https://github.com/bokeh/bokeh/issues/1723 mentions that `

`
Bokeh.Collections(‘Plot’).at(0).set(“plot_width”, 1000)

``

currently doesn’t work.

but @mattpap’s PR #1854, mention that it fixes this issue. However, I didn’t seem to be able to make the above code work on his PR branch.

So I’m wondering:

  • what I’m missing
  • what the workaround is for, say, 0.7.1
    Many thanks,

Sarah Bird