Skip to content

Commit

Permalink
feat: 升级g2&g2Plot版本,自定义scale能力;fix:数据更新优化;
Browse files Browse the repository at this point in the history
  • Loading branch information
Leannechn committed Apr 19, 2021
1 parent 07d9989 commit 25de7ba
Show file tree
Hide file tree
Showing 21 changed files with 1,152 additions and 18 deletions.
2 changes: 1 addition & 1 deletion demos/funnel/basicFunnel.jsx
Expand Up @@ -34,7 +34,7 @@ function Demo() {
height={600}
data={dv.rows}
padding={[20, 120, 95]}
forceFit
autoFit
>
<Tooltip
showTitle={false}
Expand Down
2 changes: 1 addition & 1 deletion demos/interval/bezier.jsx
Expand Up @@ -121,7 +121,7 @@ const COLORS = [
];
function BezierInterval() {
return (
<Chart height={300} source={data} forceFit padding={[50, 100, 50, 60]} data={data}>
<Chart height={300} source={data} autoFit padding={[50, 100, 50, 60]} data={data}>
<Axis name="genre" tickLine={null} line={null} title={null} />
<Axis name="sold" visible={false} />
<Geom
Expand Down
2 changes: 1 addition & 1 deletion demos/plot/ring.jsx
Expand Up @@ -68,7 +68,7 @@ const config = {
},
"width": 580,
"height": 460,
"forceFit": false,
"autoFit": false,
"colorField": "x",
"angleField": "y",
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "bizcharts",
"version": "4.1.10-beta.2",
"version": "4.1.10",
"description": "bizcharts",
"keywords": [
"bizcharts",
Expand All @@ -22,8 +22,8 @@
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"browser": "umd/BizCharts.js",
"module": "es/index.js",
"browser": "umd/BizCharts.js",
"scripts": {
"build": "run-s clean lib:* build:*",
"build:umd": "cross-env NODE_ENV=development gulp",
Expand All @@ -47,8 +47,8 @@
"dependencies": {
"@antv/component": "*",
"@antv/util": "*",
"@antv/g2": "4.1.12",
"@antv/g2plot": "2.3.12",
"@antv/g2": "4.1.14",
"@antv/g2plot": "2.3.18",
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.10",
"babel-plugin-transform-replace-object-assign": "^2.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/components/Chart/chartHelper.ts
Expand Up @@ -52,6 +52,10 @@ class ChartHelper extends EventEmitter {
// @ts-ignore
this.chart.unbindAutoFit(); // 不使用g2的监听
this.isNewInstance = false;
// @ts-ignore
} else if(this.chart.forceReRender) {
// forceReRender 填部分g2更新不干净的坑
this.chart.render();
} else {
this.chart.render(true);
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Facet/index.tsx
Expand Up @@ -10,6 +10,7 @@ import Rect from '@antv/g2/lib/facet/rect';
import Tree from '@antv/g2/lib/facet/tree';

import useChartView from '../../hooks/useChartView';
import useChartInstance from '../../hooks/useChartInstance';
import { registerFacet } from '../../core';

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

function Facet(props: IFacetProps) {
const chart = useChartView();
const chartInstance = useChartInstance();
const { type, children, ...cfg } = props;
// @ts-ignore
if (chart.facetInstance) {
Expand All @@ -46,6 +48,8 @@ function Facet(props: IFacetProps) {
chart.facetInstance.destroy();
// @ts-ignore
chart.facetInstance = null;
// todo: 是否有必要区分数据更新和配置项更新,当前处理为全部都重绘
chartInstance.forceReRender = true; // 重新渲染,不能更新
}
if (_isFunction(children)) {
chart.facet(type, {
Expand Down
2 changes: 1 addition & 1 deletion src/core.ts
Expand Up @@ -17,7 +17,7 @@ registerEngine('svg', SVGEngine);

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



Expand Down

0 comments on commit 25de7ba

Please sign in to comment.