Chart

A simple native bar chart.

Import

import { Chart } from "@tarve/core";

Usage

Chart.tsx
import { Chart } from "@tarve/core";

<Chart
  height={200}
  data={[
    { label: "Jan", value: 186 },
    { label: "Feb", value: 305 },
    { label: "Mar", value: 237, color: "#7c5cff" },
    { label: "Apr", value: 73 },
  ]}
/>

Props

PropTypeDefault
data required readonly ChartDatum[]—
barWidth number36
height number180
max number—
showLabels booleantrue
showValues booleantrue

Common props

Shared by every component. See descriptions →

childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyle

Types

ChartDatum
interface ChartDatum {
  label: string;
  value: number;
  color?: string;
}