TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CspmIT/mas-agua-front/llms.txt
Use this file to discover all available pages before exploring further.
BarDataSet component renders multi-series bar charts using Apache ECharts with dataset-based configuration. It supports multiple data series with automatic legend and tooltip generation.
Basic Usage
Props
Two-dimensional array where:
- First row: Column headers (category label + series names)
- Remaining rows: Data rows (category + values for each series)
[headers, ...dataRows]Data Format
The component uses ECharts’ dataset format:Header Row (Index 0)
- First element: Category column name (e.g., “product”, “month”)
- Remaining elements: Series names for the legend (e.g., “2021”, “2022”)
Data Rows (Index 1+)
- First element: Category label (x-axis label)
- Remaining elements: Numeric values for each series
Examples
Sales by Product
Monthly Metrics
Performance Comparison
Chart Configuration
Dataset
Data is provided via ECharts’ dataset feature:- Cleaner data structure
- Automatic series generation
- Easy data updates
Axes
X-Axis (Category):- Automatically reads categories from first column
- Labels from data rows
- Auto-scales based on data range
- Displays grid lines
Series
Series are defined based on data columns:{ type: 'bar' } creates a series from the corresponding data column.
Legend
- Automatically populated from header row
- Shows/hides series on click
- Positioned at top by default
Tooltip
- Triggered on hover
- Shows all series values for the category
- Default formatting
Toolbox
Customization
Number of Series
Add or remove series by adjusting the header row andseries array:
Series Configuration
Customize individual series:Enable Save Image
Data Requirements
Minimum Data
Column Count
- Header: 1 category column + N series columns
- Data rows: Must match header column count
- Series array: Must have N entries (one per series column)
Value Types
- Category column: Strings
- Series columns: Numbers
- Empty/null values: Show gaps in bars
Use Cases
- Sales comparison: Products across time periods
- Performance metrics: Multiple metrics for different entities
- Resource usage: Usage by category over time
- Survey results: Response distributions across groups
- Budget analysis: Planned vs. actual across departments
- A/B testing: Metrics across test variants
Responsive Behavior
The chart automatically:- Fills its container width and height
- Resizes on window resize events
- Adjusts bar widths based on data count
- Scales axes dynamically
Container Requirements
- Minimum width: 400px
- Minimum height: 300px
- Height should accommodate legend and axis labels
- Wider containers work better for many categories
Empty/Invalid Data
Whendata is:
nullorundefined: Dataset is empty array[]- Empty array
[]: Chart renders with no data - Missing values: Gaps appear in the chart
Stacked Bars
To create stacked bars, modify the series configuration:stack value will be stacked.
See: BarDataSet.jsx
