Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Datatable `tooltip_data` argument - request for example

hi i’ve tried all possible combinations i could think fo but can’t figure out what tooltip_data wants passed to it structure-wise, there’s nothing in reference that clears this up.

could someone please post an example of the structure for generating tooltip_data structure for multirow multicol table please. which level is the outermost - row or col?, do you need to have a dict attached to each col key, is outermost structure list…? thigns to be grouped by row in lists…?

1 Like

Hi @vlemmy welcome to the forum! I agree that the documentation could be clearer :-(. Here is a working example below (coursesy of @michaelbabyn! )

import dash
import dash_table
import pandas as pd
import numpy as np

df = pd.read_csv('')

tooltip_data = [ { c: {'type': 'text', 'value': str(np.random.random(1)), 'delay':50, 'duration': 3000} for c, d in row.items()} for row in df.to_dict('rows')]

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    columns=[{"name": i, "id": i} for i in df.columns],

if __name__ == '__main__':

thank-you emmanuele, i realise that my problem was not the structure but the fact that i was not converting my numbers to strings as tooltip only accepts text or markdown. i should have read more carefully. thank-you.

Thanks for your nice example @Emmanuelle, my problem was row vs column order:

I got it working now following your example.

@Emmanuelle is there any example to generate tooltip data using call back and use it in the UI