Skip to Content
Kiva

Chart

Comprehensive charting library with 13 chart types, VChart adapter, touch interactions, and animations.

iOSAndroid
Preview Chart on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @kivacore/ui-cli add @kivacore/rn-chart
Required Packages(1 package)
pnpm add react-native-svg

Usage

import { KivaLineChart } from '@/components/kiva-native/chart';

const data = {
  categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
  series: [
    { name: 'Revenue', data: [30, 40, 35, 50, 49] },
    { name: 'Expenses', data: [20, 25, 30, 28, 32] }
  ]
};

<KivaLineChart
  data={data}
  title="Revenue vs Expenses"
  showGrid
  animated
  height={300}
/>

Chart Types

Line Chart

import { KivaLineChart } from '@/components/kiva-native/chart';

<KivaLineChart
  data={{ categories: ['A', 'B', 'C'], series: [{ name: 'S1', data: [10, 20, 15] }] }}
  smooth
  showArea
  showGrid
  showCrosshair
  showTooltip
/>

Bar Chart

import { KivaBarChart } from '@/components/kiva-native/chart';

<KivaBarChart
  data={{ categories: ['Q1', 'Q2', 'Q3'], series: [{ name: '2024', data: [120, 200, 150] }] }}
  stack
  horizontal
/>

Pie Chart

import { KivaPieChart } from '@/components/kiva-native/chart';

<KivaPieChart
  data={[
    { name: 'Chrome', value: 65 },
    { name: 'Safari', value: 18 },
    { name: 'Firefox', value: 10 }
  ]}
  donut
  showLabels
/>

Area Chart

import { KivaAreaChart } from '@/components/kiva-native/chart';

<KivaAreaChart
  data={{ categories: ['Mon', 'Tue', 'Wed'], series: [{ name: 'Users', data: [120, 132, 101] }] }}
  smooth
  stack
/>

Scatter Chart

import { KivaScatterChart } from '@/components/kiva-native/chart';

<KivaScatterChart
  data={{ series: [{ name: 'Points', data: [{ x: 10, y: 20 }, { x: 30, y: 40 }] }] }}
  showGrid
/>

Radar Chart

import { KivaRadarChart } from '@/components/kiva-native/chart';

<KivaRadarChart
  data={{
    categories: ['Speed', 'Power', 'Defense', 'Agility', 'Stamina'],
    series: [{ name: 'Player', data: [80, 90, 70, 85, 75] }]
  }}
/>

Gauge Chart

import { KivaGaugeChart } from '@/components/kiva-native/chart';

<KivaGaugeChart
  data={{ value: 72, min: 0, max: 100, label: 'Score' }}
  showValue
/>

Funnel Chart

import { KivaFunnelChart } from '@/components/kiva-native/chart';

<KivaFunnelChart
  data={[
    { name: 'Visits', value: 5000 },
    { name: 'Leads', value: 2500 },
    { name: 'Sales', value: 500 }
  ]}
  showLabels
/>

Heatmap Chart

import { KivaHeatmapChart } from '@/components/kiva-native/chart';

<KivaHeatmapChart
  data={{
    xLabels: ['Mon', 'Tue', 'Wed'],
    yLabels: ['Morning', 'Afternoon', 'Evening'],
    data: [
      { x: 0, y: 0, value: 10 },
      { x: 1, y: 1, value: 25 },
      { x: 2, y: 2, value: 15 }
    ]
  }}
  showValues
/>

Treemap Chart

import { KivaTreemapChart } from '@/components/kiva-native/chart';

<KivaTreemapChart
  data={[
    { name: 'Engineering', value: 45 },
    { name: 'Design', value: 25 },
    { name: 'Marketing', value: 30 }
  ]}
  showLabels
  showValues
/>

Candlestick Chart

import { KivaCandlestickChart } from '@/components/kiva-native/chart';

<KivaCandlestickChart
  data={{
    data: [
      { date: 'Mon', open: 100, high: 120, low: 95, close: 115 },
      { date: 'Tue', open: 115, high: 125, low: 110, close: 108 }
    ]
  }}
  showVolume
/>

Sparkline Chart

import { KivaSparklineChart } from '@/components/kiva-native/chart';

<KivaSparklineChart
  data={{ data: [5, 10, 5, 20, 8, 15] }}
  width={200}
  height={40}
  showArea
  smooth
