From a23e953430f1eadc5c63409fef9a8337fe8c206f Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Thu, 21 Jan 2021 23:32:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8A=A0=E5=85=A5=20ecStat=20=E6=98=AF=20A?= =?UTF-8?q?pache=20ECharts=20(incubating)=20=E7=9A=84=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=92=8C=E6=95=B0=E6=8D=AE=E6=8C=96=E6=8E=98=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +++-- src/renderers/Chart.tsx | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e8e8b4539..48dce9166 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/renderers/Chart.tsx b/src/renderers/Chart.tsx index 78cb4f539..f61e05c19 100644 --- a/src/renderers/Chart.tsx +++ b/src/renderers/Chart.tsx @@ -243,10 +243,12 @@ export class Chart extends React.Component { 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 { 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); From 045c2d220c23f9e7cb7bedaf5b37e500e42666ed Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Fri, 22 Jan 2021 07:57:56 +0800 Subject: [PATCH 2/2] chart renderItem --- src/renderers/Chart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderers/Chart.tsx b/src/renderers/Chart.tsx index f61e05c19..b0985eda7 100644 --- a/src/renderers/Chart.tsx +++ b/src/renderers/Chart.tsx @@ -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];