Overview
CirclePorcentaje uses ECharts to render a circular gauge that shows the percentage of a current value relative to a maximum value. The component features:- Circular progress indicator with gradient colors
- Center text display showing percentage or “Sin datos” (No data)
- Automatic percentage calculation from value and maxValue
- Visual feedback with different colors for data/no-data states
- Shadow effects for depth perception
Props
Current value of the metric being measured
Maximum value for percentage calculation
Primary color for the progress indicator gradient. The component creates a three-color gradient using this as the midpoint.
Usage Example
Visual Design
Gradient Progress
The progress indicator uses a three-stop linear gradient:Ring Properties
- Progress width: 24px rounded cap
- Background ring: Same width with shadow effect
- Start angle: 90° (top)
- End angle: -270° (full circle)
- Radius: 90% of container
States
| State | Progress Color | Text | Center Text Color |
|---|---|---|---|
| Has Value | Gradient (light → custom → dark) | {percentage} % | #0f2a44 |
| No Data | #cbd5e1 (gray) | Sin datos | #0f2a44 |
Percentage Calculation
The component automatically calculates percentage with 2 decimal precision:- Checks if value and maxValue are valid numbers
- Returns 0% if either value is null, undefined, empty string, or NaN
- Prevents division by zero (defaults maxValue to 1 if invalid)
Real-World Use Cases
- Tank Capacity
- System Load
- Treatment Progress
Display water tank fill level as a percentage:
Integration with Dashboard
The component is registered in the Home dashboard asCirclePorcentaje and automatically receives real-time data updates every 30 seconds through the InfluxDB integration:
Differences from Other Gauges
| Feature | CirclePorcentaje | GaugeSpeed | LiquidFillPorcentaje |
|---|---|---|---|
| Shape | Full circle (360°) | Semi-circle (180°) | Container shapes |
| Animation | None | Needle movement | Wave motion |
| Display | Percentage only | Value + unit | Percentage with waves |
| Best For | Completion rates | Speed/pressure | Tank levels |
Accessibility
- Text alternative: Center text shows percentage or “Sin datos”
- Color independence: Gray state for no data is distinguishable
- Contrast: Dark text on light background for readability
Performance
- Lightweight ECharts gauge configuration
- No animations (instant updates)
- Suitable for multiple instances on a single dashboard
- Efficient percentage recalculation
Related Components
- Gauge - Speedometer-style gauge with needle
- Liquid Fill - Animated tank level indicator
- Boolean Chart - LED-style on/off indicators