/>

Combo Chart (Bar + Line)

import { KivaComboChart } from '@/components/kiva-native/chart';

<KivaComboChart
  data={{
    categories: ['Q1', 'Q2', 'Q3', 'Q4'],
    series: [
      { name: 'Revenue', data: [120, 200, 150, 80], type: 'bar' },
      { name: 'Growth', data: [10, 15, 12, 8], type: 'line', smooth: true }
    ]
  }}
/>

VChart Adapter

The KivaVChart component accepts VChart-compatible spec format and renders the appropriate chart.

import { KivaVChart } from '@/components/kiva-native/chart';

<KivaVChart
  spec={{
    type: 'bar',
    data: [{ values: [{ x: 'A', y: 10 }, { x: 'B', y: 20 }] }],
    xField: 'x',
    yField: 'y'
  }}
  width={300}
  height={200}
/>

API Reference — Base Props

All chart components share these base props:

PropTypeDefaultDescription
widthnumberscreen widthChart width in pixels
heightnumber300Chart height in pixels
titlestring—Chart title text
descriptionstring—Chart description text
loadingbooleanfalseShow loading state
errorstring—Error message to display
classNamestring—Additional CSS classes
configChartConfig—Axis, grid, legend, tooltip configuration
animatedbooleanfalseEnable entry animations
animationDurationnumber500Animation duration in milliseconds
animationDelaynumber0Animation delay in milliseconds

API Reference — Touch Props

Charts with touch support (Line, Area, Combo) accept:

PropTypeDefaultDescription
showCrosshairbooleanfalseShow crosshair line on touch
showTooltipbooleanfalseShow tooltip on touch
tooltipComponent(data: TooltipData) => ReactNode—Custom tooltip renderer
onTouch(point: TooltipData | null) => void—Touch event callback

API Reference — Chart Config

PropTypeDefaultDescription
padding{ top, right, bottom, left }{ 20, 20, 50, 50 }Chart SVG internal padding
xAxisChartAxis—X axis configuration
yAxisChartAxis—Y axis configuration
gridChartGrid—Grid line configuration
legendChartLegend—Legend position and alignment
tooltipChartTooltip—Tooltip formatting

Components

ComponentDescription
KivaLineChartLine chart with smooth curves, area fill, crosshair
KivaBarChartVertical/horizontal bar chart with stacking
KivaPieChartPie/donut chart with labels
KivaAreaChartStacked area chart with smooth curves
KivaScatterChartScatter plot with grid
KivaRadarChartRadar/spider chart
KivaGaugeChartSemicircular gauge with value display
KivaFunnelChartFunnel/pyramid chart with labels
KivaHeatmapChartColor-encoded matrix chart
KivaTreemapChartProportional rectangle layout
KivaCandlestickChartOHLC financial chart with volume
KivaSparklineChartInline mini chart (no axes)
KivaComboChartCombined bar + line chart
KivaVChartVChart spec adapter

Core Sub-Components

ComponentDescription
KivaChartAxisAxis labels and ticks
KivaChartGridBackground grid lines
KivaChartLegendColor legend with series names
KivaChartCrosshairTouch crosshair overlay
KivaChartTooltipFloating data tooltip

Hooks

HookDescription
useChartAnimationReturns animated progress value (0 → 1) for chart transitions
useChartTouchPan responder for crosshair and tooltip interactions

Type Exports

TypeDescription
LineChartPropsProps for KivaLineChart
BarChartPropsProps for KivaBarChart
PieChartPropsProps for KivaPieChart
AreaChartPropsProps for KivaAreaChart
ScatterChartPropsProps for KivaScatterChart
RadarChartPropsProps for KivaRadarChart
GaugeChartPropsProps for KivaGaugeChart
FunnelChartPropsProps for KivaFunnelChart
HeatmapChartPropsProps for KivaHeatmapChart
TreemapChartPropsProps for KivaTreemapChart
CandlestickChartPropsProps for KivaCandlestickChart
SparklineChartPropsProps for KivaSparklineChart
ComboChartPropsProps for KivaComboChart
KivaVChartPropsProps for KivaVChart adapter
ChartConfigChart configuration object
ChartDataGeneric chart data type
ChartSeriesSeries data definition
TooltipDataTooltip callback data
VChartSpecVChart-compatible spec type

On this page