LiquidFillPorcentaje component renders an animated liquid fill gauge using Apache ECharts. It supports multiple shapes and can display either percentage values or absolute values with custom units.
Basic Usage
Props
The current value to display. Can be any numeric value.
The maximum value for calculating the fill percentage. The fill level is calculated as
value / maxValue.The primary color for the liquid fill gradient. Accepts hex color codes.
The shape of the liquid fill gauge. Available options:
circle- Circular gauge with 90% radiusrect- Rectangular gaugeroundRect- Rounded rectangletriangle- Triangular gaugediamond- Diamond-shaped gaugearrow- Arrow-shaped gaugepin- Pin/location marker shape
When
true, displays the value as a percentage (0-100%). When false, displays the raw value with optional unit.Whether to show the gradient border outline around the gauge.
Unit label to display after the value (e.g., “L”, “m³”, “°C”). Only shown when
porcentage is false.Additional text to display below the main value.
Advanced mode for displaying multiple variables. See Multiple Values Mode below.
Examples
Percentage Display
Value with Units
Different Shapes
Multiple Values Mode
The component supports displaying multiple related variables simultaneously:Multiple Values Structure
Primary value to display. Can be a number or an object with a
value property.Maximum value for calculating fill percentage.
Secondary variable configuration:
value- The secondary value to displayunit- Unit label for the secondary valuevarsInflux- Object indicating which InfluxDB variables are active
Visual Features
Gradient Colors
The liquid fill uses a three-stop vertical gradient:- Top (offset 0):
#a5f3fc(light cyan) - Middle (offset 0.5): Your custom color
- Bottom (offset 1):
#0c4a6e(dark blue)
Border Gradient
Whenborder={true}, the outline uses a diagonal gradient:
- Start:
#93c5fd(light blue) - End:
#1e3a8a(dark blue)
Dynamic Text Color
Text color automatically adjusts based on fill level:- Above 60% fill: White text (
#ffffff) - Below 60% fill: Dark blue text (
#0f2a44)
Animation
- Wave animation: 4000ms period when data is present
- Fill animation: 1800ms cubic-out easing on initial load
- No animation: When value is invalid or zero
Shape Configurations
Each shape has optimized settings:| Shape | Radius | Amplitude | Font Size | Outline Distance |
|---|---|---|---|---|
| circle | 90% | 8 | 24px | 4 |
| rect | 85% | 5 | 24px | 4 |
| roundRect | 90% | 8 | 24px | 4 |
| triangle | 80% | 8 | 22px | 0 |
| diamond | 90% | 8 | 22px | 4 |
| arrow | 70% | 8 | 18px | 4 |
| pin | 100% | 8 | 24px | 4 |
Data Validation
The component validates input values:- Checks for
null,undefined, empty strings, andNaN - Displays “Sin datos” (No data) when value is invalid
- Clamps percentage to 0-1 range (0-100%)
- Handles missing or invalid
maxValuegracefully
Dependencies
Requires theecharts-liquidfill plugin:

