I am having trouble in renewing special character (i.e. from fontawesome) in Scatter’s text. In the example below the text is showing hollow squares only.
Tree structure were font awesome is locally installed:
Here is the code:
import plotly.graph_objects as go
import dash
from dash import dcc, html
import dash_bootstrap_components as dbc
import fontawesome as fa
text = fa.icons['clock']
print(text)
fa_text = html.Div(
[
html.P(
'please come home',
style={
'color': 'green',
'display': 'inline-block'
}
),
html.P(
className='fa-regular fa-chart-bar fa-xl m-3',
style={
'color': 'green',
'display': 'inline-block'
}
),
]
)
fig = go.Figure()
fig.add_trace(
go.Scatter(
x=[0, 1, 2],
y=[1, 1, 1],
mode="lines+markers+text",
name="Lines, Markers and Text",
text=[text, 'Header-1', text],
textposition="top center",
textfont=dict(
family='Font Awesome 5 Free',
size=12,
color='red'
),
)
)
app = dash.Dash(
__name__,
title='Phase3-App',
)
app.layout = dbc.Container(
[
html.Div(
[
html.Hr(),
fa_text,
dcc.Graph(
id='xyz',
figure=fig
),
]
),
],
fluid=True
)
if __name__ == '__main__':
app.run_server(port=8050, debug=True)