Hi all,
In this code the tooltip doesn’t show up for the red candles. Can someone help me with an idea why?
import pandas as pd
import numpy as np
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.plotting import figure, show
from bokeh.sampledata.stocks import MSFT
source = pd.DataFrame(MSFT)[:50]
source[“date”] = pd.to_datetime(source[“date”])
source[“color”] = np.where(source.close > source.open, ‘#33AA44’, ‘#F2583E’)
plot_main = figure(x_axis_type = “datetime”, tools = “pan,box_zoom,resize,reset,save,wheel_zoom”, plot_width = 1700, plot_height = 900, title = “Candle Stick Example”, toolbar_location = “above”, active_scroll = “wheel_zoom”)
segments = plot_main.segment(x0 = ‘date’, y0 = ‘low’, x1 = ‘date’, y1 = ‘high’, color = ‘color’, source = ColumnDataSource(source), legend = “Needles”)
candles = plot_main.vbar(x = ‘date’, bottom = ‘open’, top = ‘close’, color = ‘color’, width = 12 * 60 * 60 * 1000, source = ColumnDataSource(source), legend = “Candles”)
plot_main.add_tools(HoverTool(tooltips = ‘
Close: @close
Open: @open
Low: @low
show(plot_main)