Hello,
I have been trying to put my data into a plot.ly table but I have been having trouble with getting the links to work.
My data consists of news articles and urls for the articles. res is a dataframe containing the article title, url, section, and source. Both the links and the titles can be extremely long. I’ve found that if I do not set the cell size to be unrealistically big then the links do not work. I suspect that this is because some of the text is being cut off (the last characters of some of the links are not being shown in the table).
Is there any solution to my problem? The code and a screenshot of the problem is attached.
Thanks !
Code:
import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
app = dash.Dash(name)
links = '<a href = "' + res['url'] + '">' + res['title'] + '</a>'
#All the links start to work only if I make the cell size huge
trace = go.Table(
columnorder = [1,2,3],
columnwidth = [200,75,30],
header = dict(values=['title','source','section']),
cells = dict(values=[links,
res['source'],
res['section']],
height = 30))
data = [trace]
app.layout = html.Div([
html.Div(html.A("test link", href = 'https://community.plotly.com/c/dash'), style={'color': 'black', 'fontSize': 18, 'font-family' : 'Arial', 'font-weight': 'bold'}),
dcc.Graph(id='visitors1',figure = go.Figure(data=[trace]))
])
if name == ‘main’:
app.run_server()