-
Notifications
You must be signed in to change notification settings - Fork 346
/
State.ts
160 lines (142 loc) 路 3.12 KB
/
State.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/**
* Copyright (c) 2017 ~ present NAVER Corp.
* billboard.js project is licensed under the MIT license
*/
/**
* State class.
* @class State
* @ignore
* @private
*/
export default class State {
constructor() {
return {
// chart drawn area dimension, excluding axes
width: 0,
width2: 0,
height: 0,
height2: 0,
margin: {
top: 0,
bottom: 0,
left: 0,
right: 0
},
margin2: {
top: 0,
bottom: 0,
left: 0,
right: 0
},
margin3: {
top: 0,
bottom: 0,
left: 0,
right: 0
},
arcWidth: 0,
arcHeight: 0,
xAxisHeight: 0,
hasAxis: false,
hasRadar: false,
hasTreemap: false,
// for data CSS rule index (used when boost.useCssRule is true)
cssRule: {},
current: {
// current domain value. Assigned when is zoom is called
domain: undefined,
// chart whole dimension
width: 0,
height: 0,
dataMax: 0,
maxTickSize: {
x: {width: 0, height: 0, ticks: <number[]> [], clipPath: 0, domain: ""},
y: {width: 0, height: 0, domain: ""},
y2: {width: 0, height: 0, domain: ""}
},
// current used chart type list
types: <string[]> [],
needle: undefined, // arc needle current value
},
// legend
isLegendRight: false,
isLegendInset: false,
isLegendTop: false,
isLegendLeft: false,
legendStep: 0,
legendItemWidth: 0,
legendItemHeight: 0,
legendHasRendered: false,
eventReceiver: {
currentIdx: -1, // current event interaction index
rect: {}, // event rect's clientBoundingRect
data: [], // event data bound of previoous eventRect
coords: [] // coordination value of previous eventRect
},
axis: {
x: {
padding: {left: 0, right: 0},
tickCount: 0
}
},
rotatedPadding: {
left: 30,
right: 0,
top: 5
},
withoutFadeIn: {},
inputType: "",
datetimeId: "",
// clip id string
clip: {
id: "",
idXAxis: "",
idYAxis: "",
idXAxisTickTexts: "",
idGrid: "",
idSubchart: "", // clipIdForSubchart
path: "",
pathXAxis: "",
pathYAxis: "",
pathXAxisTickTexts: "",
pathGrid: ""
},
// state
event: null, // event object
dragStart: null,
dragging: false,
flowing: false,
cancelClick: false,
mouseover: false,
rendered: false,
transiting: false,
redrawing: false, // if redraw() is on process
resizing: false, // resize event called
toggling: false, // legend toggle
zooming: false,
hasNegativeValue: false,
hasPositiveValue: true,
orgAreaOpacity: "0.2",
orgConfig: {}, // user original genration config
// ID strings
hiddenTargetIds: <string[]> [],
hiddenLegendIds: <string[]> [],
focusedTargetIds: <string[]> [],
defocusedTargetIds: <string[]> [],
// value for Arc
radius: 0,
innerRadius: <{[key: string]: number}|number> 0,
outerRadius: <{[key: string]: number}|number|undefined> undefined,
innerRadiusRatio: 0,
gaugeArcWidth: 0,
radiusExpanded: 0,
// xgrid attribute
xgridAttr: {
x1: <number | null> null,
x2: <number | null> null,
y1: <number | null> null,
y2: <number | null> null
}
};
}
}