1👍
I’d recommend using the bokeh.embed module:
http://docs.bokeh.org/en/latest/docs/user_guide/embed.html#components
from bokeh.embed import components
script, div = components(pt)
Then you just have to insert the script and div into your html template.
Sarah Bird also gave a good talk on embedding Bokeh plots in Django apps at Pycon: (https://us.pycon.org/2015/schedule/presentation/369/)
- Can't seem to use optional foreign key relationships when creating new object using Django+AngularJS
0👍
Thank you. That worked!
in views.py
import pandas as pd
from bokeh.charts import Histogram
def stock_chart(request):
histo_xyvalues = pd.DataFrame(dict(normal=[1, 2, 3, 1], lognormal=[5, 4, 4, 1]))
hm = Histogram(histo_xyvalues, bins=5, title='Histogram' , width=300, height=300)
script, div = components(hm)
return HttpResponse(script+div)
in urls.py
...
url(r'^stock_chart/$', views.stock_chart, name="stock_chart"),
...
a call from javascript/jQuery is,
...
$.get('/stock_chart/', function(data){
$('#chart_area').append(data);
});
...
👤shaz
- My form with a ModelMultipleChoiceField is not saving data.
- Implementing automated tool through django based website
- Django ORM IF statement
Source:stackexchange.com