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

前端之家收集整理的这篇文章主要介绍了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@H_403_3@

@H_403_3@

install

npm install echart-for-react

How to run the demo:@H_403_3@

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/@H_403_3@

usage

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

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

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

component props

  • option@H_403_3@

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

  • height@H_403_3@

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

  • onChartReady@H_403_3@

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

  • onEvents@H_403_3@

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

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@H_403_3@

TODO

  1. theme props@H_403_3@

  2. echart API@H_403_3@

LICENSE

MIT@H_403_3@ 原文链接:https://www.f2er.com/react/306684.html

猜你在找的React相关文章