Skip to content

Commit 25de7ba

Browse files
committed
feat: 升级g2&g2Plot版本,自定义scale能力;fix:数据更新优化;
1 parent 07d9989 commit 25de7ba

21 files changed

+1152
-18
lines changed

demos/funnel/basicFunnel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Demo() {
3434
height={600}
3535
data={dv.rows}
3636
padding={[20, 120, 95]}
37-
forceFit
37+
autoFit
3838
>
3939
<Tooltip
4040
showTitle={false}

demos/interval/bezier.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const COLORS = [
121121
];
122122
function BezierInterval() {
123123
return (
124-
<Chart height={300} source={data} forceFit padding={[50, 100, 50, 60]} data={data}>
124+
<Chart height={300} source={data} autoFit padding={[50, 100, 50, 60]} data={data}>
125125
<Axis name="genre" tickLine={null} line={null} title={null} />
126126
<Axis name="sold" visible={false} />
127127
<Geom

demos/plot/ring.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const config = {
6868
},
6969
"width": 580,
7070
"height": 460,
71-
"forceFit": false,
71+
"autoFit": false,
7272
"colorField": "x",
7373
"angleField": "y",
7474
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bizcharts",
3-
"version": "4.1.10-beta.2",
3+
"version": "4.1.10",
44
"description": "bizcharts",
55
"keywords": [
66
"bizcharts",
@@ -22,8 +22,8 @@
2222
],
2323
"main": "lib/index.js",
2424
"types": "lib/index.d.ts",
25-
"browser": "umd/BizCharts.js",
2625
"module": "es/index.js",
26+
"browser": "umd/BizCharts.js",
2727
"scripts": {
2828
"build": "run-s clean lib:* build:*",
2929
"build:umd": "cross-env NODE_ENV=development gulp",
@@ -47,8 +47,8 @@
4747
"dependencies": {
4848
"@antv/component": "*",
4949
"@antv/util": "*",
50-
"@antv/g2": "4.1.12",
51-
"@antv/g2plot": "2.3.12",
50+
"@antv/g2": "4.1.14",
51+
"@antv/g2plot": "2.3.18",
5252
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
5353
"@babel/plugin-transform-runtime": "^7.12.10",
5454
"babel-plugin-transform-replace-object-assign": "^2.0.0",

src/components/Chart/chartHelper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class ChartHelper extends EventEmitter {
5252
// @ts-ignore
5353
this.chart.unbindAutoFit(); // 不使用g2的监听
5454
this.isNewInstance = false;
55+
// @ts-ignore
56+
} else if(this.chart.forceReRender) {
57+
// forceReRender 填部分g2更新不干净的坑
58+
this.chart.render();
5559
} else {
5660
this.chart.render(true);
5761
}

src/components/Facet/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Rect from '@antv/g2/lib/facet/rect';
1010
import Tree from '@antv/g2/lib/facet/tree';
1111

1212
import useChartView from '../../hooks/useChartView';
13+
import useChartInstance from '../../hooks/useChartInstance';
1314
import { registerFacet } from '../../core';
1415

1516
registerFacet('rect', Rect);
@@ -38,6 +39,7 @@ export interface IFacetProps extends FacetCfg<any>, React.Props<any> {
3839

3940
function Facet(props: IFacetProps) {
4041
const chart = useChartView();
42+
const chartInstance = useChartInstance();
4143
const { type, children, ...cfg } = props;
4244
// @ts-ignore
4345
if (chart.facetInstance) {
@@ -46,6 +48,8 @@ function Facet(props: IFacetProps) {
4648
chart.facetInstance.destroy();
4749
// @ts-ignore
4850
chart.facetInstance = null;
51+
// todo: 是否有必要区分数据更新和配置项更新,当前处理为全部都重绘
52+
chartInstance.forceReRender = true; // 重新渲染,不能更新
4953
}
5054
if (_isFunction(children)) {
5155
chart.facet(type, {

src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ registerEngine('svg', SVGEngine);
1717

1818
// @ts-ignore
1919
export * from '@antv/g2/lib/core';
20-
export const VERSION = '4.1.10-beta.2';
20+
export const VERSION = '4.1.10';
2121

2222

2323

0 commit comments

Comments
 (0)