Toggle Sidebar B
header.lightDarkMode D

Chart

Charting foundation built on unovis-vue. ChartContainer provides the theming, config context, tooltip wiring, and legend that every chart shares. For ready-made charts see Line, Area, Bar, Pie, and Semi Circle.

When to use?

Reach for the chart-type components (Line, Area, Bar, Pie) for everyday charts and the Semi Circle gauge for progress. Use these primitives directly only when you need a custom Unovis composition; ChartContainer still gives you the shared theming and tooltip/legend plumbing.

Anatomy

Import all parts and piece them together.

vue
<script setup>
import {
  ChartContainer,
  ChartCrosshair,
  ChartLegendContent,
  ChartTooltip,
  VisArea,
  VisAxis,
  VisLine,
  VisXYContainer,
} from "@/components/ui/chart";
</script>

<template>
  <ChartContainer>
    <VisXYContainer>
      <VisArea />
      <VisLine />
      <VisAxis />
      <ChartTooltip />
      <ChartCrosshair />
    </VisXYContainer>
    <ChartLegendContent />
  </ChartContainer>
</template>

API Reference

Props, events, and slots for each sub-component.

ChartContainer

Props

PropTypeDefaultDescription
configChartConfigMap of dataKey → { label, color, icon }. Drives theming and the legend.
cursorbooleanfalseShow the Unovis crosshair line.
classstringExtra classes for the wrapping div.

Slots

SlotDescription
defaultScoped slot exposing { id, config } for the chart leaf components.

ChartTooltipContent

Props

PropTypeDefaultDescription
configChartConfigTheming map for tooltip swatches and labels.
indicator"dot" | "line" | "dashed""dot"Indicator style next to each value.
hideLabelbooleanfalseHide the tooltip title row.
labelFormatter(d) => stringFormat the title (e.g. dates).

ChartLegendContent

Props

PropTypeDefaultDescription
verticalAlign"top" | "bottom""bottom"Position relative to the chart.
hideIconbooleanfalseHide per-series icons from the config.