我在 Python 中使用 Bokeh 繪制兩個數據集。我將一個數據集繪制為一條線,另一個作為標記(圓圈十字)。我正在嘗試為標記數據集添加一個懸停工具。source = ColumnDataSource(df_bcn_rns)p = figure(plot_height=300, plot_width=800, tools="", toolbar_location=None, x_axis_type='datetime', x_axis_location="above", background_fill_color="#efefef") #,x_range=(bcn_sp.index[-1], bcn_sp.index[0])p.line(x=bcn_sp['Date'], y=bcn_sp['Close'])#,source=source)p.circle_cross(x='Date', y='price', source=source)p.yaxis.axis_label = 'Closing Price'p.add_tools(HoverTool( tooltips=[( 'date', '@Date{%d-%m-%Y}'), ( 'price', '@price{00.2f}p'), # use @{ } for field names with spaces ( 'rns header', '@Headline')], formatters={'Date' : 'datetime', # use 'datetime' formatter for 'date' field 'close' : 'printf'}, # use 'printf' formatter for 'adj close' field mode='vline' # display a tooltip whenever the cursor is vertically in line with a glyph ))show(column(p)) #,select上面的代碼有效,但是,當鼠標懸停在任一數據集上時,懸停工具會顯示。當鼠標懸停在線數據集上時,顯示“???” 在懸??蛑校也幌M@示任何內容??偠灾移谕慕Y果是鼠標懸停在標記上時顯示的懸???,但只要鼠標懸停在行上時就沒有懸??颍驗榇藬祿存溄拥健霸础?。有什么建議我可以解決這個問題嗎?
添加回答
舉報
0/150
提交
取消