Docyrus

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 @docyrus/cli add @docyrus/rn-chart
Required Packages(1 package)
pnpm add react-native-svg

Usage

import { DocyLineChart } from '@/components/docyrus-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] }
  ]
};

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

Chart Types

Line Chart

import { DocyLineChart } from '@/components/docyrus-native/chart';

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

Bar Chart

import { DocyBarChart } from '@/components/docyrus-native/chart';

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

Pie Chart

import { DocyPieChart } from '@/components/docyrus-native/chart';

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

Area Chart

import { DocyAreaChart } from '@/components/docyrus-native/chart';

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

Scatter Chart

import { DocyScatterChart } from '@/components/docyrus-native/chart';

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

Radar Chart

import { DocyRadarChart } from '@/components/docyrus-native/chart';

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

Gauge Chart

import { DocyGaugeChart } from '@/components/docyrus-native/chart';

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

Funnel Chart

import { DocyFunnelChart } from '@/components/docyrus-native/chart';

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

Heatmap Chart

import { DocyHeatmapChart } from '@/components/docyrus-native/chart';

<DocyHeatmapChart
  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 { DocyTreemapChart } from '@/components/docyrus-native/chart';

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

Candlestick Chart

import { DocyCandlestickChart } from '@/components/docyrus-native/chart';

<DocyCandlestickChart
  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 { DocySparklineChart } from '@/components/docyrus-native/chart';

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

Combo Chart (Bar + Line)

import { DocyComboChart } from '@/components/docyrus-native/chart';

<DocyComboChart
  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 DocyVChart component accepts VChart-compatible spec format and renders the appropriate chart.

import { DocyVChart } from '@/components/docyrus-native/chart';

<DocyVChart
  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
DocyLineChartLine chart with smooth curves, area fill, crosshair
DocyBarChartVertical/horizontal bar chart with stacking
DocyPieChartPie/donut chart with labels
DocyAreaChartStacked area chart with smooth curves
DocyScatterChartScatter plot with grid
DocyRadarChartRadar/spider chart
DocyGaugeChartSemicircular gauge with value display
DocyFunnelChartFunnel/pyramid chart with labels
DocyHeatmapChartColor-encoded matrix chart
DocyTreemapChartProportional rectangle layout
DocyCandlestickChartOHLC financial chart with volume
DocySparklineChartInline mini chart (no axes)
DocyComboChartCombined bar + line chart
DocyVChartVChart spec adapter

Core Sub-Components

ComponentDescription
DocyChartAxisAxis labels and ticks
DocyChartGridBackground grid lines
DocyChartLegendColor legend with series names
DocyChartCrosshairTouch crosshair overlay
DocyChartTooltipFloating 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 DocyLineChart
BarChartPropsProps for DocyBarChart
PieChartPropsProps for DocyPieChart
AreaChartPropsProps for DocyAreaChart
ScatterChartPropsProps for DocyScatterChart
RadarChartPropsProps for DocyRadarChart
GaugeChartPropsProps for DocyGaugeChart
FunnelChartPropsProps for DocyFunnelChart
HeatmapChartPropsProps for DocyHeatmapChart
TreemapChartPropsProps for DocyTreemapChart
CandlestickChartPropsProps for DocyCandlestickChart
SparklineChartPropsProps for DocySparklineChart
ComboChartPropsProps for DocyComboChart
DocyVChartPropsProps for DocyVChart adapter
ChartConfigChart configuration object
ChartDataGeneric chart data type
ChartSeriesSeries data definition
TooltipDataTooltip callback data
VChartSpecVChart-compatible spec type

On this page