Tooltip rendering issue

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 = ‘

High: @high
Close: @close
Open: @open
Low: @low
’, show_arrow = False, renderers = [candles]))

show(plot_main)

Hi,

The code below works for me if I remove "resize" for the tools list, otherwise I get an exception. That's because the ResizeTool was removed a long time ago. There was also a time before hit-testing was added to bars, are you using an old version? It's always important to state version information with any request for help.

Thanks,

Bryan

···

On Jul 19, 2018, at 06:26, [email protected] wrote:

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 = '<div>High: @high</br>Close: @close</br>Open: @open</br>Low: @low</br></div>', show_arrow = False, renderers = [candles]))
show(plot_main)

--
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/23f17efc-9c47-44e2-8a4d-5cc11dcba355%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I was using 0.12.6.
Now I upgraded to 0.13.0 and it works.

Thanks

···

On Thursday, July 19, 2018 at 3:31:57 PM UTC+2, tony halik wrote:

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 = ‘

High: @high
Close: @close
Open: @open
Low: @low
’, show_arrow = False, renderers = [candles]))

show(plot_main)