LineCategoryChart
The LineCategoryChart component displays multiple line series categorized by a secondary key, allowing you to compare trends across distinct groups (categories) along a shared axis of discrete labels.
It is ideal for grouped comparisons across labeled segments (e.g., departments, months, stages) and is especially useful for showing how each category's values evolve over the same set of labels.
Example Scenario
In this example, different departments (Production, Marketing, Finance) are plotted along the X-axis, and each product category (Gizmos, Gadgets, Widgets) is represented by its own line.
Usage
Props
labelOnYAxis?: boolean
- If
true, the category labels (e.g., "Production", "Marketing") are displayed on the Y-axis, and the lines are drawn horizontally. - If
false(default), labels are on the X-axis, and lines are rendered vertically.
marks: Array<object> (required)
Each item defines a data point on the chart. It must include:
-
label: string | DateThe shared axis label (e.g., phase, department, month) across which each line progresses. -
value: numberThe value to be plotted at that label for the corresponding category. -
category: stringDefines the group to which this point belongs. Eachcategorygenerates its own line.
Additional fields from ChartMarkProps may also be used for styling (e.g., foregroundStyle, symbol, annotation).
Full Example
Use Cases
LineCategoryChart is useful for:
- Visualizing grouped comparisons across discrete stages
- Showing category trends over consistent labels
- Comparing multi-line metrics in business, finance, marketing, etc.
