datacipen commited on
Commit
49da3d1
·
verified ·
1 Parent(s): 8a525fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -906,7 +906,7 @@ def create_repartition(array_value, selectedData, theme):
906
  }
907
  ],
908
  },font=dict(size=10),paper_bgcolor=paper_bgcolor,autosize=True,clickmode='event+select'
909
- ).add_annotation(x=0, y=0.95, xanchor='left', yanchor='bottom',
910
  xref='paper', yref='paper', showarrow=False, align='left',
911
  text='La répartition géographique des emplois<br><b>{}</b>'.format(customEmplois),font=dict(color="black",size=14))
912
 
@@ -960,7 +960,7 @@ def create_emploi(df, theme, customRepartition):
960
  df_intitule = df.groupby('intitule').size().reset_index(name='obs')
961
  df_intitule = df_intitule.sort_values(by=['obs'])
962
  df_intitule = df_intitule.iloc[-25:]
963
- fig_intitule = px.bar(df_intitule, x='obs', y='intitule', height=600, orientation='h', color='obs', template=template, labels={'obs':'nombre'}, color_continuous_scale="Teal", text_auto=True).update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,clickmode='event+select',autosize=True).update_traces(hovertemplate=df_intitule["intitule"] + ' <br>Nombre : %{x}', y=[y[:100] + "..." for y in df_intitule["intitule"]], showlegend=False).add_annotation(x=0, y=0.95, xanchor='left', yanchor='bottom',
964
  xref='paper', yref='paper', showarrow=False, align='left',
965
  text='Les principaux emplois<br><b>{}</b>'.format(customRepartition),font=dict(size=14))
966
 
@@ -1074,6 +1074,10 @@ def update_emploi(selectedData, array_value, theme):
1074
  options = []
1075
  if selectedData != None:
1076
  customRepartition = selectedData['points'][0]['hovertext']
 
 
 
 
1077
  if type(selectedData['points'][0]['hovertext']) == str:
1078
  options.append(selectedData['points'][0]['hovertext'])
1079
  else:
 
906
  }
907
  ],
908
  },font=dict(size=10),paper_bgcolor=paper_bgcolor,autosize=True,clickmode='event+select'
909
+ ).add_annotation(x=0, y=0.90, xanchor='left', yanchor='bottom',
910
  xref='paper', yref='paper', showarrow=False, align='left',
911
  text='La répartition géographique des emplois<br><b>{}</b>'.format(customEmplois),font=dict(color="black",size=14))
912
 
 
960
  df_intitule = df.groupby('intitule').size().reset_index(name='obs')
961
  df_intitule = df_intitule.sort_values(by=['obs'])
962
  df_intitule = df_intitule.iloc[-25:]
963
+ fig_intitule = px.bar(df_intitule, x='obs', y='intitule', height=600, orientation='h', color='obs', template=template, labels={'obs':'nombre'}, color_continuous_scale="Teal", text_auto=True).update_layout(font=dict(size=10),paper_bgcolor=paper_bgcolor,plot_bgcolor=plot_bgcolor,clickmode='event+select',autosize=True).update_traces(hovertemplate=df_intitule["intitule"] + ' <br>Nombre : %{x}', y=[y[:100] + "..." for y in df_intitule["intitule"]], showlegend=False).add_annotation(x=0, y=1.0, xanchor='left', yanchor='bottom',
964
  xref='paper', yref='paper', showarrow=False, align='left',
965
  text='Les principaux emplois<br><b>{}</b>'.format(customRepartition),font=dict(size=14))
966
 
 
1074
  options = []
1075
  if selectedData != None:
1076
  customRepartition = selectedData['points'][0]['hovertext']
1077
+ if customRepartition.find(',') == -1:
1078
+ customRepartition = customRepartition
1079
+ else:
1080
+ customRepartition = " "
1081
  if type(selectedData['points'][0]['hovertext']) == str:
1082
  options.append(selectedData['points'][0]['hovertext'])
1083
  else: