forked from antvis/G2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolio-point-stack-enter.ts
84 lines (82 loc) · 1.69 KB
/
polio-point-stack-enter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { interpolateHcl } from 'd3-interpolate';
import { G2Spec } from '../../../src';
/**
* @see https://canisjs.github.io/canis-editor/index.html?exmp=polio_1
*/
export function polioPointStackEnter(): G2Spec {
return {
type: 'view',
style: {
plotFill: '#000',
},
children: [
{
type: 'point',
transform: [
{
type: 'stackEnter',
groupBy: ['x', 'y'],
orderBy: 'color',
duration: 5000,
},
],
data: {
type: 'fetch',
value: 'data/polio.json',
},
scale: {
y: { range: [0, 1] },
color: {
type: 'sqrt',
range: ['hsl(152,80%,80%)', 'hsl(228,30%,40%)'],
interpolate: interpolateHcl,
},
},
padding: 0,
axis: false,
encode: {
x: 'x',
y: 'y',
color: 'Polio Cases',
},
style: {
shape: 'point',
},
},
{
type: 'text',
style: {
text: 'Polio incidence rates',
x: '50%',
y: '50%',
textAlign: 'center',
fontSize: 24,
fill: '#666',
},
animate: {
enter: {
delay: 5000,
},
},
},
{
type: 'text',
style: {
text: 'United States, 1950s',
x: '50%',
y: '50%',
textAlign: 'center',
fontSize: 18,
fill: '#666',
dy: 30,
},
animate: {
enter: {
delay: 5400,
},
},
},
],
};
}
polioPointStackEnter.intervals = [[2500, 5000]];