A simple chart components based on React and Echarts(3.x & 4.x)
Install
npm install --save echarts @cany/r-charts
Usage
to use directly
;;;// import 'echarts/lib/chart/bar';// import 'echarts/lib/chart/pie';// .... <RCharts option=this theme='ThemeName' events=thisevents/>
inherit
// ReLine.js;; {}; // main.js<ReLine option=this theme='ThemeName' events=thisevents/>
Component Props
-
option
(required, object)the echarts option config, can see option.
-
style
(optional, object)the
style
of echarts container. it is{ height: 300 }
by default. -
className
(optional, string)the
class
of echarts container. -
theme
(optional, string)the
theme
of echarts, should use registerTheme before using it -
events
(optional, object)binding the echarts event, it will be invoked with the
echarts event object
as paramters.let events ='click': thisonChartClick...<RChartsoption= thisstyle= height: 300events= events/>for more events, see events
-
initOptions
(optional, object)the third options when create an echarts instance by invoking the echart.init api
-
setOptionOpts
(optional, object)the second options as object, when set echarts instance by invoking the echartsInstance.setOption api
Component API
-
getEchartsInstance()
get the echarts instance, then you can use any
API of echarts
. e.g:<RChartsref= { thisrcharts = inst }option= this/>const echarts = thisrchartsechartsAbout API of echarts instance, can see echartsInstance.
Licensee
MIT@kimozhang.