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…?
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('https://raw.githubusercontent.com/plotly/datasets/master/solar.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(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict('records'),
tooltip_data=tooltip_data
)
if __name__ == '__main__':
app.run_server(debug=True)
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.