forked from antvis/G2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblockchain-line-annotation.ts
53 lines (52 loc) · 1.19 KB
/
blockchain-line-annotation.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
import { G2Spec } from '../../../src';
export function blockChainLineAnnotation(): G2Spec {
return {
type: 'view',
height: 300,
width: 640,
data: {
type: 'fetch',
value: 'data/blockchain.json',
transform: [
{
type: 'fold',
fields: ['blockchain', 'nlp'],
key: 'type',
value: 'value',
},
],
},
children: [
{
type: 'line',
axis: { x: { labelAutoHide: true } },
encode: {
x: (d) => new Date(d.date),
y: 'value',
color: 'type',
shape: 'vh',
},
},
{
type: 'text',
data: [new Date('2017-12-17'), 100],
style: {
text: `2017-12-17, 受比特币影响,blockchain 搜索热度达到峰值:100`,
wordWrap: true,
wordWrapWidth: 164,
dx: -174,
dy: 30,
fill: '#2C3542',
fillOpacity: 0.65,
fontSize: 10,
background: true,
backgroundRadius: 2,
connector: true,
startMarker: true,
startMarkerFill: '#2C3542',
startMarkerFillOpacity: 0.65,
},
},
],
};
}