⛳️ Apache ECharts components for React wrapper. 一个简单的 Apache echarts 的 React 封装。
Full Changelog: https://github.com/hustcc/echarts-for-react/compare/v3.0.1...v3.0.2
本次升级主要的内容在于:
之前是在 React 0.14 时代,还是使用 props-types 校验 props,然后 ts 类型定义单独自己手写,也非常痛苦。所以这次直接使用 ts 写,自动生成 类型定义 文件。
之前使用 jest-canvas-mock 进行单元测试,毕竟是 mock 而不是真实运营,所有一些逻辑测试不到,覆盖率一直提不上去。
所以这次换成了 jest-electron,真实运行,覆盖率直接提升到 ,运行也改成使用 GitHub action 了。当然 jest-electron 这个模块,也是为了给 AntV 系列技术栈做单测,而开发的轮子,个人觉得还是挺好用的。
之前的官网是自己初学 React 的时候,完全自己搭建的,没有 lint、ci,代码凌乱,样式也不好看。所以这次直接使用 dumi 这个库自动生成,网站全部 markdown 开发,也方便大家遇到官网 typo,直接一键提交 PR。
同时 Example 实例也可直接一键导航到其他代码编辑工具上。
项目很简单,概念也很简单,所以直接 Readme 作为 document,但是之前的文档结构、样式排版比较凌乱,所以按照现在的个人审美,重新写了写!
Fix issues:
onEvents
is null, will thrown, #154Fixed:
add new props of component named
opts
. It can be used to set render chart withsvg
.
element-resize-event
to v2.0.9在保持原来的使用方式不变的情况下, 用户可以可以自定义导入 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 和原来没有任何区别。