Migrating an existing app from javascript plotting library to bokeh

I just started with Bokeh and looked at the docs but couldn’t really figure this out easily.

I have an existing application. Uses angularJS with Java Spring backend. The plotting is done by getting the data via REST request from the backend and uses a JS plotting library nvd3 to plot it. In short, we hate this plotting library and are looking for a better option. The data being plot is actually created with python and is soon going to be sent to the client through a Flask app in development. Currently the data is created in batch, loaded into a database and served up by Spring.

How could we replace our js plotting library with Bokeh?

Would we change our Flask app to return javascript instead of the actual data? Actually the app needs the data for other purposes as well (e.g. a table).

Does this require running bokeh server separately from Flask? Can we just embed the result of the call somehow?

Imagine this as something like an app that gives you a text box for you to type a ticker symbol and a few other parameters and get back both the data you want and a plot made from bokeh.

What’s the easiest way to do this? We don’t really want to use python for anything more than serving up data or a plot. That is, we’re not going to serve up an html page using Flask as the page is already created using angularJS.

Hi Dave,

We actually just added the start of an AjaxDataSource, which allows static Bokeh plots (that don't require a bokeh-server) to pull data directly into the client. It's still lacking in some features, but it might be perfect for what you want (see https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/ajax_source.py\) . Another option is "hybrid" development, where you just use python to create all the models that comprise the plot, then do the actual plot updating in JS, on the client. Look at the spectrogram demo for an example of this (https://github.com/bokeh/bokeh/tree/master/examples/embed/spectrogram\)

That said, it's certainly possible to use the bokeh-server if that works better. The bokeh-server exposes a Flask Blueprint, so in principle you should be able to integrate it directly into another existing Flask app.

That said we would very much like to improve the "JS interface" to include things like Angular and React integrations. If that were to happen you would not necessarily need to use any python at all you could just use BokehJS client library directly. If helping guide this kind of effort interests you, please let us know.

Bryan

···

On Feb 23, 2015, at 6:16 PM, [email protected] wrote:

I just started with Bokeh and looked at the docs but couldn't really figure this out easily.

I have an existing application. Uses angularJS with Java Spring backend. The plotting is done by getting the data via REST request from the backend and uses a JS plotting library nvd3 to plot it. In short, we hate this plotting library and are looking for a better option. The data being plot is actually created with python and is soon going to be sent to the client through a Flask app in development. Currently the data is created in batch, loaded into a database and served up by Spring.

How could we replace our js plotting library with Bokeh?

Would we change our Flask app to return javascript instead of the actual data? Actually the app needs the data for other purposes as well (e.g. a table).

Does this require running bokeh server separately from Flask? Can we just embed the result of the call somehow?

Imagine this as something like an app that gives you a text box for you to type a ticker symbol and a few other parameters and get back both the data you want and a plot made from bokeh.

What's the easiest way to do this? We don't really want to use python for anything more than serving up data or a plot. That is, we're not going to serve up an html page using Flask as the page is already created using angularJS.

--
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/6453cf06-b980-43c1-908b-85f7c02c352e%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks Bryan,
That spectrogram example shows you how to do this if you are using Flask or some web app that writes html directly. Our app uses angular so the backend only serves up static html and angular handles the tempting. So I can’t create the div dynamically on the backend or hardcode the javascript to make the plot. I need to fetch the javascript dynamically when the user changes the widgets and somehow run this. Any idea how I would do that?

Dave

···

On Tuesday, February 24, 2015 at 9:47:51 PM UTC-5, Bryan Van de ven wrote:

Hi Dave,

We actually just added the start of an AjaxDataSource, which allows static Bokeh plots (that don’t require a bokeh-server) to pull data directly into the client. It’s still lacking in some features, but it might be perfect for what you want (see https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/ajax_source.py) . Another option is “hybrid” development, where you just use python to create all the models that comprise the plot, then do the actual plot updating in JS, on the client. Look at the spectrogram demo for an example of this (https://github.com/bokeh/bokeh/tree/master/examples/embed/spectrogram)

That said, it’s certainly possible to use the bokeh-server if that works better. The bokeh-server exposes a Flask Blueprint, so in principle you should be able to integrate it directly into another existing Flask app.

That said we would very much like to improve the “JS interface” to include things like Angular and React integrations. If that were to happen you would not necessarily need to use any python at all you could just use BokehJS client library directly. If helping guide this kind of effort interests you, please let us know.

Bryan

On Feb 23, 2015, at 6:16 PM, [email protected] wrote:

I just started with Bokeh and looked at the docs but couldn’t really figure this out easily.

I have an existing application. Uses angularJS with Java Spring backend. The plotting is done by getting the data via REST request from the backend and uses a JS plotting library nvd3 to plot it. In short, we hate this plotting library and are looking for a better option. The data being plot is actually created with python and is soon going to be sent to the client through a Flask app in development. Currently the data is created in batch, loaded into a database and served up by Spring.

How could we replace our js plotting library with Bokeh?

Would we change our Flask app to return javascript instead of the actual data? Actually the app needs the data for other purposes as well (e.g. a table).

Does this require running bokeh server separately from Flask? Can we just embed the result of the call somehow?

Imagine this as something like an app that gives you a text box for you to type a ticker symbol and a few other parameters and get back both the data you want and a plot made from bokeh.

What’s the easiest way to do this? We don’t really want to use python for anything more than serving up data or a plot. That is, we’re not going to serve up an html page using Flask as the page is already created using angularJS.


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/6453cf06-b980-43c1-908b-85f7c02c352e%40continuum.io.

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

Hi Dave,

I think I’m doing a version of what you’re asking, but I’m working in django. I’ll be publishing a code examples in the coming weeks. But things are crazy hectic right now.

But if you can get by on a breadcrumb: I’ve made my own versions of the templates that are here: https://github.com/bokeh/bokeh/tree/master/bokeh/_templates

I also adapted: https://github.com/bokeh/bokeh/blob/master/bokeh/pluginutils.py

as described here: https://github.com/bokeh/bokeh/issues/1992 (ignore most of the issue, see the method def app_document_new_doc)

Hope this helps,

Bird

···

On Wed, Feb 25, 2015 at 5:27 PM, [email protected] wrote:

Thanks Bryan,
That spectrogram example shows you how to do this if you are using Flask or some web app that writes html directly. Our app uses angular so the backend only serves up static html and angular handles the tempting. So I can’t create the div dynamically on the backend or hardcode the javascript to make the plot. I need to fetch the javascript dynamically when the user changes the widgets and somehow run this. Any idea how I would do that?

Dave

On Tuesday, February 24, 2015 at 9:47:51 PM UTC-5, Bryan Van de ven wrote:

Hi Dave,

We actually just added the start of an AjaxDataSource, which allows static Bokeh plots (that don’t require a bokeh-server) to pull data directly into the client. It’s still lacking in some features, but it might be perfect for what you want (see https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/ajax_source.py) . Another option is “hybrid” development, where you just use python to create all the models that comprise the plot, then do the actual plot updating in JS, on the client. Look at the spectrogram demo for an example of this (https://github.com/bokeh/bokeh/tree/master/examples/embed/spectrogram)

That said, it’s certainly possible to use the bokeh-server if that works better. The bokeh-server exposes a Flask Blueprint, so in principle you should be able to integrate it directly into another existing Flask app.

That said we would very much like to improve the “JS interface” to include things like Angular and React integrations. If that were to happen you would not necessarily need to use any python at all you could just use BokehJS client library directly. If helping guide this kind of effort interests you, please let us know.

Bryan

On Feb 23, 2015, at 6:16 PM, [email protected] wrote:

I just started with Bokeh and looked at the docs but couldn’t really figure this out easily.

I have an existing application. Uses angularJS with Java Spring backend. The plotting is done by getting the data via REST request from the backend and uses a JS plotting library nvd3 to plot it. In short, we hate this plotting library and are looking for a better option. The data being plot is actually created with python and is soon going to be sent to the client through a Flask app in development. Currently the data is created in batch, loaded into a database and served up by Spring.

How could we replace our js plotting library with Bokeh?

Would we change our Flask app to return javascript instead of the actual data? Actually the app needs the data for other purposes as well (e.g. a table).

Does this require running bokeh server separately from Flask? Can we just embed the result of the call somehow?

Imagine this as something like an app that gives you a text box for you to type a ticker symbol and a few other parameters and get back both the data you want and a plot made from bokeh.

What’s the easiest way to do this? We don’t really want to use python for anything more than serving up data or a plot. That is, we’re not going to serve up an html page using Flask as the page is already created using angularJS.


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/6453cf06-b980-43c1-908b-85f7c02c352e%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/e16b4ea5-6361-4a3d-8476-c39e70596619%40continuum.io.

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