A very simple echarts(v3.0) wrapper for react.

本文介绍了一个简单的React图表组件echarts-for-react,该组件为ECharts v3.0提供了一个React封装。通过简单的安装步骤和示例代码,本文展示了如何在React应用中集成并使用ECharts进行数据可视化。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

echart-for-react

A very simple echarts(v3.0) wrapper for react. https://github.com/hustcc/echarts-for-react

npm npm npm

install

npm install echart-for-react

How to run the demo:

git clone git@github.com:hustcc/echarts-for-react.git

npm install

npm start

then open http://127.0.0.1:8080/ in your browser. or see http://hustcc.github.io/echarts-for-react/

usage

Simple demo code: more can see: http://hustcc.github.io/echarts-for-react/

import React from 'react';
import ReactEcharts from '../src/echarts-for-react';

<ReactEcharts
    option={this.getOtion()} 
    height={300} 
    onEvents={onEvents} />

component props

  • option

the echart option config, can see http://echarts.baidu.com/option.html#title.

  • height

the height of echart. number, with px as it's unit.

  • onChartReady

when chart is ready, will callback the function with the echart object as it's paramter.

  • onEvents

binding the echarts event, will callback the function with the echart event parameter, and the echart object. e.g:

let onEvents = {
    'click': this.onChartClick,
    'legendselectchanged': this.onChartLegendselectchanged
}
...
<ReactEcharts
    option={this.getOtion()} 
    height={300} 
    onEvents={onEvents} />

for more event name, see: http://echarts.baidu.com/api.html#events

TODO

  1. theme props

  2. echart API

LICENSE

MIT

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值