Chart Types

Bar Charts

Compare categorical or interval data with responsive spacing and axis alignment. Bars automatically start at zero and participate in the same tooltip + legend system as line series.

Example

Bars align with the shared time axis and pick up the tooltip's crosshair position, keeping value comparisons easy across intervals.

Usage

<Chart.Root data={sales} height={320}>
  <Chart.XAxis label="Month" />
  <Chart.YAxis label="Revenue ($)" />
  <Chart.BarSeries
    x="month"
    y="value"
    name="HVAC Service Revenue"
    color="var(--ambient-data-series-4)"
    interval="month"
  />
  <Chart.Legend />
</Chart.Root>

Props

Chart.BarSeries
PropTypeDefaultDescription
dataChartDataPoint[]Root dataOptional dataset override. Defaults to the array supplied to `Chart.Root`.
xstringField used for the horizontal dimension (usually time).
ystringField containing the bar value.
namestringSeries labelLegend and tooltip label. Required when rendering multiple bar series.
colorstringTheme bar tokenBar fill colour. Accepts CSS values or custom variables.
axisstring`"y"`Secondary axis key. Bind to a matching `<Chart.YAxis name="..." />` when needed.
opacitynumber0.9Bar opacity applied to every rectangle.
intervalTimeInterval`"day"`Observable interval for grouping (e.g. `hour`, `day`, `week`, `month`).
unitstringTooltip unit suffix (kWh, %). Useful when mixing metrics with different scales.

Best practices

  • Use the `interval` prop when working with time-series data so bars snap to clean bins.
  • Keep bar colours opaque; leverage `opacity` when overlaying multiple series in the same bucket.
  • Pair bar charts with line overlays by stacking <Chart.LineSeries> siblings inside the same <Chart.Root>.