# echarts-tsx

> The simplest React wrapper for Apache ECharts with Hooks and TypeScript.

Latest version **1.0.4** (published 2021-06-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install echarts-tsx
pnpm add echarts-tsx
yarn add echarts-tsx
bun add echarts-tsx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-06-11 |
| First published | 2021-06-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | xuzhiwei |
| Maintainers | salita |
| Keywords | react, component, echarts-react, echarts, react-echarts, chart, charts, hooks, react-component, typescript |

## Links

- npm: https://www.npmjs.com/package/echarts-tsx
- Repository: https://github.com/gcdxuzhiwei/echarts-tsx
- Homepage: https://github.com/gcdxuzhiwei/echarts-tsx#readme
- Issues: https://github.com/gcdxuzhiwei/echarts-tsx/issues
- npm.io page: https://npm.io/package/echarts-tsx

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-06-11
- 1.0.3 — 2021-06-11
- 1.0.2 — 2021-06-11
- 1.0.1 — 2021-06-11
- 1.0.0 — 2021-06-11

## README

# echarts-tsx

The simplest React wrapper for Apache ECharts with Hooks and TypeScript.

使用 hooks 和 ts 简易封装的 echarts 组件。

🚀🚀🚀 支持 ts、自动根据元素宽高 resize、按需引入 🚀🚀🚀

Props

```tsx
{
  option: EChartOption; // 配置项
  resize?: boolean; // 是否resize,默认为true
  // 👇以下三个是setoption的选项,见https://echarts.apache.org/v4/zh/api.html#echartsInstance.setOption
  notMerge?: boolean;
  lazyUpdate?: boolean;
  silent?: boolean;
}
```

Export

```tsx
// default 组件
// 👇type
ChartRef; // ref的类型，包含echart实例
ECharts; //echart实例的类型
EChartOption; // 配置项类型
```

Quick Start

install

```tsx
npm install echarts-tsx
```

import component & import charts and components you need

```tsx
import Echarts, { ChartRef, EChartOption } from "echarts-tsx";

import "echarts/lib/chart/line";
import "echarts/lib/component/tooltip";
```

init option and ref and use component

```tsx
const [option, setOption] = useRef<EChartOption>(null);
const DOM = useRef<chartRef>(null);

// you can fetch data and use setOption to update chart
// you can use DOM.current.echart to use Instance,example👇
useEffect(()=>{
  DOM.current.echart.on('click',()=>{
    // ...
  })
},[])

<Echarts ref={DOM} option={option} />;
```

---
_Source: https://npm.io/package/echarts-tsx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
