Dear All,
I am facing some trouble with ensuring that the Bokeh plots I am a generating with multiple pandas Series objects all exhibit the TapTool behavior. I have generated 3 Bokeh plots and embedded them in a webpage, but somehow only one of them has that TapTool functionality when all of them should have. This problem also exists even when the plots are on their own unembedded. Google told me that my files take up too much space, so I have shared them through these links:
https://drive.google.com/file/d/0B3-pP2zyNCngbEh1dS0yNzR6czg/view?usp=sharing
https://drive.google.com/file/d/0B3-pP2zyNCngY2NhTWZOcm1KYlE/view?usp=sharing
https://drive.google.com/file/d/0B3-pP2zyNCngc2ZQemVWbmYwREE/view?usp=sharing
https://drive.google.com/file/d/0B3-pP2zyNCngaFhkY01LMmJ5QVU/view?usp=sharing
I am pretty sure about my assertion because all the 3 plots were generated from the same Class method by passing in 3 different pandas Series for each Series that I wanted to plot to each call to the method. Below here is my code for generating my Bokeh plot:
class WebPlot:
def init(self, analysis_type, buildbot_queue):
‘’’
Analysis_type parameter must not have any empty space between words…
‘’’
self.analysis_type = analysis_type
self.buildbot_queue = buildbot_queue
def bokeh_plot(self, data, metric):
‘’’
The metric parameter must be a string that must be exactly the same as the name
of the column on the Series that contains all the data we want to plot
against the build numbers.
‘’’
if isinstance(data, pd.Series):
# We generate two lists from the series object
buildnums = list(data.index)
datapts = list(data)
# We construct a dictionary from the two lists in order to pass the data into
# the ColumnDataSource instance because ColumnDataSource does not accept Series objects
source = ColumnDataSource(dict(x = buildnums, y=datapts))
p = figure(title="%s of %s vs build number" %(self.analysis_type, metric),
tools="pan,wheel_zoom,reset,hover")
# Be sure to instantiate the circle glyph factory before the line glyph factory
# otherwise TapTool OpenURL on the circle won't work with the clickable link
p.circle(x = buildnums, y = datapts, radius=0.3, source = source,
fill_color="blue", fill_alpha=0.6, line_color=None)
p.line(x = buildnums, y = datapts)
hover = p.select(dict(type=HoverTool))
hover.tooltips = OrderedDict([
("(Build Number, %s)"%self.analysis_type, "(@x, @y)")
])
tap = TapTool(plot=p,
action=OpenURL(url="http://192.168.1.253:8010/builders/%s/builds/@x"%self.buildbot_queue))
p.tools.append(tap)
output_file("%s_%s.html" %(self.analysis_type, metric))
save(p)
return p
``
With the plots I have generated from this, I follow the instructions on http://bokeh.pydata.org/en/latest/docs/user_guide/embedding.html#components using the Components method to embed the plots into a HTML with the direct use of the jinja2 templating engine.
While I have had problems with TapTool before (Redirecting to Google Groups) , I am pretty sure this is a new problem. An old problem that I previoously had was in that post where the solution turned out to be that I had to generate the Circle glyphs before the line glyph, and this is what I’m doing here, and it worked for one Series object, but not for the other two. Furthermore, I am very sure that this isn’t due to any issues with embedding the plots, because, as I have attached here, the html files of the 3 plots, you can see that the two that did not work while on the embedded html also do not work when they are as individual plots.
I will greatly appreciate any help and suggestions to move forward on this issue.
Thank you very much!
Best,
Augustine