我正在使用 VS 代码构建一个 Bokeh 应用程序,每当我点击“运行”(右上角的绿色箭头)时,所做的更改都会在新的浏览器中打开。我认为这很容易实现,但我正在努力寻找一种方法,只要进行更改,就可以刷新同一个浏览器,而不是每次点击运行时都打开一个新的浏览器,例如
是否有与用于 html 文件的 Live Server 类似的方法?我的散景应用程序的代码如下(如果有帮助)
from random import random
from bokeh.layouts import column, row, widgetbox, layout
from bokeh.models import Button
from bokeh.palettes import RdYlBu3
from bokeh.plotting import figure, curdoc
import pandas as pd
import pyodbc
from bokeh.plotting import figure, output_file, show, save
from bokeh.models import ColumnDataSource, HoverTool, CategoricalColorMapper, Legend, PrintfTickFormatter, CustomJS, Select
from bokeh.models.widgets import (Select)
from bokeh.models.widgets import Div
### Read in the data
df = pd.read_excel('RS data.xlsx')
### Set up Figure
p = figure(x_range=(0, 20), y_range=(0, 10), plot_height=400, plot_width=800)
p.add_layout(Legend(), 'right')
p.toolbar_location = None
df['Unique Story Count'] = df.groupby(['Person','Sprint'])['Story Id'].transform('nunique')
### Convert data into a bokeh data type
df1 = df[['Person', 'Sprint', 'Unique Story Count']]
df1['Person'].unique()
df1 = df1[df1['Person'] == 'Analyst 1'].drop_duplicates()
source1 = ColumnDataSource(df1)
x='Sprint'
y='Unique Story Count'
p1 = p.line(
x=x, y=y,
color='#d96ad5', line_color='#d96ad5',
line_width=2, line_alpha=1, source=source1
)
p2 = p.circle(
x=x,
y=y,
#legend_label='',
size=6,
fill_alpha=1,
# color={'field': 'Submission', 'transform': mapper},
source=source1
)
p.xaxis.ticker = list(range(0, 21))
p.xgrid.ticker = list(range(0, 21))
p.xaxis.axis_label = 'Sprint'
p.yaxis.axis_label = 'Story Count'
## tooltip for point
p.add_tools(HoverTool(
renderers=[p2],
tooltips=[
('Spri Num', '@Sprint'),
('Story Count', '@{Unique Story Count}')
],
mode='mouse')
)
show(p)