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
theme props
echart API
LICENSE
MIT
原文地址:https://www.jb51.cc/react/306684.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。