Hi Augustine,
Dear Fabio,
Sorry for my late reply. Pardon me for accidentally commenting out the p.circle
portion of my code in my first post for this thread. Even when I was running my code without the uncommented portion I couldn’t resolve the issue. As you suggested, last week I tried using your code snippet as you showed below, but that also did not work. Basically it still gave the same thing - the plot was rendered perfectly fine, and even the hovering over the circles work, but I couldn’t click on them (they were not ‘clickable’) when instead they should have been and I should get redirected to the URLs that I specified under OpenURL.
So I worked around with the code, and eventually I managed to overcome this problem.
Happy to hear that you’ve got it working.
Here is my new code as follows:
Prototyping zone for the plotting of graphs using python bokeh
from bokeh.plotting import figure , output_file, show
from bokeh.models import HoverTool, TapTool, OpenURL, ColumnDataSource
from collections import OrderedDict
def bokeh_plot(data):
if isinstance(data, pd.Series):
buildnums = list(data.index)
datapts = list(data)
source = ColumnDataSource(dict(x = buildnums, y=datapts))
p = figure(title="Builds", tools="pan,wheel_zoom,reset,hover")
# Now I render the circle glyph before the line glyph
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([
("(x,y)", "(@x, @y)")
])
tap = TapTool(plot=p,
action=OpenURL(url="[http://192.168.1.253:8010/builders/Synthesis/builds/@x](http://192.168.1.253:8010/builders/Synthesis/builds/@x)"))
p.tools.append(tap)
output_file("data_analysis.html")
show(p)
bokeh_plot(aggregated_geomean_syn_queue_fmax) # aggregated_geomean_syn_queue_fmax is a pandas series object
Ah! Got it. I did try adding both locally and was working. I should have considered that.
What different in this chunk compared to the previous is that now I chose to render the circle glyph BEFORE rendering the line glyph and I think this somehow led the the circles being superimposed on top of the line glyphs, that thus made them to be ‘clickable’, because previously when I was doing the opposite, the circles were never ‘clickable’. You mentioned in your reply that your code worked when you tried it - however did you test if you could click on the circles and be redirected to URLs?
Yes. It was working. I probably did change when copying and pasting the code because I had also a couple of lines commented in the middle that I removed.
So looking at this, is it true that the order in which the glyphs are rendered and layered upon one another follows the order in which they were called in the code, and that this ordering can have an impact on the glyph behaviors? Is this anticipated behavior?
Yes. I don’t remember it being well and clearly documented though. (at least specified for the different API layers)
If so, I think it will be important to document it.
Yes, agreed.
I never saw this in the Bokeh documentation (is it already there?) and if it isn’t already, I don’t mind contributing some explanations on this behavior if the documentation is open to community editing.
That’d be definitely AWESOME ! I then suggest you to open an issue on github related to this and a following PR with the documentation addition.
You should find information about how to contribute on the contributing and the developer guide sections of the documentation. But let us know if there is something not clear that prevents you from contributing.
Cheers and keep up the good work with developing Bokeh!
Thank you very much!
Fabio
···
On Monday, May 4, 2015 at 5:00:57 AM UTC+2, Augustine Koh wrote: