Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,12 @@ def hex_to_rgba(hex_color, alpha=1.0):
|
|
| 11 |
hex_color = hex_color.lstrip('#')
|
| 12 |
return f'rgba({int(hex_color[0:2], 16)},{int(hex_color[2:4], 16)},{int(hex_color[4:6], 16)},{alpha})'
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Sidebar para la configuración del gráfico
|
| 15 |
st.sidebar.header("Configuración del Gráfico")
|
| 16 |
|
|
@@ -47,12 +53,14 @@ data = pd.DataFrame(data_list)
|
|
| 47 |
|
| 48 |
# Ajustar fechas para simular apilamiento si está activado
|
| 49 |
if stacked:
|
| 50 |
-
#
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# Crear gráfico de franjas de tiempo
|
| 55 |
-
fig = px.timeline(data, x_start="
|
| 56 |
|
| 57 |
# Actualizar el diseño del gráfico
|
| 58 |
fig.update_yaxes(categoryorder="total ascending")
|
|
|
|
| 11 |
hex_color = hex_color.lstrip('#')
|
| 12 |
return f'rgba({int(hex_color[0:2], 16)},{int(hex_color[2:4], 16)},{int(hex_color[4:6], 16)},{alpha})'
|
| 13 |
|
| 14 |
+
# Lista de fuentes más utilizadas
|
| 15 |
+
font_options = [
|
| 16 |
+
"Times New Roman", "Arial", "Helvetica", "Calibri", "Verdana",
|
| 17 |
+
"Tahoma", "Georgia", "Garamond", "Courier New", "Brush Script MT"
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
# Sidebar para la configuración del gráfico
|
| 21 |
st.sidebar.header("Configuración del Gráfico")
|
| 22 |
|
|
|
|
| 53 |
|
| 54 |
# Ajustar fechas para simular apilamiento si está activado
|
| 55 |
if stacked:
|
| 56 |
+
offset = timedelta(days=1) # Ajusta el offset según sea necesario
|
| 57 |
+
for i in range(1, len(data)):
|
| 58 |
+
previous_end = data.loc[i-1, 'End']
|
| 59 |
+
data.loc[i, 'Start'] = previous_end + offset
|
| 60 |
+
data.loc[i, 'End'] = data.loc[i, 'Start'] + (data.loc[i, 'End'] - data.loc[i, 'Start'])
|
| 61 |
|
| 62 |
# Crear gráfico de franjas de tiempo
|
| 63 |
+
fig = px.timeline(data, x_start="Start", x_end="End", y="Variable", color="Variable", title=chart_title)
|
| 64 |
|
| 65 |
# Actualizar el diseño del gráfico
|
| 66 |
fig.update_yaxes(categoryorder="total ascending")
|