forked from antvis/G2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalphabet-interval-space-layer.ts
51 lines (50 loc) · 1.05 KB
/
alphabet-interval-space-layer.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
import { G2Spec } from '../../../src';
export function alphabetIntervalSpaceLayer(): G2Spec {
return {
type: 'spaceLayer',
data: {
type: 'fetch',
value: 'data/alphabet.csv',
},
children: [
{
type: 'interval',
transform: [{ type: 'sortX', by: 'y', reverse: true }],
axis: {
y: { labelFormatter: '.0%' },
},
scale: {
color: {
palette: 'cool',
offset: (t) => t * 0.8 + 0.1,
},
},
encode: {
x: 'letter',
y: 'frequency',
color: 'letter',
},
},
{
type: 'interval',
x: 300,
y: 50,
width: 300,
height: 300,
coordinate: { type: 'theta' },
transform: [{ type: 'stackY' }],
encode: {
y: 'frequency',
color: 'letter',
},
legend: false,
scale: {
color: {
palette: 'cool',
offset: (t) => t * 0.8 + 0.1,
},
},
},
],
};
}