Bar1DChart
The Bar1DChart component renders a one-dimensional bar chart for comparing numerical values across discrete categories. Each bar represents a single category with its corresponding value, making it ideal for simple horizontal or vertical bar comparisons.
Usage
Props
labelOnYAxis?: boolean
If set to true, category labels will be displayed on the Y-axis and bars will be laid out horizontally.
Defaults to false, where labels appear on the X-axis and bars are rendered vertically.
marks: Array<object> (required)
An array of data points defining each bar. Each mark includes:
-
category: stringThe category label for the bar. -
value: numberThe numeric value represented by the bar length. -
Additional optional
ChartMarkProps: UseChartMarkPropsto further style or annotate the bars, including:foregroundStyleopacitysymbolannotationoffsetzIndex, etc.
Example
Run the Chart
Use Cases
Bar1DChart is best suited for:
- Comparing discrete values across categories
- Displaying ranked items or sorted values
- Visualizing simple datasets in a clear and minimal layout
