Merge pull request #390 from antvis/fix_storybook

Fix storybook
This commit is contained in:
@thinkinggis 2020-05-27 15:22:10 +08:00 committed by GitHub
commit 1e99f78cd3
6 changed files with 41 additions and 15 deletions

View File

@ -32,12 +32,12 @@ scene.on('loaded', () => {
label: {
enable: true,
textAllowOverlap: false,
field: 'Short_Name_ZH'
field: 'NAME_CHN'
},
popup: {
enable: false,
Html: props => {
return `<span>${props.Short_Name_ZH}</span>`;
return `<span>${props.NAME_CHN}</span>`;
}
}
});

View File

@ -33,12 +33,12 @@ scene.on('loaded', () => {
label: {
enable: true,
textAllowOverlap: false,
field: 'Short_Name_ZH'
field: 'NAME_CHN'
},
popup: {
enable: false,
Html: props => {
return `<span>${props.Short_Name_ZH}</span>`;
return `<span>${props.NAME_CHN}</span>`;
}
}
});

View File

@ -24,7 +24,9 @@ export default class CountryLayer extends BaseLayer {
}
protected async addProvinceFill() {
const { depth } = this.options;
const countryConfig = getDataConfig(this.options.geoDataLevel).CHN[depth];
const countryConfig = getDataConfig(this.options.geoDataLevel).country.CHN[
depth
];
const fillData = await this.fetchData(countryConfig.fill);
this.addFillLayer(fillData);
}

View File

@ -1,10 +1,35 @@
import { sum } from '../src/statistics';
describe('sum', () => {
it('sum string array', () => {
const a = ['1', '2', '3'];
const b = [1, 2, 3];
import { max, mean, min, mode, sum } from '../src/statistics';
const a = ['1', '2', '3'];
const b = [1, 2, 3];
const c = [1, 2, 3, '1', 2, '3', 3];
describe('statistic', () => {
it('sum', () => {
// @ts-ignore
expect(sum(a)).toEqual(6);
expect(sum(b)).toEqual(6);
});
it('max', () => {
// @ts-ignore
expect(max(a)).toEqual(3);
expect(max(b)).toEqual(3);
});
it('min', () => {
// @ts-ignore
expect(min(a)).toEqual(1);
expect(min(b)).toEqual(1);
});
it('mean', () => {
// @ts-ignore
expect(mean(a)).toEqual(2);
// @ts-ignore
expect(mean(b)).toEqual(2);
});
it('mode', () => {
// @ts-ignore
expect(mode(a)).toEqual(1);
expect(mode(c)).toEqual(2);
});
});

View File

@ -14,7 +14,7 @@ function max(x: number[]) {
value = x[i];
}
}
return value;
return value * 1;
}
function min(x: number[]) {
@ -30,7 +30,7 @@ function min(x: number[]) {
value = x[i];
}
}
return value;
return value * 1;
}
function sum(x: number[]) {
@ -81,7 +81,7 @@ function mode(x: any[]) {
seenThis++;
}
}
return value;
return value * 1;
}
export { sum, max, min, mean, mode };

View File

@ -21,8 +21,7 @@ export default class Circle extends React.Component {
}),
});
this.scene = scene;
scene.on('loaded', () => {
const line = scene.on('loaded', () => {
const drawLine = new DrawLine(scene);
drawLine.enable();
});