RuleChart
RuleChart
The RuleChart component displays a range or duration for each labeled item as a horizontal or vertical rule. It is suitable for visualizing time spans, data ranges, or active periods across categories.
Example
Props
labelOnYAxis (optional)
- Type:
boolean - Default:
false - Description:
When set to
true, the chart switches to horizontal mode and displays category labels along the Y-axis. Otherwise, labels appear on the X-axis with vertical rules.
marks (required)
-
Type:
-
Description: Defines the rules (lines or spans) to be drawn on the chart.
Each mark includes:
label: The category label or time unit (e.g.,"Trees"or aDate).start: The numeric starting value of the rule.end: The numeric ending value of the rule.unit: (optional) The time unit, useful when the chart represents calendar-based data (e.g.,.month,.day).
Additional ChartMarkProps can be applied to customize visual styling:
foregroundStyle— Controls color or styleannotation— Adds annotation labelsopacity— Adjusts transparency
Full Example
Use Cases
- Displaying periods of activity or growth (e.g., pollen seasons)
- Showing task durations or project phases
- Visualizing ranges in data for different categories
