← All migration guides

Migrate from Apache ECharts

Replace 300kb+ ECharts bundle with Chart.ts at under 15kb. Get Tailwind CSS support and a simpler API while keeping all the chart types you need.

-npm uninstall echarts echarts-for-react
+npm install @chartts/react

Migration Steps

  1. 1Replace echarts imports with @chartts/react
  2. 2Convert ECharts option objects to JSX props
  3. 3Replace ECharts theme system with Tailwind CSS classes
  4. 4Remove echarts.init() and dispose() lifecycle management
  5. 5Convert ECharts event handlers to React event props
  6. 6Replace ECharts tooltip formatters with Chart.ts tooltip props

Code Comparison

BEFOREECharts Line Chart
import ReactECharts from "echarts-for-react"

const option = {
  xAxis: {
    type: "category",
    data: ["Jan", "Feb", "Mar", "Apr"],
  },
  yAxis: { type: "value" },
  series: [{
    data: [4200, 5800, 7100, 9200],
    type: "line",
    smooth: true,
    areaStyle: {
      color: "rgba(6, 182, 212, 0.1)",
    },
    lineStyle: {
      color: "#06b6d4",
    },
  }],
  tooltip: { trigger: "axis" },
}

<ReactECharts option={option} style={{ height: 300 }} />
AFTERChart.ts Line Chart
import { LineChart } from "@chartts/react"

<LineChart
  data={[
    { month: "Jan", revenue: 4200 },
    { month: "Feb", revenue: 5800 },
    { month: "Mar", revenue: 7100 },
    { month: "Apr", revenue: 9200 },
  ]}
  x="month"
  y="revenue"
  smooth
  className="h-72"
  lineClassName="stroke-cyan-400"
  areaClassName="fill-cyan-400/10"
/>

Key Differences

FeatureEChartsChart.ts
Bundle~300kb+ min+gzip<15kb min+gzip
APINested option objectsFlat JSX props
StylingTheme config objectsTailwind CSS classes
Data formatSeparate x data + series dataArray of objects
Lifecycleinit(), dispose(), resize()Automatic (React manages)
Tree-shakingPartial (still huge)Full, ~2-4kb per chart
Dark modeTheme config switchingdark: CSS variants

Ready to migrate?

Get started with Chart.ts in 30 seconds.

$npm install @chartts/react