Merge pull request #1419 from 2betop/chart

加入 ecStat 是 Apache ECharts (incubating) 的统计和数据挖掘工具
This commit is contained in:
RickCole 2021-01-22 11:31:38 +08:00 committed by GitHub
commit 9b273c0655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -44,6 +44,7 @@
"dom-helpers": "^3.3.1",
"downshift": "3.1.4",
"echarts": "5.0.0",
"echarts-stat": "^1.2.0",
"exceljs": "^4.2.0",
"file-saver": "^2.0.2",
"flv.js": "1.5.0",
@ -61,6 +62,7 @@
"moment": "^2.19.3",
"monaco-editor": "0.21.2",
"papaparse": "^5.3.0",
"path-to-regexp": "^6.2.0",
"prop-types": "^15.6.1",
"qrcode.react": "^0.8.0",
"qs": "6.5.1",
@ -84,8 +86,7 @@
"tinymce": "5.6.2",
"tslib": "^1.10.0",
"uncontrollable": "7.0.2",
"video-react": "0.14.1",
"path-to-regexp": "^6.2.0"
"video-react": "0.14.1"
},
"devDependencies": {
"@types/file-saver": "^2.0.1",

View File

@ -126,7 +126,7 @@ const EVAL_CACHE: {[key: string]: Function} = {};
* @param config ECharts
*/
function recoverFunctionType(config: object) {
['formatter', 'sort'].forEach((key: string) => {
['formatter', 'sort', 'renderItem'].forEach((key: string) => {
const objects = findObjectsWithKey(config, key);
for (const object of objects) {
const code = object[key];
@ -243,10 +243,12 @@ export class Chart extends React.Component<ChartProps> {
if (ref) {
Promise.all([
import('echarts'),
import('echarts-stat'),
import('echarts/extension/dataTool'),
import('echarts/extension/bmap/bmap')
]).then(async ([echarts]) => {
]).then(async ([echarts, ecStat]) => {
(window as any).echarts = echarts;
(window as any).ecStat = ecStat;
let theme = 'default';
if (chartTheme) {
@ -258,6 +260,14 @@ export class Chart extends React.Component<ChartProps> {
await onChartWillMount(echarts);
}
(echarts as any).registerTransform(
(ecStat as any).transform.regression
);
(echarts as any).registerTransform((ecStat as any).transform.histogram);
(echarts as any).registerTransform(
(ecStat as any).transform.clustering
);
this.echarts = echarts.init(ref, theme);
onChartMount?.(this.echarts, echarts);
this.echarts.on('click', this.handleClick);