Skip to content

Commit

Permalink
feat: 物料配置文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Leannechn committed Jun 8, 2020
1 parent 1071ff0 commit dd321e0
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion __stories__/update.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const getData = () => {
return dataSource;
}

return undefined;
return dataSource;
}

function ChangeData() {
Expand Down
2 changes: 2 additions & 0 deletions demos/features/changeData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
import {
Chart,
Interval,
Coordinate
} from "../../src";

const data1 = [
Expand Down Expand Up @@ -62,6 +63,7 @@ const Basic = () => {
return (
<Chart onIntervalClick={console.log} data={data} height={500} autoFit>
<Interval position="year*value" />
<Coordinate transpose />
</Chart>
);
}
Expand Down
2 changes: 1 addition & 1 deletion demos/geom/interval.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Basic(props) {
<Chart height={400} padding="auto" data={data} scale={cols} autoFit {...cfg.Chart}>
<Tooltip showMarkers={false} {...cfg.Tooltip} />
<Coordinate transpose />
<Interval position="year*value" label="value" {...cfg.Interval} />
<Interval active-region position="year*value" label="value" />
</Chart>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion demos/interval/basicBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const Basic = () => {
return <>
{
chart.filteredData.map((d, index) => {
return <Ellipse attrs={{
return <Ellipse key={index} attrs={{
x: 30 + index * 20,
y: 50 + count,
rx: 20,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bizcharts",
"version": "4.0.5-beta.4",
"version": "4.0.5",
"description": "bizcharts",
"keywords": [
"bizcharts",
Expand Down
6 changes: 1 addition & 5 deletions src/components/Chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export class Chart extends React.Component<IChartProps> {
protected resizeObserver: ResizeObserver;
private chartHelper: ChartHelper;
public readonly isRootView = true;
protected width: number;
protected height: number;
private resize = _debounce(() => {
const { chart } = this.chartHelper;
if (this.props.autoFit && this.chartHelper.chart) {
Expand All @@ -26,7 +24,7 @@ export class Chart extends React.Component<IChartProps> {
chart.width,
chart.height
);
if (this.width !== width || this.height !== height) {
if (chart.width !== width || chart.height !== height) {
chart.changeSize(width, height);
chart.emit('resize');
}
Expand All @@ -48,8 +46,6 @@ export class Chart extends React.Component<IChartProps> {

componentDidMount() {
this.chartHelper.render();
this.width = this.chartHelper.chart.width;
this.height = this.chartHelper.chart.height;
}

componentDidUpdate() {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/transBooleanCfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import _clone from '@antv/util/lib/clone';
export default (cfg: Object, keys: string[]) => {
const opt = _clone(cfg);
keys.forEach(key => {
if (opt[key] === false) {
if (opt[key] === true) {
opt[key] = {};
} else if (opt[key] === false) {
opt[key] = null;
}
});
Expand Down
2 changes: 1 addition & 1 deletion uitest/snapshot/area-areaWithNull 测试.test.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion uitest/snapshot/geometry-interval 测试.test.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion uitest/snapshot/geometry-line 测试.test.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion unittest/pickWithout-spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pickWithout from '../src/utils/pickWithout';

describe('todos reducer', () => {
describe('pickWithout', () => {
it('should pickWithout a from array', () => {
const res = pickWithout({ a: 1, b: 2 }, ['a']);
expect(res.a).toEqual(undefined);
Expand Down
2 changes: 1 addition & 1 deletion unittest/shallowEqual-spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import shallowEqual from '../src/utils/shallowEqual';

describe('todos reducer', () => {
describe('shallowEqual', () => {
it('should ref data shallowEqual true', () => {
const data = [{x:1,y:1}];
expect(
Expand Down
15 changes: 15 additions & 0 deletions unittest/utils/transBooleanCfg-spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import transBooleanCfg from '../../src/utils/transBooleanCfg';

describe('pickWithout', () => {
it('should pickWithout a from array', () => {
const res = transBooleanCfg({
title: false,
grid: true,
line: null,
}, ['title', 'grid', 'line']);
expect(res.title).toEqual(null);
expect(res.grid).toEqual({});
expect(res.line).toEqual(null);
});
})

0 comments on commit dd321e0

Please sign in to comment.