Bokeh ohlc example

hi,

I am fairly new to Bokeh and like the ohlc chart in

I can view it bokeh serve --show filename.py

and displays correctly on localhost on the browser.

To be of practical use, I need to be able to write it to a html file.

I appended at the very end

curdoc().add_root(column(row(mean, stddev, mavg), gridplot([[p], [p2]], toolbar_location=“left”, plot_width=1000)))

curdoc().add_periodic_callback(update, 50)

curdoc().title = “OHLC”

output_file(“ohlc.html”, title=‘Bokeh Plot’)

show§ # open a browser

but that give the warnings on ipython

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘f15802fe-2e71-4aef-b723-395ec45b4561’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘88eb5180-7a62-448c-b882-837f030a8e53’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘3e15395f-c45e-4b08-80ce-0506fd6b9133’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘eac46c35-e790-4998-a1e0-16d4afeef9ee’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘288e94bf-a9cb-410f-9b4d-ea01f2da5f26’, …)

While I seem to understand the warning, I am not able to figure as how to fix it. Any help appreciated.

Thank you.

Hi,

Bokeh server applications cannot function as standalone HTML files. The rely on real python code, which a browser has no way to execute. They must be run and deployed on a Bokeh server. You can either:

* run a separate Bokeh server (or multiple behind a load balancer if necessary to scale) and embed the app in web pages you serve with other web servers, using functions like "server_document". This is similar to how the demos at https://demo.bokehplots.com/ are deployed.

* embed the bokeh server programmatically into Flask, etc. as a library, following this User's Guide section:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library

Both methods have their advantages and disadvantages. In any case I'd suggest studying the User's Guide regarding what the Bokeh server is and how it works:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html

If running a Bokeh server is not an option, then you will be limited to only JS callbacks, e.g. CustomJS, etc. Anything that requires running real python code also requires a Bokeh server (it is the thing that runs the code).

Thanks,

Bryan

···

On Nov 28, 2017, at 22:33, VT Sol <[email protected]> wrote:

hi,

I am fairly new to Bokeh and like the ohlc chart in
https://github.com/bokeh/bokeh/blob/master/examples/app/ohlc/main.py

I can view it bokeh serve --show filename.py

and displays correctly on localhost on the browser.

To be of practical use, I need to be able to write it to a html file.

I appended at the very end
curdoc().add_root(column(row(mean, stddev, mavg), gridplot([[p], [p2]], toolbar_location="left", plot_width=1000)))
curdoc().add_periodic_callback(update, 50)
curdoc().title = "OHLC"

output_file("ohlc.html", title='Bokeh Plot')
show(p) # open a browser

but that give the warnings on ipython

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id='f15802fe-2e71-4aef-b723-395ec45b4561', ...)
W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id='88eb5180-7a62-448c-b882-837f030a8e53', ...)
W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id='3e15395f-c45e-4b08-80ce-0506fd6b9133', ...)
W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id='eac46c35-e790-4998-a1e0-16d4afeef9ee', ...)
W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id='288e94bf-a9cb-410f-9b4d-ea01f2da5f26', ...)

While I seem to understand the warning, I am not able to figure as how to fix it. Any help appreciated.

Thank you.

--
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/eb37ab90-c546-498d-aca6-cf4a387211a1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thank you for the detailed reply, will look into it. it is a bit of a learning curve since i am new to Bokeh.

Cheers.

···

On Wednesday, November 29, 2017 at 5:33:05 PM UTC+13, VT Sol wrote:

hi,

I am fairly new to Bokeh and like the ohlc chart in

https://github.com/bokeh/bokeh/blob/master/examples/app/ohlc/main.py

I can view it bokeh serve --show filename.py

and displays correctly on localhost on the browser.

To be of practical use, I need to be able to write it to a html file.

I appended at the very end

curdoc().add_root(column(row(mean, stddev, mavg), gridplot([[p], [p2]], toolbar_location=“left”, plot_width=1000)))

curdoc().add_periodic_callback(update, 50)

curdoc().title = “OHLC”

output_file(“ohlc.html”, title=‘Bokeh Plot’)

show§ # open a browser

but that give the warnings on ipython

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘f15802fe-2e71-4aef-b723-395ec45b4561’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘88eb5180-7a62-448c-b882-837f030a8e53’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘3e15395f-c45e-4b08-80ce-0506fd6b9133’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘eac46c35-e790-4998-a1e0-16d4afeef9ee’, …)

W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘288e94bf-a9cb-410f-9b4d-ea01f2da5f26’, …)

While I seem to understand the warning, I am not able to figure as how to fix it. Any help appreciated.

Thank you.