tx3bas commited on
Commit
a9a4206
·
verified ·
1 Parent(s): 351323e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -82,11 +82,20 @@ data['End'] = pd.to_datetime(data['End'])
82
  # Crear gráfico
83
  fig = px.timeline(data, x_start="Start", x_end="End", y="Variable", color="Variable", title=chart_title)
84
  fig.update_yaxes(categoryorder="total ascending")
 
 
 
 
 
 
 
 
 
85
  fig.update_layout(
86
  xaxis_title=x_label,
87
  yaxis_title=y_label,
88
  xaxis=dict(
89
- tickformat="%d-%m-%Y" if time_format == "Día" else "%Y-%m" if time_format == "Mes" else "%Y",
90
  titlefont=dict(size=14),
91
  tickfont=dict(size=12),
92
  ),
 
82
  # Crear gráfico
83
  fig = px.timeline(data, x_start="Start", x_end="End", y="Variable", color="Variable", title=chart_title)
84
  fig.update_yaxes(categoryorder="total ascending")
85
+
86
+ # Personalizar el formato de tiempo en el eje X
87
+ if time_format == "Día":
88
+ tickformat = "%d-%m-%Y"
89
+ elif time_format == "Mes":
90
+ tickformat = "%Y-%m"
91
+ else:
92
+ tickformat = "%Y"
93
+
94
  fig.update_layout(
95
  xaxis_title=x_label,
96
  yaxis_title=y_label,
97
  xaxis=dict(
98
+ tickformat=tickformat,
99
  titlefont=dict(size=14),
100
  tickfont=dict(size=12),
101
  ),