运动区散景工具

问题描述 投票:-2回答:1

My plot

[嗨,我为气象站做了烧瓶应用程序。它从数据库生成图。在桌面网络浏览器,移动,缩放,悬停工具上,一切都正常运行。我在移动设备上遇到问题,无法移动绘图,无法使用缩放框进行缩放。就像您在图片上看到的那样,它被卡住了。我该如何解决我的问题?

这就是我生成情节的方式:

def plot(column, color, unit, time, size):
output_file("templates/" + column + "" + time + ".html")
if column == "pressure":
    p = figure(plot_width=800, plot_height=350, toolbar_location="below", x_axis_type="datetime",
               tools='box_zoom,pan,zoom_out,zoom_in,save,reset', sizing_mode="scale_width", x_axis_label="Data",
               y_axis_label=unit, y_range=(980, 1050))
else:
    p = figure(plot_width=800, plot_height=350, toolbar_location="below", x_axis_type="datetime",
               tools='box_zoom,pan,zoom_out,zoom_in,save,reset', sizing_mode="scale_width", x_axis_label="Data",
               y_axis_label=unit)
l1 = []  # TODO wymowne nazwy zmeinnych
l2 = []
d1 = []
d2 = []

conn = mysql.connect()
cursor = conn.cursor()
cursor.execute("SELECT Date FROM measurements ORDER BY ID DESC")
d1 = cursor.fetchmany(size=size)
cursor.execute("SELECT " + column + " FROM measurements ORDER BY ID DESC")
l1 = cursor.fetchmany(size=size)

for i in l1:
    l2.append(i[0])
for i in d1:
    d2.append(i[0])

df = pd.DataFrame()
df['Date'] = d2
df['Date'] = pd.to_datetime(df['Date'], format='%d-%m-%Y %H:%M:%S')
df['DateString'] = df['Date'].dt.strftime("%d-%m-%Y %H:%M:%S")
df["" + column + ""] = l2
cds = ColumnDataSource(df)
p.add_tools(HoverTool(
    tooltips=[("Data", "@DateString"), ('Wartość: ', '@' + column + ' ' + unit + '')],
    formatters={"x": "datetime"}, line_policy="nearest",
    # display a tooltip whenever the cursor is vertically in line with a glyph
    mode='vline'))
p.line("Date", "" + column + "", source=cds, color=color)
save(p)
conn.close()

然后我只将生成的html包含到我的页面中。

python flask bokeh
1个回答
0
投票

自Bokeh 1.2起,这似乎是错误/回归。我目前只能提供的解决方法是使用Bokeh 1.1,直到它得到修复。我做了一个GitHub issue,您可以关注。

© www.soinside.com 2019 - 2024. All rights reserved.