Hello everybody,
I create a dash_table, and it gives the elections candidats with their vote percentage, I want to use linera gradient to colorize the cell regarding the percentage
my layout:
dcc.Tab(label=‘Elections Européennes 2019’, children=[
html.Div(id=“elections_table”, style={‘paddingLeft’:‘70px’})
])
and below my callback function
@app.callback(Output('elections_table','children'), [Input('ville-picker','value')])
def europeenes_table(selected_ville):
code_insee = df[df['ville'] == selected_ville]['code_insee'].iloc[0][18:]
liste_candidat = df_europe.columns[3:-5]
donnees = [
df_europe[df_europe['code_insee'] == code_insee][i].iloc[0] for i in liste_candidat
]
infos = {'candidat' : liste_candidat,
'vote' : donnees}
df_info = pd.DataFrame(infos)
data = df_info.to_dict('rows')
return dash_table.DataTable(
id='elections',
columns=[{'id':'candidat','name':'Candidat'},{'id':'vote','name':'% des voix'}],
data= data,
style_cell= {'background': 'linear-gradient(90deg, red, red 60%, white)',"fontFamily": "Arial", "size": 18, 'textAlign': 'left'},
)
I have to intervene on my return in the style_cell but I don’t know how, thank you for your help