forked from antvis/G2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalphabet-interval-axis.ts
43 lines (42 loc) · 960 Bytes
/
alphabet-interval-axis.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
import { G2Spec } from '../../../src';
export function alphabetIntervalAxis(): G2Spec {
return {
type: 'view',
children: [
{
type: 'interval',
transform: [{ type: 'sortX', by: 'y', reverse: true }],
data: {
type: 'fetch',
value: 'data/alphabet.csv',
},
encode: {
x: 'letter',
y: 'frequency',
color: 'steelblue',
},
axis: { y: { tickCount: 10 }, x: false },
},
{ type: 'axisX', title: 'Letter', labelFontSize: 20 },
{
type: 'axisY',
labelFormatter: '.0%',
title: 'Frequency',
scale: { y: { nice: true } },
},
{
type: 'axisY',
position: 'right',
scale: {
y: {
type: 'linear',
independent: true,
domain: [0, 10],
range: [1, 0],
},
},
grid: false,
},
],
};
}