npm echarts-for-react 1.4.1
v1.4.1

latest releases: 3.0.2, 3.0.1, 3.0.0...
6 years ago

新特性:自定义 import / 动态加载模块

在保持原来的使用方式不变的情况下, 用户可以可以自定义导入 echarts 中的模块,从而保证在少量使用 echarts 的情况下,减少打包出来的 JavaScript 文件大小。具体做法如下:

import React from 'react';
// import the core library.
import ReactEchartsCore from 'echarts-for-react/lib/core';
// then import echarts modules those you have used manually.
import echarts from 'echarts/lib/echarts';
import 'echarts/lib/chart/bar';
import 'echarts/lib/component/tooltip';

// The usage of ReactEchartsCore are same with above.
<ReactEchartsCore
  echarts={echarts}
  option={this.getOption()}
  notMerge={true}
  lazyUpdate={true}
  theme={"theme_name"}
  onChartReady={this.onChartReadyCallback}
  onEvents={EventsDict} />

使用上,除了 import 的文件不一致之外,组件的使用方式和 props 和原来没有任何区别。

Don't miss a new echarts-for-react release

NewReleases is sending notifications on new releases.