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

echart-for-react

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

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

相关文章

react 中的高阶组件主要是对于 hooks 之前的类组件来说的,如...
我们上一节了解了组件的更新机制,但是只是停留在表层上,例...
我们上一节了解了 react 的虚拟 dom 的格式,如何把虚拟 dom...
react 本身提供了克隆组件的方法,但是平时开发中可能很少使...
mobx 是一个简单可扩展的状态管理库,中文官网链接。小编在接...
我们在平常的开发中不可避免的会有很多列表渲染逻辑,在 pc ...