Hover over an existing figure

Hi all,

I’m currently trying to figure out how hovers work in a bokeh visualization.

My expected result is an app plotting some datas over circles. This algorythm is done twice.

My main problem is to generate those hovers over the last circle incrementation. Even with the documentation I can’t figure out how to do it.

Here is my code :

from bokeh.plotting import figure, ColumnDataSource

from bokeh.io import output_file, show

from bokeh.models import WheelZoomTool, Label, HoverTool

from bokeh.models.glyphs import Text

import pandas as pd

import os

import math

df = pd.read_excel(x)

#on récupère la liste des domaines fonctionnels existants et leur nombre

domaine = pd.unique(df[“domaine”])

nb_domaine =len(domaine)

#Configuration de la visualisation

p = figure(width = 1920, height = 1080, sizing_mode = “scale_both”, x_range=(-0.9, 1.1), y_range=(-1.1,1))

#stretch_both permet d’être complétement responsive mais va déformer les images

output_file(“cartographie_bokeh.html”, title =“Cartographie des Start-Up Sopra Steria”)

#on distribue les domaines fonctionnels sur le cercle trigonométrique

angle = 360/nb_domaine

angle1=angle

df_domaine = pd.DataFrame(columns = [“Domaine”, “x”, “y”, “angle”])

dict = {}

for i in domaine :

#Découpage du cercle trigonométrique et définition des coordonées des domaines

x1 = math.cos(math.radians(angle))*0.7

y1 = math.sin(math.radians(angle))*0.7

mytext = Label(x=x1, y=y1, text=i, text_align = “center”, text_font_size = “13pt”, text_font = “Century Gothic”, text_font_style = “bold”, text_color = “firebrick”)

#création du dictionnaire de données de domaines

dict[i] = x1, y1, angle

#Ajout des domaines sur la cartographie

p.add_layout(mytext)

angle = angle+angle1

xi =

yi =

namei =

datei =

for key in domaine :

df_SU = df[df[“domaine”] == key]

#Extraction et retraitement des informations trigonométriques

size_df_SU = len(df_SU)

angle = 360/size_df_SU

angle1 = angle

for i in df_SU.index:

x1 = math.cos(math.radians(angle +45))/4.5 + dict[key][0]

y1 = math.sin(math.radians(angle+45))/4.5 + dict[key][1]

p.image_url(url=[df_SU[‘lien_logo’][i]],x=x1, y=y1,h=3.62/30, w=9.76/50, anchor = “center”)

angle = angle+angle1

xi.append(x1)

yi.append(y1)

namei.append(i)

datei.append(df_SU[“date”][i])

``

I would like to use those last xi, yi, namei and datei in a hover.

Could you help me ?

Thanks !