Hi Rizwan,
please refer to the source code below, if you have any technical problem, just post here. sorry for any delay.
fig_1 = figure(plot_width = 500, \
plot_height = 150, \
title = "Canada", \
toolbar_location = None)
y_list = [0.16, 0.67, 0.82, 0.10, 0.48]
LINE_COLOR = [“green” if c >= 0.7 else “red” for c in y_list]
fig_1.line([10, 20, 30, 40, 50], \
y_list, \
line_width = 2)
fig_1.circle([10, 20, 30, 40, 50], \
y_list, \
size = 8, \
fill_color = "white", \
line_width = 3, \
line_color = LINE_COLOR)
tabMain = Panel(title=‘Main’, child = fig_1)
tabMain.tags=[“MainTag”]
tabMain.name=“MainName”
fig_2 = figure(plot_width = 500, \
plot_height = 150, \
title = "Canada", \
toolbar_location = None)
y_list = [0.16, 0.67, 0.82, 0.10, 0.48]
LINE_COLOR = [“green” if c >= 0.7 else “red” for c in y_list]
fig_2.line([10, 20, 30, 40, 50], \
y_list, \
line_width = 2)
fig_2.circle([10, 20, 30, 40, 50], \
y_list, \
size = 8, \
fill_color = "white", \
line_width = 3, \
line_color = LINE_COLOR)
tabOverConnectionAnalysis = Panel(child = fig_2, title = ‘Over Connection Analysis’)
tabOverConnectionAnalysis.name=“OverConnectionAnalysisName”
tabOverConnectionAnalysis.tags=[“OverConnectionAnalysisTag”]
uHelper.tabs = Tabs(tabs = [tabMain, tabOverConnectionAnalysis], \
width= 1400, \
sizing_mode='scale_width')
tabs_row = row(uHelper.tabs)
tabs_row.sizing_mode = ‘scale_width’
main_row = row(tabs_row) # not necessary, just from real code
main_row.sizing_mode = ‘scale_width’
uHelper.main_row = main_row
uHelper.main_row.css_classes = [“mainrowlayout”]
uHelper.main_layout = layout(uHelper.main_row, sizing_mode = ‘scale_width’)
uHelper.main_layout.css_classes = [“mainlayout”]
doc.add_root(main_layout)
···
On Sunday, December 16, 2018 at 9:09:25 AM UTC-7, rizwan ghauri wrote:
Dear Mr wang,
Really thankful for your kind reply. will be anxiously waiting for your code
Best Regards
On Sunday, 16 December 2018 19:34:33 UTC+4, Jeffery wang wrote:
Hi buddy,
I will share my code with you on Monday. Today, I am pretty busy because of holiday. Please be a little bit of patient, I make sure my code can help you out.
Best
On Sun, Dec 16, 2018 at 8:27 AM rizwan ghauri [email protected] wrote:
Dear friends,
I am fairly new to programming and in the end, I am stuck to a problem where I cannot embed my bokeh page with TABS into flask. please seeking your help to resolve this issue.
have got a plot with three or more tabs
bokeh script file
from bokeh.embed import components
from bokeh.resources import CDN
``
the last lines of the codes where tabs were merged
############### TABS 1 ############
grid = gridplot([[V_Traffic, D_Traffic]])
tab1 = Panel(child=grid, title=“LTE”)
############### TABS 2 ############
p2 = figure(plot_width=300, plot_height=300)
p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color=“navy”, alpha=0.5)
tab2 = Panel(child=p2, title=“line”)
############### TABS 3 ############
p3 = figure(plot_width=300, plot_height=300)
p2.triangle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color=“pink”, alpha=0.5)
tab3 = Panel(child=p3, title=“triangle”)
tabs = Tabs(tabs=[tab1, tab2, tab3])
even with three tabs when i checked the length of len(components(tabs)) the answer was 2
js, div = components(tabs)
cdn_js = CDN.js_files[0]
cdn_css = CDN.css_files[0]
``
below is my flask app code
from flask import Flask, render_template, cli
from stack_plot_grid_TAB_1 import js, div, cdn_js, cdn_css
app = Flask(name)
@app.route(“/”)
def home():
return render_template(“index.html”)
@app.route(‘/execute’)
def execute_grid_tab():
return render_template(“stack_plot_grid_TAB_1.html”, js=js, div=div, cdn_js=cdn_js, cdn_css=cdn_css)
if name == “main”:
app.run(debug=True)
``
below is the code where my final plot should have shown.
1. stack_plot_grid_TAB_1.html
Title
this is the new page.
{{js|safe}}
{{div|safe}}
in the end, it just says “this is the new page”. I am sure I am have done something wrong. please help me in guiding me as to how to resolve this issue.
Best Regards.
–
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/c5b8c559-0cff-4f18-81e7-5cac9d2c3e0b%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
–
Sent from Peng’s Gmail Mobile