Visualización de Datos graphstatdata
Metric with Sparkline
Tarjeta de métricas con gráfico sparkline SVG en miniatura y tendencia reciente.
Vista Previa en Vivo
Sessions
2,415
Uso
Copia y pega este código directamente en tu página de Astro:
astro
---
import { MetricwithSparkline } from 'astro-component-kit';
---
<SparklineStatCard>Content</SparklineStatCard> ---
import { MetricwithSparkline } from 'astro-component-kit';
---
<SparklineStatCard>Content</SparklineStatCard> Instalación Manual
Si no estás usando el paquete npm, crea un archivo nuevo y pega el siguiente código: src/components/lib/MetricwithSparkline.astro:
astro
---
---
<div class="spark-card">
<div class="top"><span>Sessions</span><h3>2,415</h3></div>
<div class="graph">
<svg viewBox="0 0 100 30">
<path d="M0 25 L10 20 L20 22 L30 15 L40 18 L50 25 L60 10 L70 12 L80 5 L90 8 L100 2" fill="none" stroke="#6366f1" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
</div>
<style>
.spark-card { padding: 1.5rem; background: #111; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; min-width: 160px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
h3 { margin: 4px 0; color: #fff; font-size: 1.5rem; font-weight: 800; }
span { font-size: 0.75rem; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.graph { margin-top: 15px; height: 30px; opacity: 0.8; }
</style> ---
---
<div class="spark-card">
<div class="top"><span>Sessions</span><h3>2,415</h3></div>
<div class="graph">
<svg viewBox="0 0 100 30">
<path d="M0 25 L10 20 L20 22 L30 15 L40 18 L50 25 L60 10 L70 12 L80 5 L90 8 L100 2" fill="none" stroke="#6366f1" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
</div>
<style>
.spark-card { padding: 1.5rem; background: #111; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; min-width: 160px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
h3 { margin: 4px 0; color: #fff; font-size: 1.5rem; font-weight: 800; }
span { font-size: 0.75rem; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.graph { margin-top: 15px; height: 30px; opacity: 0.8; }
</style>
Información Rápida
- Categoría
- Visualización de Datos
- Nombre de archivo
MetricwithSparkline.astro- Dependencias
- Ninguna — Astro nativo + CSS puro
- Etiquetas
- graphstatdata