How to link my backend bokeh plots to an angular 4 front end, DYNAMICALLY

I have a front end(angular 4 based) viewed by my customers. They want to see a bunch of different plots that could be dynamically plotted. For ex: for a date time based line chart they could want to see visualizations on a 7 day or 8 day or 365 day period. I compute my data in Pandas and pass it onto a bokeh plot. The problem arises, when I have to push this to the front end.

One way I understood this could be done is through using the components function https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html. Where the static javascript could be embedded on the front end, and then a very very long json(json_docs) could be passed onto the front end. But this would mean i would need to build an API to parse and send it.

I have tried understanding the bokeh server thing with no luck. So any examples would definitely help more.

  1. Is there any way to dynamically compute using pandas, plot and then send the plot to a angular 4 front end, with callbacks ?

  2. If so, is there a way to do it within bokeh itself ? Not having to deal with django, or flask API.

  3. Lastly, is there any easier way to do this ? Having unnecessary code would mean more chance of errors and breakdowns.

Hi Rags, see in the Answer you asked from Stackoverflow, the proposed answer seems to be exactly your solution to all of the answers!

ยทยทยท

Am Samstag, 21. April 2018 22:01:00 UTC+2 schrieb Rags Gupta:

I have a front end(angular 4 based) viewed by my customers. They want to see a bunch of different plots that could be dynamically plotted. For ex: for a date time based line chart they could want to see visualizations on a 7 day or 8 day or 365 day period. I compute my data in Pandas and pass it onto a bokeh plot. The problem arises, when I have to push this to the front end.

One way I understood this could be done is through using the components function https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html. Where the static javascript could be embedded on the front end, and then a very very long json(json_docs) could be passed onto the front end. But this would mean i would need to build an API to parse and send it.

I have tried understanding the bokeh server thing with no luck. So any examples would definitely help more.

  1. Is there any way to dynamically compute using pandas, plot and then send the plot to a angular 4 front end, with callbacks ?
  1. If so, is there a way to do it within bokeh itself ? Not having to deal with django, or flask API.
  1. Lastly, is there any easier way to do this ? Having unnecessary code would mean more chance of errors and breakdowns.