Skip to content

Commit 43c0882

Browse files
committed
feat: add new chart
1 parent b10cfb0 commit 43c0882

15 files changed

+7546
-2601
lines changed

__tests__/plots/area.spec.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { mount } from '@vue/test-utils'
22
import AreaChart from '../../src/plots/area'
33

4+
const config = {
5+
data: [],
6+
xField: 'a',
7+
yField: 'b',
8+
}
9+
410
describe('AreaChart', () => {
511
test('should render without crashed', () => {
6-
mount(AreaChart, {
7-
props: {
8-
data: [],
9-
xField: 'a',
10-
yField: 'b',
11-
},
12-
})
12+
mount(() => <AreaChart {...config} />)
1313
})
1414
})

__tests__/plots/box.spec.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from '@vue/test-utils'
2+
import BoxChart from '../../src/plots/box'
3+
4+
const config = {
5+
data: [],
6+
xField: 'a',
7+
yField: 'b',
8+
}
9+
10+
describe('BoxChart', () => {
11+
test('should render without crashed', () => {
12+
mount(() => <BoxChart {...config} />)
13+
})
14+
})

__tests__/plots/dual-axes.spec.tsx

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { mount } from '@vue/test-utils'
2+
import DualAxesChart from '../../src/plots/dual-axes'
3+
const data = [
4+
{ year: '1991', value: 3, count: 10 },
5+
{ year: '1992', value: 4, count: 4 },
6+
{ year: '1993', value: 3.5, count: 5 },
7+
{ year: '1994', value: 5, count: 5 },
8+
{ year: '1995', value: 4.9, count: 4.9 },
9+
{ year: '1996', value: 6, count: 35 },
10+
{ year: '1997', value: 7, count: 7 },
11+
{ year: '1998', value: 9, count: 1 },
12+
{ year: '1999', value: 13, count: 20 },
13+
]
14+
const config = {
15+
data: [data, data],
16+
xField: 'year',
17+
yField: ['value', 'count'],
18+
}
19+
20+
describe('DualAxesChart', () => {
21+
test('should render without crashed', () => {
22+
mount(() => <DualAxesChart {...config} />)
23+
})
24+
})

__tests__/plots/stock.spec.tsx

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { mount } from '@vue/test-utils'
2+
import StockChart from '../../src/plots/stock'
3+
4+
const data = [
5+
{ x: 'Oceania', low: 1, q1: 9, median: 16, q3: 22, high: 24 },
6+
{ x: 'East Europe', low: 1, q1: 5, median: 8, q3: 12, high: 16 },
7+
{ x: 'Australia', low: 1, q1: 8, median: 12, q3: 19, high: 26 },
8+
{ x: 'South America', low: 2, q1: 8, median: 12, q3: 21, high: 28 },
9+
{ x: 'North Africa', low: 1, q1: 8, median: 14, q3: 18, high: 24 },
10+
{ x: 'North America', low: 3, q1: 10, median: 17, q3: 28, high: 30 },
11+
{ x: 'West Europe', low: 1, q1: 7, median: 10, q3: 17, high: 22 },
12+
{ x: 'West Africa', low: 1, q1: 6, median: 8, q3: 13, high: 16 },
13+
]
14+
15+
const config = {
16+
width: 400,
17+
height: 500,
18+
data: data,
19+
xField: 'x',
20+
yField: ['low', 'q1', 'median', 'q3', 'high'],
21+
boxStyle: {
22+
stroke: '#545454',
23+
fill: '#1890FF',
24+
fillOpacity: 0.3,
25+
},
26+
animation: false,
27+
} as any
28+
29+
describe('StockChart', () => {
30+
test('should render without crashed', () => {
31+
mount(() => <StockChart {...config} />)
32+
})
33+
})

0 commit comments

Comments
 (0)