viewx 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {viewx-0.2.1 → viewx-0.2.3}/PKG-INFO +51 -125
- {viewx-0.2.1 → viewx-0.2.3}/README.md +50 -124
- {viewx-0.2.1 → viewx-0.2.3}/setup.py +1 -1
- viewx-0.2.3/tests/test1.py +150 -0
- {viewx-0.2.1 → viewx-0.2.3}/tests/test4.py +3 -1
- viewx-0.2.3/tests/test7.py +1514 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/DataMatrix/datamatrix_engine.py +3 -0
- viewx-0.2.3/viewx/HTML/html_engine.py +1355 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/__init__.py +4 -5
- {viewx-0.2.1 → viewx-0.2.3}/viewx.egg-info/PKG-INFO +51 -125
- {viewx-0.2.1 → viewx-0.2.3}/viewx.egg-info/SOURCES.txt +1 -2
- viewx-0.2.1/tests/test1.py +0 -65
- viewx-0.2.1/viewx/DashBoard/__init__.py +0 -5
- viewx-0.2.1/viewx/DashBoard/dashboard_engine.py +0 -409
- viewx-0.2.1/viewx/HTML/html_engine.py +0 -633
- {viewx-0.2.1 → viewx-0.2.3}/setup.cfg +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/tests/test2.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/tests/test3.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/tests/test5.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/tests/test6.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/DataMatrix/__init__.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/DataMatrix/bibliometrics.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/DataMatrix/visualizer.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/HTML/__init__.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Report/__init__.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Report/report_engine.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Slides/__init__.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Slides/charts.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Slides/components.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/Slides/slides_engine.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/__init__.py +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/course_completion.csv +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/iris.csv +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/penguins.csv +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/sp500_companies.csv +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx/datasets/titanic.csv +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx.egg-info/dependency_links.txt +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx.egg-info/requires.txt +0 -0
- {viewx-0.2.1 → viewx-0.2.3}/viewx.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: viewx
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Librería de visualización adaptable para HTML, Dashboards y PDFs en Python
|
|
5
5
|
Home-page: https://github.com/GhostAnalyst30/ViewX
|
|
6
6
|
Author: Emmanuel Ascendra Perez
|
|
@@ -52,7 +52,7 @@ Dynamic: requires-dist
|
|
|
52
52
|
Dynamic: requires-python
|
|
53
53
|
Dynamic: summary
|
|
54
54
|
|
|
55
|
-
#
|
|
55
|
+
# ViewX — v2.3
|
|
56
56
|
|
|
57
57
|
**ViewX** es un paquete moderno de Python diseñado para generar **páginas HTML interactivas**, **dashboards dinámicos** y **visualizaciones inteligentes** que se adaptan automáticamente a los objetos agregados por el usuario.
|
|
58
58
|
|
|
@@ -60,15 +60,14 @@ Este proyecto ofrece una solución **ligera, intuitiva y escalable**, ideal para
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Características principales
|
|
64
64
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- 🔮 **Visión a futuro**: pensado para expandirse a interfaces inteligentes.
|
|
65
|
+
- **Rápido y minimalista**: cero dependencias pesadas por defecto.
|
|
66
|
+
- **API intuitiva**: crea páginas y dashboards en segundos.
|
|
67
|
+
- **Diseño adaptativo**: cada componente se acomoda automáticamente.
|
|
68
|
+
- **Modo HTML**: genera páginas `.html` totalmente autónomas.
|
|
69
|
+
- **Extensible**: añade tus propias plantillas y módulos personalizados.
|
|
70
|
+
- **Visión a futuro**: pensado para expandirse a interfaces inteligentes.
|
|
72
71
|
|
|
73
72
|
---
|
|
74
73
|
|
|
@@ -77,132 +76,59 @@ Este proyecto ofrece una solución **ligera, intuitiva y escalable**, ideal para
|
|
|
77
76
|
pip install viewx
|
|
78
77
|
```
|
|
79
78
|
|
|
80
|
-
##
|
|
79
|
+
## Ejemplo rápido
|
|
81
80
|
|
|
82
|
-
### Crear
|
|
81
|
+
### Crear un DashBoard HTML
|
|
83
82
|
```python
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
df_ventas = pd.DataFrame({
|
|
89
|
-
'Mes': ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
|
|
90
|
-
'Ventas': [120, 135, 148, 170, 195, 210, 245, 268, 290, 310, 335, 400],
|
|
91
|
-
'Beneficio': [30, 35, 42, 51, 58, 63, 73, 80, 87, 93, 100, 120],
|
|
92
|
-
'Clientes': [45, 48, 52, 58, 65, 72, 80, 88, 95, 102, 110, 125]
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
# Datos para gráfico de barras
|
|
96
|
-
df_productos = pd.DataFrame({
|
|
97
|
-
'Producto': ['Producto A', 'Producto B', 'Producto C', 'Producto D', 'Producto E'],
|
|
98
|
-
'Ventas': [450, 320, 280, 190, 150]
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
# Datos para scatter
|
|
102
|
-
df_clientes = pd.DataFrame({
|
|
103
|
-
'Edad': [25, 32, 28, 45, 38, 29, 51, 42, 35, 30],
|
|
104
|
-
'Gasto': [120, 200, 150, 300, 250, 180, 400, 320, 220, 160],
|
|
105
|
-
'Segmento': ['Joven', 'Adulto', 'Joven', 'Senior', 'Adulto', 'Joven', 'Senior', 'Adulto', 'Adulto', 'Joven']
|
|
83
|
+
df = pd.DataFrame({
|
|
84
|
+
"date": dates, "region": regions, "product": products,
|
|
85
|
+
"revenue": revenue_str, "costs": costs.round(2),
|
|
86
|
+
"units": units, "rating": rating, "returned": returned,
|
|
106
87
|
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
dashboard = HTML(
|
|
110
|
-
title="📊 Dashboard Ejecutivo - Demo",
|
|
111
|
-
theme="corporate_blue", # Temas: corporate_blue, dark_enterprise, modern_green, void_indigo, glass_ocean, cyberpunk_neon
|
|
112
|
-
cols=12, # Grid de 12 columnas
|
|
113
|
-
rows=12, # 12 filas de altura
|
|
114
|
-
gap=16,
|
|
115
|
-
padding=20,
|
|
116
|
-
navbar={
|
|
117
|
-
"title": "📈 ViewX PRO",
|
|
118
|
-
"items": [
|
|
119
|
-
{"label": "Inicio", "link": "#"},
|
|
120
|
-
{"label": "Ventas", "link": "#"},
|
|
121
|
-
{"label": "Clientes", "link": "#"},
|
|
122
|
-
{"label": "Reportes", "link": "#"}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
88
|
+
df["revenue"] = pd.to_numeric(
|
|
89
|
+
df["revenue"].str.replace(r"[$,]", "", regex=True), errors="coerce"
|
|
125
90
|
)
|
|
126
91
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
dashboard.add_valuebox("Clientes Activos", "1,247", "👥", "#FF6B35", row=1, col=7, height=2, width=3)
|
|
132
|
-
dashboard.add_valuebox("Tasa Conversión", "24.5%", "🎯", "#9B59B6", row=1, col=10, height=2, width=3)
|
|
133
|
-
|
|
134
|
-
# Fila 2-5: Gráfico de líneas (ventas mensuales) - Método sencillo con datos
|
|
135
|
-
dashboard.add_chart(
|
|
136
|
-
data=df_ventas,
|
|
137
|
-
chart_type="line",
|
|
138
|
-
x="Mes",
|
|
139
|
-
y="Ventas",
|
|
140
|
-
title="📈 Evolución de Ventas 2024",
|
|
141
|
-
row=3, col=1, height=10, width=6
|
|
92
|
+
fig_bar = px.bar(
|
|
93
|
+
df.groupby("region")["revenue"].sum().reset_index().sort_values("revenue"),
|
|
94
|
+
x="revenue", y="region", orientation="h", color="region",
|
|
95
|
+
color_discrete_sequence=["#059669", "#10B981", "#34D399", "#6EE7B7"],
|
|
142
96
|
)
|
|
97
|
+
fig_bar.update_layout(showlegend=False)
|
|
143
98
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
chart_type="bar",
|
|
148
|
-
x="Producto",
|
|
149
|
-
y="Ventas",
|
|
150
|
-
title="🏷️ Ventas por Producto",
|
|
151
|
-
row=3, col=7, height=10, width=6
|
|
99
|
+
fig_line = px.line(
|
|
100
|
+
df.groupby("date")["revenue"].sum().reset_index(),
|
|
101
|
+
x="date", y="revenue", color_discrete_sequence=["#059669"],
|
|
152
102
|
)
|
|
153
103
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
104
|
+
dash = HTML(
|
|
105
|
+
title="Manual Dashboard", theme="modern_green",
|
|
106
|
+
cols=12, rows=9, gap=14, padding=20,
|
|
107
|
+
navbar={"title": "Manual Dashboard",
|
|
108
|
+
"items": [{"label": "Home", "link": "#"}, {"label": "Analytics", "link": "#"}]},
|
|
109
|
+
authors=[{"name": "Data Team", "email": "data@acme.com"}],
|
|
110
|
+
data_button=True, df=df,
|
|
160
111
|
)
|
|
161
112
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
df =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
db.add_row(
|
|
178
|
-
col_widths=[1, 2, 1],
|
|
179
|
-
components=[
|
|
180
|
-
db.comp_blank(),
|
|
181
|
-
db.comp_plot(x="sepal_length", y="sepal_width", kind="scatter", color="#FFB86B"),
|
|
182
|
-
db.comp_metric("sepal_width", df["sepal_width"].sum(), delta="▲ 5%")
|
|
183
|
-
]
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
db.add_tabs({
|
|
187
|
-
"Overview": [
|
|
188
|
-
db.comp_title("Resumen por Región"),
|
|
189
|
-
db.comp_table()
|
|
190
|
-
],
|
|
191
|
-
"Details": [
|
|
192
|
-
db.comp_title("Distribución de Flores"),
|
|
193
|
-
db.comp_plot(x="species", y=None, kind="hist", color="#7C4DFF")
|
|
194
|
-
]
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
db.add_expander("Detalles técnicos", [
|
|
198
|
-
db.comp_text("Este panel fue generado automáticamente."),
|
|
199
|
-
db.comp_text("Metadata: filas=" + str(len(df)), size="12px")
|
|
200
|
-
], expanded=True)
|
|
201
|
-
|
|
202
|
-
db.run(open_browser=True)
|
|
113
|
+
dash.add_valuebox("Total Revenue", "$2.4M", icon_key="dollar", row=1, col=1, height=2, width=3)
|
|
114
|
+
dash.add_valuebox("Total Units", "18.4K", icon_key="box", row=1, col=4, height=2, width=3)
|
|
115
|
+
dash.add_valuebox("Avg Rating", "4.12", icon_key="award", row=1, col=7, height=2, width=3)
|
|
116
|
+
dash.add_valuebox("Return Rate", "12%", icon_key="percent", row=1, col=10, height=2, width=3)
|
|
117
|
+
|
|
118
|
+
dash.add_infobox(df=df, variable="revenue",
|
|
119
|
+
info=["mean", "median", "std", "min", "max", "kurtosis", "skewness", "nulls"],
|
|
120
|
+
title="Revenue Stats", row=3, col=1, height=4, width=3)
|
|
121
|
+
dash.add_chart(fig=fig_bar, title="Revenue by Region",
|
|
122
|
+
row=3, col=4, height=4, width=9, show_info_btn=True,
|
|
123
|
+
_info_stats={"Regions": "4", "Total": "$2.4M"})
|
|
124
|
+
dash.add_chart(fig=fig_line, title="Daily Revenue Trend",
|
|
125
|
+
row=7, col=1, height=3, width=12, show_info_btn=True)
|
|
126
|
+
|
|
127
|
+
dash.generate("demo6_manual.html")
|
|
203
128
|
```
|
|
204
129
|
|
|
205
|
-

|
|
206
132
|
|
|
207
133
|
### Crear una Presentacion
|
|
208
134
|
|
|
@@ -447,10 +373,10 @@ report_path = dm.generate_report("demo_datamatrix_report.html", title="Análisis
|
|
|
447
373
|
print(f"Reporte generado exitosamente en: {report_path}")
|
|
448
374
|
```
|
|
449
375
|
|
|
450
|
-
##
|
|
376
|
+
## Contribuciones
|
|
451
377
|
|
|
452
378
|
¡Todas las ideas, mejoras y plantillas son bienvenidas!
|
|
453
379
|
ViewX está diseñado para crecer y evolucionar con la comunidad.
|
|
454
380
|
|
|
455
|
-
##
|
|
381
|
+
## Contacto:
|
|
456
382
|
ascendraemmanuel@gmail.com
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ViewX — v2.3
|
|
2
2
|
|
|
3
3
|
**ViewX** es un paquete moderno de Python diseñado para generar **páginas HTML interactivas**, **dashboards dinámicos** y **visualizaciones inteligentes** que se adaptan automáticamente a los objetos agregados por el usuario.
|
|
4
4
|
|
|
@@ -6,15 +6,14 @@ Este proyecto ofrece una solución **ligera, intuitiva y escalable**, ideal para
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Características principales
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- 🔮 **Visión a futuro**: pensado para expandirse a interfaces inteligentes.
|
|
11
|
+
- **Rápido y minimalista**: cero dependencias pesadas por defecto.
|
|
12
|
+
- **API intuitiva**: crea páginas y dashboards en segundos.
|
|
13
|
+
- **Diseño adaptativo**: cada componente se acomoda automáticamente.
|
|
14
|
+
- **Modo HTML**: genera páginas `.html` totalmente autónomas.
|
|
15
|
+
- **Extensible**: añade tus propias plantillas y módulos personalizados.
|
|
16
|
+
- **Visión a futuro**: pensado para expandirse a interfaces inteligentes.
|
|
18
17
|
|
|
19
18
|
---
|
|
20
19
|
|
|
@@ -23,132 +22,59 @@ Este proyecto ofrece una solución **ligera, intuitiva y escalable**, ideal para
|
|
|
23
22
|
pip install viewx
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
##
|
|
25
|
+
## Ejemplo rápido
|
|
27
26
|
|
|
28
|
-
### Crear
|
|
27
|
+
### Crear un DashBoard HTML
|
|
29
28
|
```python
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
df_ventas = pd.DataFrame({
|
|
35
|
-
'Mes': ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
|
|
36
|
-
'Ventas': [120, 135, 148, 170, 195, 210, 245, 268, 290, 310, 335, 400],
|
|
37
|
-
'Beneficio': [30, 35, 42, 51, 58, 63, 73, 80, 87, 93, 100, 120],
|
|
38
|
-
'Clientes': [45, 48, 52, 58, 65, 72, 80, 88, 95, 102, 110, 125]
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
# Datos para gráfico de barras
|
|
42
|
-
df_productos = pd.DataFrame({
|
|
43
|
-
'Producto': ['Producto A', 'Producto B', 'Producto C', 'Producto D', 'Producto E'],
|
|
44
|
-
'Ventas': [450, 320, 280, 190, 150]
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
# Datos para scatter
|
|
48
|
-
df_clientes = pd.DataFrame({
|
|
49
|
-
'Edad': [25, 32, 28, 45, 38, 29, 51, 42, 35, 30],
|
|
50
|
-
'Gasto': [120, 200, 150, 300, 250, 180, 400, 320, 220, 160],
|
|
51
|
-
'Segmento': ['Joven', 'Adulto', 'Joven', 'Senior', 'Adulto', 'Joven', 'Senior', 'Adulto', 'Adulto', 'Joven']
|
|
29
|
+
df = pd.DataFrame({
|
|
30
|
+
"date": dates, "region": regions, "product": products,
|
|
31
|
+
"revenue": revenue_str, "costs": costs.round(2),
|
|
32
|
+
"units": units, "rating": rating, "returned": returned,
|
|
52
33
|
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
dashboard = HTML(
|
|
56
|
-
title="📊 Dashboard Ejecutivo - Demo",
|
|
57
|
-
theme="corporate_blue", # Temas: corporate_blue, dark_enterprise, modern_green, void_indigo, glass_ocean, cyberpunk_neon
|
|
58
|
-
cols=12, # Grid de 12 columnas
|
|
59
|
-
rows=12, # 12 filas de altura
|
|
60
|
-
gap=16,
|
|
61
|
-
padding=20,
|
|
62
|
-
navbar={
|
|
63
|
-
"title": "📈 ViewX PRO",
|
|
64
|
-
"items": [
|
|
65
|
-
{"label": "Inicio", "link": "#"},
|
|
66
|
-
{"label": "Ventas", "link": "#"},
|
|
67
|
-
{"label": "Clientes", "link": "#"},
|
|
68
|
-
{"label": "Reportes", "link": "#"}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
34
|
+
df["revenue"] = pd.to_numeric(
|
|
35
|
+
df["revenue"].str.replace(r"[$,]", "", regex=True), errors="coerce"
|
|
71
36
|
)
|
|
72
37
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
dashboard.add_valuebox("Clientes Activos", "1,247", "👥", "#FF6B35", row=1, col=7, height=2, width=3)
|
|
78
|
-
dashboard.add_valuebox("Tasa Conversión", "24.5%", "🎯", "#9B59B6", row=1, col=10, height=2, width=3)
|
|
79
|
-
|
|
80
|
-
# Fila 2-5: Gráfico de líneas (ventas mensuales) - Método sencillo con datos
|
|
81
|
-
dashboard.add_chart(
|
|
82
|
-
data=df_ventas,
|
|
83
|
-
chart_type="line",
|
|
84
|
-
x="Mes",
|
|
85
|
-
y="Ventas",
|
|
86
|
-
title="📈 Evolución de Ventas 2024",
|
|
87
|
-
row=3, col=1, height=10, width=6
|
|
38
|
+
fig_bar = px.bar(
|
|
39
|
+
df.groupby("region")["revenue"].sum().reset_index().sort_values("revenue"),
|
|
40
|
+
x="revenue", y="region", orientation="h", color="region",
|
|
41
|
+
color_discrete_sequence=["#059669", "#10B981", "#34D399", "#6EE7B7"],
|
|
88
42
|
)
|
|
43
|
+
fig_bar.update_layout(showlegend=False)
|
|
89
44
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
chart_type="bar",
|
|
94
|
-
x="Producto",
|
|
95
|
-
y="Ventas",
|
|
96
|
-
title="🏷️ Ventas por Producto",
|
|
97
|
-
row=3, col=7, height=10, width=6
|
|
45
|
+
fig_line = px.line(
|
|
46
|
+
df.groupby("date")["revenue"].sum().reset_index(),
|
|
47
|
+
x="date", y="revenue", color_discrete_sequence=["#059669"],
|
|
98
48
|
)
|
|
99
49
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
50
|
+
dash = HTML(
|
|
51
|
+
title="Manual Dashboard", theme="modern_green",
|
|
52
|
+
cols=12, rows=9, gap=14, padding=20,
|
|
53
|
+
navbar={"title": "Manual Dashboard",
|
|
54
|
+
"items": [{"label": "Home", "link": "#"}, {"label": "Analytics", "link": "#"}]},
|
|
55
|
+
authors=[{"name": "Data Team", "email": "data@acme.com"}],
|
|
56
|
+
data_button=True, df=df,
|
|
106
57
|
)
|
|
107
58
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
df =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
db.add_row(
|
|
124
|
-
col_widths=[1, 2, 1],
|
|
125
|
-
components=[
|
|
126
|
-
db.comp_blank(),
|
|
127
|
-
db.comp_plot(x="sepal_length", y="sepal_width", kind="scatter", color="#FFB86B"),
|
|
128
|
-
db.comp_metric("sepal_width", df["sepal_width"].sum(), delta="▲ 5%")
|
|
129
|
-
]
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
db.add_tabs({
|
|
133
|
-
"Overview": [
|
|
134
|
-
db.comp_title("Resumen por Región"),
|
|
135
|
-
db.comp_table()
|
|
136
|
-
],
|
|
137
|
-
"Details": [
|
|
138
|
-
db.comp_title("Distribución de Flores"),
|
|
139
|
-
db.comp_plot(x="species", y=None, kind="hist", color="#7C4DFF")
|
|
140
|
-
]
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
db.add_expander("Detalles técnicos", [
|
|
144
|
-
db.comp_text("Este panel fue generado automáticamente."),
|
|
145
|
-
db.comp_text("Metadata: filas=" + str(len(df)), size="12px")
|
|
146
|
-
], expanded=True)
|
|
147
|
-
|
|
148
|
-
db.run(open_browser=True)
|
|
59
|
+
dash.add_valuebox("Total Revenue", "$2.4M", icon_key="dollar", row=1, col=1, height=2, width=3)
|
|
60
|
+
dash.add_valuebox("Total Units", "18.4K", icon_key="box", row=1, col=4, height=2, width=3)
|
|
61
|
+
dash.add_valuebox("Avg Rating", "4.12", icon_key="award", row=1, col=7, height=2, width=3)
|
|
62
|
+
dash.add_valuebox("Return Rate", "12%", icon_key="percent", row=1, col=10, height=2, width=3)
|
|
63
|
+
|
|
64
|
+
dash.add_infobox(df=df, variable="revenue",
|
|
65
|
+
info=["mean", "median", "std", "min", "max", "kurtosis", "skewness", "nulls"],
|
|
66
|
+
title="Revenue Stats", row=3, col=1, height=4, width=3)
|
|
67
|
+
dash.add_chart(fig=fig_bar, title="Revenue by Region",
|
|
68
|
+
row=3, col=4, height=4, width=9, show_info_btn=True,
|
|
69
|
+
_info_stats={"Regions": "4", "Total": "$2.4M"})
|
|
70
|
+
dash.add_chart(fig=fig_line, title="Daily Revenue Trend",
|
|
71
|
+
row=7, col=1, height=3, width=12, show_info_btn=True)
|
|
72
|
+
|
|
73
|
+
dash.generate("demo6_manual.html")
|
|
149
74
|
```
|
|
150
75
|
|
|
151
|
-

|
|
152
78
|
|
|
153
79
|
### Crear una Presentacion
|
|
154
80
|
|
|
@@ -393,10 +319,10 @@ report_path = dm.generate_report("demo_datamatrix_report.html", title="Análisis
|
|
|
393
319
|
print(f"Reporte generado exitosamente en: {report_path}")
|
|
394
320
|
```
|
|
395
321
|
|
|
396
|
-
##
|
|
322
|
+
## Contribuciones
|
|
397
323
|
|
|
398
324
|
¡Todas las ideas, mejoras y plantillas son bienvenidas!
|
|
399
325
|
ViewX está diseñado para crecer y evolucionar con la comunidad.
|
|
400
326
|
|
|
401
|
-
##
|
|
327
|
+
## Contacto:
|
|
402
328
|
ascendraemmanuel@gmail.com
|
|
@@ -9,7 +9,7 @@ except FileNotFoundError:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="viewx",
|
|
12
|
-
version="0.2.
|
|
12
|
+
version="0.2.3",
|
|
13
13
|
author="Emmanuel Ascendra Perez",
|
|
14
14
|
author_email="ascendraemmanuel@gmail.com",
|
|
15
15
|
description="Librería de visualización adaptable para HTML, Dashboards y PDFs en Python",
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import numpy as np
|
|
3
|
+
from datetime import datetime, timedelta
|
|
4
|
+
from viewx.HTML.html_engine import HTML
|
|
5
|
+
|
|
6
|
+
# ── Generar datos de demo ────────────────────────────────────────────────────
|
|
7
|
+
np.random.seed(42)
|
|
8
|
+
n = 200
|
|
9
|
+
|
|
10
|
+
fechas = [datetime(2024, 1, 1) + timedelta(days=i) for i in range(n)]
|
|
11
|
+
regiones = np.random.choice(["Norte", "Sur", "Este", "Oeste", "Centro"], n)
|
|
12
|
+
productos = np.random.choice(["Laptop", "Tablet", "Phone", "Monitor", "Teclado"], n)
|
|
13
|
+
ventas = np.random.randint(500, 10000, n)
|
|
14
|
+
utilidad = ventas * np.random.uniform(0.1, 0.4, n)
|
|
15
|
+
unidades = np.random.randint(1, 50, n)
|
|
16
|
+
activo = np.random.choice([True, False], n)
|
|
17
|
+
|
|
18
|
+
df = pd.DataFrame({
|
|
19
|
+
"fecha" : fechas,
|
|
20
|
+
"region" : regiones,
|
|
21
|
+
"producto" : productos,
|
|
22
|
+
"ventas" : ventas,
|
|
23
|
+
"utilidad" : utilidad.astype(int),
|
|
24
|
+
"unidades" : unidades,
|
|
25
|
+
"activo" : activo,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
print("Columnas disponibles:", df.columns.tolist())
|
|
29
|
+
print(df.head(3))
|
|
30
|
+
|
|
31
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
32
|
+
# DEMO 1 — Layout automático, tema por defecto
|
|
33
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
34
|
+
HTML.auto_generate(
|
|
35
|
+
df,
|
|
36
|
+
title = "Demo 1 · Auto Layout",
|
|
37
|
+
filename = "demo1_auto.html",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
41
|
+
# DEMO 2 — Solo algunas columnas + tema oscuro
|
|
42
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
43
|
+
HTML.auto_generate(
|
|
44
|
+
df,
|
|
45
|
+
columns = ["fecha", "ventas", "utilidad", "region"],
|
|
46
|
+
template = "dark_enterprise",
|
|
47
|
+
title = "Demo 2 · Columnas seleccionadas",
|
|
48
|
+
filename = "demo2_cols.html",
|
|
49
|
+
authors = [
|
|
50
|
+
{"name": "Ana García", "email": "ana@empresa.com"},
|
|
51
|
+
{"name": "Luis Torres", "email": "luis@empresa.com"},
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
56
|
+
# DEMO 3 — Preset kpi_focus + tema void_indigo
|
|
57
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
58
|
+
HTML.auto_generate(
|
|
59
|
+
df,
|
|
60
|
+
columns = ["ventas", "utilidad", "unidades", "region", "producto"],
|
|
61
|
+
template = "void_indigo",
|
|
62
|
+
title = "Demo 3 · KPI Focus",
|
|
63
|
+
filename = "demo3_kpi_focus.html",
|
|
64
|
+
layout = "kpi_focus",
|
|
65
|
+
authors = "Carlos Méndez",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
69
|
+
# DEMO 4 — Preset chart_focus + tema glass_ocean
|
|
70
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
71
|
+
HTML.auto_generate(
|
|
72
|
+
df,
|
|
73
|
+
columns = ["fecha", "ventas", "utilidad", "region"],
|
|
74
|
+
template = "glass_ocean",
|
|
75
|
+
title = "Demo 4 · Chart Focus",
|
|
76
|
+
filename = "demo4_chart_focus.html",
|
|
77
|
+
layout = "chart_focus",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
81
|
+
# DEMO 5 — Preset table_first + tema cyberpunk_neon
|
|
82
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
83
|
+
HTML.auto_generate(
|
|
84
|
+
df,
|
|
85
|
+
columns = ["fecha", "region", "producto", "ventas", "unidades"],
|
|
86
|
+
template = "cyberpunk_neon",
|
|
87
|
+
title = "Demo 5 · Table First",
|
|
88
|
+
filename = "demo5_table_first.html",
|
|
89
|
+
layout = "table_first",
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
93
|
+
# DEMO 6 — Layout 100% personalizado
|
|
94
|
+
# Diseño:
|
|
95
|
+
# [KPI ventas] [KPI utilidad] [KPI unidades] | [Chart barras región]
|
|
96
|
+
# [Chart línea temporal (ventas) ] | [Chart scatter ]
|
|
97
|
+
# [Tabla completa ]
|
|
98
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
99
|
+
HTML.auto_generate(
|
|
100
|
+
df,
|
|
101
|
+
columns = ["fecha", "region", "ventas", "utilidad", "unidades"],
|
|
102
|
+
template = "modern_green",
|
|
103
|
+
title = "Demo 6 · Layout Personalizado",
|
|
104
|
+
filename = "demo6_custom.html",
|
|
105
|
+
authors = [{"name": "Equipo BI", "email": "bi@empresa.com"}],
|
|
106
|
+
layout = [
|
|
107
|
+
# Fila 1: 3 KPIs a la izquierda + 1 chart a la derecha
|
|
108
|
+
{"type": "kpi", "index": 0, "row": 1, "col": 1, "height": 2, "width": 3},
|
|
109
|
+
{"type": "kpi", "index": 1, "row": 1, "col": 4, "height": 2, "width": 3},
|
|
110
|
+
{"type": "kpi", "index": 2, "row": 1, "col": 7, "height": 2, "width": 3},
|
|
111
|
+
{"type": "chart", "index": 1, "row": 1, "col": 10, "height": 7, "width": 3}, # barras región
|
|
112
|
+
|
|
113
|
+
# Fila 2: línea temporal grande + scatter
|
|
114
|
+
{"type": "chart", "index": 0, "row": 3, "col": 1, "height": 5, "width": 6}, # línea tiempo
|
|
115
|
+
{"type": "chart", "index": 2, "row": 3, "col": 7, "height": 5, "width": 3}, # scatter
|
|
116
|
+
|
|
117
|
+
# Fila 3: tabla completa
|
|
118
|
+
{"type": "table", "row": 8, "col": 1, "height": 4, "width": 12},
|
|
119
|
+
]
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
123
|
+
# DEMO 7 — DataFrame con strings numéricos (prueba parseo automático)
|
|
124
|
+
# ════════════════════════════════════════════════════════════════════════════
|
|
125
|
+
df_strings = pd.DataFrame({
|
|
126
|
+
"mes" : ["Ene", "Feb", "Mar", "Abr", "May", "Jun"],
|
|
127
|
+
"ingresos" : ["$12,500", "$9,800", "$15,200", "$11,000", "$18,400", "$14,700"],
|
|
128
|
+
"costos" : ["8500", "7200", "9800", "8100", "12000", "10500"],
|
|
129
|
+
"margen%" : ["32%", "27%", "36%", "26%", "35%", "29%"],
|
|
130
|
+
"ciudad" : ["Bogotá", "Medellín","Cali", "Bogotá", "Cali", "Medellín"],
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
HTML.auto_generate(
|
|
134
|
+
df_strings,
|
|
135
|
+
template = "corporate_blue",
|
|
136
|
+
title = "Demo 7 · Parseo Automático de Strings",
|
|
137
|
+
filename = "demo7_parseo.html",
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
print("\n✅ Todos los dashboards generados:")
|
|
141
|
+
for i, name in enumerate([
|
|
142
|
+
"demo1_auto.html",
|
|
143
|
+
"demo2_cols.html",
|
|
144
|
+
"demo3_kpi_focus.html",
|
|
145
|
+
"demo4_chart_focus.html",
|
|
146
|
+
"demo5_table_first.html",
|
|
147
|
+
"demo6_custom.html",
|
|
148
|
+
"demo7_parseo.html",
|
|
149
|
+
], 1):
|
|
150
|
+
print(f" {i}. {name}")
|
|
@@ -38,7 +38,9 @@ dashboard = HTML(
|
|
|
38
38
|
{"label": "Clientes", "link": "#"},
|
|
39
39
|
{"label": "Reportes", "link": "#"}
|
|
40
40
|
]
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
authors=[{"name": "Emmanuel Ascendra", "email": "ascendraemmanuel@gmail.com"},
|
|
43
|
+
{"name": "Juan Perez", "email": "juanperez@gmail.com"}]
|
|
42
44
|
)
|
|
43
45
|
|
|
44
46
|
# 3. Añadir componentes (row, col, height, width)
|