evui 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adac9fa4f723f9d2cb5b6640517114a9.png → 0b8d1200e71cae8d747dce4e69c4efb6.png} +0 -0
- package/dist/1.css +4 -0
- package/dist/1.css.map +1 -0
- package/dist/1.evui.min.js +2 -0
- package/dist/1.evui.min.js.map +1 -0
- package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
- package/dist/2.css +4 -0
- package/dist/2.css.map +1 -0
- package/dist/2.evui.min.js +2 -0
- package/dist/2.evui.min.js.map +1 -0
- package/dist/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 278156e41e0ad908cf7f841b17130502.woff2} +0 -0
- package/dist/3.evui.min.js +2 -0
- package/dist/3.evui.min.js.map +1 -0
- package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
- package/dist/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 38c6d8bab26db77d8c806813e1497763.woff2} +0 -0
- package/dist/4.evui.min.js +2 -0
- package/dist/4.evui.min.js.map +1 -0
- package/dist/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
- package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
- package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
- package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
- package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
- package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
- package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
- package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
- package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
- package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
- package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
- package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
- package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
- package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
- package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
- package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
- package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
- package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
- package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
- package/dist/evui.min.js +6 -86054
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -1
- package/dist/main.css +43 -5541
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -1
- package/package.json +56 -76
- package/src/common/emitter.js +20 -0
- package/src/common/utils.debounce.js +223 -0
- package/src/common/utils.js +51 -17
- package/src/common/utils.throttle.js +83 -0
- package/src/common/utils.tree.js +18 -0
- package/src/components/button/button.vue +316 -241
- package/src/components/chart/chart.core.js +378 -85
- package/src/components/chart/chart.vue +133 -115
- package/src/components/chart/element/element.bar.js +219 -25
- package/src/components/chart/element/element.bar.time.js +115 -0
- package/src/components/chart/element/element.line.js +172 -21
- package/src/components/chart/element/element.pie.js +86 -0
- package/src/components/chart/element/element.scatter.js +9 -2
- package/src/components/chart/element/element.tip.js +356 -0
- package/src/components/chart/helpers/helpers.canvas.js +94 -0
- package/src/components/chart/helpers/helpers.constant.js +25 -6
- package/src/components/chart/helpers/helpers.util.js +83 -38
- package/src/components/chart/index.js +0 -1
- package/src/components/chart/model/model.series.js +43 -14
- package/src/components/chart/model/model.store.js +440 -46
- package/src/components/chart/plugins/plugins.interaction.js +324 -0
- package/src/components/chart/plugins/plugins.legend.js +233 -91
- package/src/components/chart/plugins/plugins.pie.js +179 -0
- package/src/components/chart/plugins/plugins.title.js +25 -2
- package/src/components/chart/plugins/plugins.tooltip.js +384 -0
- package/src/components/chart/scale/scale.js +91 -29
- package/src/components/chart/scale/scale.linear.js +12 -0
- package/src/components/chart/scale/scale.logarithmic.js +25 -0
- package/src/components/chart/scale/scale.step.js +89 -52
- package/src/components/chart/scale/scale.time.category.js +204 -0
- package/src/components/chart/scale/scale.time.js +19 -1
- package/src/components/checkbox/checkbox-group.vue +15 -11
- package/src/components/checkbox/checkbox.vue +210 -138
- package/src/components/codeview/code.vue +42 -29
- package/src/components/contextmenu/contextmenu.child.vue +79 -0
- package/src/components/contextmenu/contextmenu.vue +276 -0
- package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
- package/src/components/contextmenu/index.js +3 -0
- package/src/components/datepicker/calendar.core.js +588 -492
- package/src/components/datepicker/calendar.vue +0 -3
- package/src/components/datepicker/datepicker.vue +43 -15
- package/src/components/datepicker/index.js +5 -1
- package/src/components/grid/grid.filter.vue +290 -0
- package/src/components/grid/grid.filter.window.vue +411 -0
- package/src/components/grid/grid.render.vue +45 -0
- package/src/components/grid/grid.vue +1338 -0
- package/src/components/icon/icon.vue +22 -7
- package/src/components/input/input.number.vue +309 -277
- package/src/components/label/label.vue +2 -2
- package/src/components/loadingmask/loadingmask.vue +6 -13
- package/src/components/loginfield/loginfield.vue +46 -37
- package/src/components/markdown/index.js +3 -0
- package/src/components/markdown/markdown.vue +1001 -0
- package/src/components/menu/index.js +1 -3
- package/src/components/menu/menu.nav.item.vue +115 -0
- package/src/components/menu/menu.nav.sub.vue +42 -0
- package/src/components/menu/menu.nav.vue +71 -98
- package/src/components/message/index.js +3 -0
- package/src/components/message/message.js +63 -0
- package/src/components/message/message.vue +191 -0
- package/src/components/message-box/index.js +3 -0
- package/src/components/message-box/message-box.js +31 -0
- package/src/components/message-box/message-box.vue +298 -0
- package/src/components/notification/index.js +3 -0
- package/src/components/notification/notification.js +75 -0
- package/src/components/notification/notification.vue +242 -0
- package/src/components/radio/radio-group.vue +6 -2
- package/src/components/radio/radio.vue +156 -76
- package/src/components/selectbox/dropdown.vue +86 -40
- package/src/components/selectbox/listbox.vue +47 -18
- package/src/components/selectbox/option.vue +1 -1
- package/src/components/selectbox/selectbox.vue +304 -316
- package/src/components/slider/slider-tooltip.vue +7 -7
- package/src/components/slider/slider.vue +20 -25
- package/src/components/splitter/splitter.vue +104 -94
- package/src/components/table/table.black.css +1 -1
- package/src/components/table/table.filter.lite.vue +7 -7
- package/src/components/table/table.filter.vue +1 -1
- package/src/components/table/table.grey.css +5 -6
- package/src/components/table/table.navy.css +1 -1
- package/src/components/table/table.vue +55 -48
- package/src/components/tabs/tab-panel.vue +19 -5
- package/src/components/tabs/tabs.vue +182 -87
- package/src/components/textfield/textfield.vue +110 -87
- package/src/components/timepicker/index.js +2 -2
- package/src/components/timepicker/spinner.vue +15 -17
- package/src/components/timepicker/timepicker.vue +98 -53
- package/src/components/toggle/toggle.vue +148 -109
- package/src/components/tree/index.js +2 -6
- package/src/components/tree/render.js +17 -0
- package/src/components/tree/tree-node.vue +214 -0
- package/src/components/tree/tree.vue +296 -0
- package/src/components/tree-table/index.js +7 -0
- package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
- package/src/components/{tree → tree-table}/tree.table.grey.css +0 -0
- package/src/components/{tree → tree-table}/tree.table.vue +36 -41
- package/src/components/{tree → tree-table}/tree.util.js +0 -0
- package/src/components/window/window.vue +238 -191
- package/src/index.js +25 -12
- package/src/styles/base/base.scss +50 -0
- package/src/styles/base/index.scss +1 -0
- package/src/styles/default.scss +5 -0
- package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
- package/src/styles/{all.css → lib/fontawesome.css} +1 -1
- package/src/styles/lib/icon.css +792 -0
- package/src/styles/themes/index.scss +2 -0
- package/src/styles/themes/mixin.scss +33 -0
- package/src/styles/themes/variables.scss +206 -0
- package/src/styles/utils/colors.scss +222 -0
- package/src/styles/utils/index.scss +2 -0
- package/src/styles/utils/mixins.scss +34 -0
- package/src/styles/utils/variables.scss +27 -0
- package/src/webfonts/EVUI.eot +0 -0
- package/src/webfonts/EVUI.svg +251 -173
- package/src/webfonts/EVUI.ttf +0 -0
- package/src/webfonts/EVUI.woff +0 -0
- package/src/webfonts/Roboto-Bold.ttf +0 -0
- package/src/webfonts/Roboto-Medium.ttf +0 -0
- package/src/webfonts/Roboto-Regular.ttf +0 -0
- package/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
- package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
- package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
- package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
- package/src/components/chart/charts/chart.bar.js +0 -334
- package/src/components/chart/charts/chart.base.js +0 -1075
- package/src/components/chart/charts/chart.line.js +0 -262
- package/src/components/chart/charts/chart.pie.js +0 -383
- package/src/components/chart/charts/chart.scatter.js +0 -349
- package/src/components/chart/charts/chart.sunburst.js +0 -193
- package/src/components/chart/core/axis/axis.js +0 -217
- package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
- package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
- package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
- package/src/components/chart/core/core.constant.js +0 -116
- package/src/components/chart/core/core.legend.js +0 -473
- package/src/components/chart/core/core.util.js +0 -66
- package/src/components/chart/core/data/data.js +0 -412
- package/src/components/chart/core/data/data.pie.js +0 -70
- package/src/components/chart/core/data/data.stack.js +0 -222
- package/src/components/chart/core/data/data.sunburst.js +0 -172
- package/src/components/menu/menu.context.children.vue +0 -201
- package/src/components/menu/menu.context.vue +0 -144
- package/src/components/tabs/jun/tab.vue +0 -123
- package/src/components/tabs/jun/tabs.vue +0 -484
- package/src/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { numberWithComma } from '@/common/utils';
|
|
2
|
+
|
|
3
|
+
const modules = {
|
|
4
|
+
/**
|
|
5
|
+
* Hide legend components by manipulating css
|
|
6
|
+
*
|
|
7
|
+
* @returns {undefined}
|
|
8
|
+
*/
|
|
9
|
+
createEventFunctions() {
|
|
10
|
+
/**
|
|
11
|
+
* To show tooltip and item highlighting, add event listener on mousemove
|
|
12
|
+
*
|
|
13
|
+
* @returns {undefined}
|
|
14
|
+
*/
|
|
15
|
+
this.onMouseMove = (e) => {
|
|
16
|
+
const offset = this.getMousePosition(e);
|
|
17
|
+
const hitInfo = this.findHitItem(offset);
|
|
18
|
+
const ctx = this.overlayCtx;
|
|
19
|
+
const { indicator, tooltip } = this.options;
|
|
20
|
+
|
|
21
|
+
this.overlayClear();
|
|
22
|
+
|
|
23
|
+
if (indicator.use) {
|
|
24
|
+
this.drawIndicator(offset, indicator.color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (Object.keys(hitInfo.items).length) {
|
|
28
|
+
this.drawItemsHighlight(hitInfo, ctx);
|
|
29
|
+
|
|
30
|
+
if (tooltip.use) {
|
|
31
|
+
this.tooltipClear();
|
|
32
|
+
this.drawTooltip(hitInfo, this.tooltipCtx, this.setTooltipLayout(hitInfo, e, offset));
|
|
33
|
+
this.tooltipDOM.style.display = 'block';
|
|
34
|
+
}
|
|
35
|
+
} else if (tooltip.use) {
|
|
36
|
+
this.hideTooltipDOM();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* To clear tooltip and item highlighting, add event listener on mouseleave
|
|
42
|
+
*
|
|
43
|
+
* @returns {undefined}
|
|
44
|
+
*/
|
|
45
|
+
this.onMouseLeave = () => {
|
|
46
|
+
if (this.options.tooltip.throttledMove) {
|
|
47
|
+
this.onMouseMove.cancel();
|
|
48
|
+
}
|
|
49
|
+
this.overlayClear();
|
|
50
|
+
|
|
51
|
+
if (this.options.tooltip.use) {
|
|
52
|
+
this.tooltipClear();
|
|
53
|
+
this.tooltipDOM.style.display = 'none';
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Dealing with graph item select and invoking user custom dblclick event
|
|
59
|
+
*
|
|
60
|
+
* @returns {undefined}
|
|
61
|
+
*/
|
|
62
|
+
this.onDblClick = (e) => {
|
|
63
|
+
const selectItem = this.options.selectItem;
|
|
64
|
+
const args = {};
|
|
65
|
+
|
|
66
|
+
if (selectItem.use) {
|
|
67
|
+
const offset = this.getMousePosition(e);
|
|
68
|
+
const hitInfo = this.findClickedData(offset, selectItem.useApproximateValue);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (hitInfo.label !== null) {
|
|
72
|
+
this.render(hitInfo);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
({ label: args.label, value: args.value, sId: args.seriesId } = hitInfo);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof this.listeners.dblclick === 'function') {
|
|
79
|
+
this.listeners.dblclick(args);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Dealing with graph item select and invoking user custom click event
|
|
85
|
+
*
|
|
86
|
+
* @returns {undefined}
|
|
87
|
+
*/
|
|
88
|
+
this.onClick = (e) => {
|
|
89
|
+
const args = {};
|
|
90
|
+
|
|
91
|
+
if (this.options.selectItem.use) {
|
|
92
|
+
const offset = this.getMousePosition(e);
|
|
93
|
+
const hitInfo = this.findClickedData(offset);
|
|
94
|
+
|
|
95
|
+
if (hitInfo.label !== null) {
|
|
96
|
+
this.render(hitInfo);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
({ label: args.label, value: args.value, sId: args.seriesId } = hitInfo);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (typeof this.listeners.click === 'function') {
|
|
103
|
+
this.listeners.click(args);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
this.overlayCanvas.addEventListener('mousemove', this.onMouseMove);
|
|
108
|
+
this.overlayCanvas.addEventListener('mouseleave', this.onMouseLeave);
|
|
109
|
+
this.overlayCanvas.addEventListener('dblclick', this.onDblClick);
|
|
110
|
+
this.overlayCanvas.addEventListener('click', this.onClick);
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Computing mouse position on canvas
|
|
115
|
+
*
|
|
116
|
+
* @returns {array} mouse pointer position
|
|
117
|
+
*/
|
|
118
|
+
getMousePosition(evt) {
|
|
119
|
+
const e = evt.originalEvent || evt;
|
|
120
|
+
const rect = this.overlayCanvas.getBoundingClientRect();
|
|
121
|
+
return [e.clientX - rect.left, e.clientY - rect.top, rect.width, rect.height];
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Find graph item on mouse position
|
|
126
|
+
* @param {array} offset return value from getMousePosition()
|
|
127
|
+
*
|
|
128
|
+
* @returns {object} hit item information
|
|
129
|
+
*/
|
|
130
|
+
findHitItem(offset) {
|
|
131
|
+
const sIds = Object.keys(this.seriesList);
|
|
132
|
+
const items = {};
|
|
133
|
+
const isHorizontal = !!this.options.horizontal;
|
|
134
|
+
const ctx = this.tooltipCtx;
|
|
135
|
+
|
|
136
|
+
let hitId = null;
|
|
137
|
+
let maxs = '';
|
|
138
|
+
let maxsw = 0;
|
|
139
|
+
let maxv = '';
|
|
140
|
+
let maxg = null;
|
|
141
|
+
let maxSID = null;
|
|
142
|
+
|
|
143
|
+
for (let ix = 0; ix < sIds.length; ix++) {
|
|
144
|
+
const sId = sIds[ix];
|
|
145
|
+
const series = this.seriesList[sId];
|
|
146
|
+
|
|
147
|
+
if (series.findGraphData) {
|
|
148
|
+
const item = series.findGraphData(offset, isHorizontal);
|
|
149
|
+
|
|
150
|
+
if (item.data) {
|
|
151
|
+
let gdata;
|
|
152
|
+
|
|
153
|
+
if (item.data.o === null) {
|
|
154
|
+
gdata = isHorizontal ? item.data.x : item.data.y;
|
|
155
|
+
} else if (!isNaN(item.data.o)) {
|
|
156
|
+
gdata = isHorizontal ? item.data.x : item.data.y;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (gdata !== null && gdata !== undefined) {
|
|
160
|
+
const sName = `${series.name}`;
|
|
161
|
+
const sw = ctx ? ctx.measureText(sName).width : 1;
|
|
162
|
+
|
|
163
|
+
item.name = sName;
|
|
164
|
+
item.axis = { x: series.xAxisIndex, y: series.yAxisIndex };
|
|
165
|
+
items[sId] = item;
|
|
166
|
+
|
|
167
|
+
const cg = numberWithComma(gdata);
|
|
168
|
+
|
|
169
|
+
if (maxsw < sw) {
|
|
170
|
+
maxs = sName;
|
|
171
|
+
maxsw = sw;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (maxv.length <= `${cg}`.length) {
|
|
175
|
+
maxv = `${cg}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (maxg === null || maxg <= gdata) {
|
|
179
|
+
maxg = gdata;
|
|
180
|
+
maxSID = sId;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (item.hit) {
|
|
184
|
+
hitId = sId;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
hitId = hitId === null ? Object.keys(items)[0] : hitId;
|
|
192
|
+
const maxHighlight = maxg !== null ? [maxSID, maxg] : null;
|
|
193
|
+
|
|
194
|
+
return { items, hitId, maxTip: [maxs, maxv], maxHighlight };
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Find clicked graph item on mouse position
|
|
199
|
+
* @param {array} offset return value from getMousePosition()
|
|
200
|
+
* @param {boolean} useApproximate if it's true. it'll look for closed item on mouse position
|
|
201
|
+
*
|
|
202
|
+
* @returns {object} clicked item information
|
|
203
|
+
*/
|
|
204
|
+
findClickedData(offset, useApproximate) {
|
|
205
|
+
const sIds = Object.keys(this.seriesList);
|
|
206
|
+
const isHorizontal = !!this.options.horizontal;
|
|
207
|
+
|
|
208
|
+
let maxl = null;
|
|
209
|
+
let maxp = null;
|
|
210
|
+
let maxg = null;
|
|
211
|
+
let maxSID = '';
|
|
212
|
+
let acc = 0;
|
|
213
|
+
let useStack = false;
|
|
214
|
+
let maxIndex = null;
|
|
215
|
+
|
|
216
|
+
for (let ix = 0; ix < sIds.length; ix++) {
|
|
217
|
+
const sId = sIds[ix];
|
|
218
|
+
const series = this.seriesList[sId];
|
|
219
|
+
const findFn = useApproximate ? series.findApproximateData : series.findGraphData;
|
|
220
|
+
|
|
221
|
+
if (findFn) {
|
|
222
|
+
const item = findFn.call(series, offset, isHorizontal);
|
|
223
|
+
const data = item.data;
|
|
224
|
+
const index = item.index;
|
|
225
|
+
|
|
226
|
+
if (data) {
|
|
227
|
+
const ldata = isHorizontal ? data.y : data.x;
|
|
228
|
+
const lp = isHorizontal ? data.yp : data.xp;
|
|
229
|
+
|
|
230
|
+
if (ldata !== null && ldata !== undefined) {
|
|
231
|
+
const g = isHorizontal ? data.o || data.x : data.o || data.y;
|
|
232
|
+
|
|
233
|
+
if (series.stackIndex) {
|
|
234
|
+
acc += !isNaN(data.o) ? data.o : 0;
|
|
235
|
+
useStack = true;
|
|
236
|
+
} else {
|
|
237
|
+
acc += data.y;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (maxg === null || maxg <= g) {
|
|
241
|
+
maxg = g;
|
|
242
|
+
maxSID = sId;
|
|
243
|
+
maxl = ldata;
|
|
244
|
+
maxp = lp;
|
|
245
|
+
maxIndex = index;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
label: maxl,
|
|
254
|
+
pos: maxp,
|
|
255
|
+
value: maxg === null ? 0 : maxg,
|
|
256
|
+
sId: maxSID,
|
|
257
|
+
acc,
|
|
258
|
+
useStack,
|
|
259
|
+
maxIndex,
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Find graph item by label entered from user
|
|
265
|
+
* @param {any} label label value
|
|
266
|
+
*
|
|
267
|
+
* @returns {boolean} if it wasn't able to find it, return false. if not, return true and render.
|
|
268
|
+
*/
|
|
269
|
+
selectItemByLabel(label) {
|
|
270
|
+
const findInfo = this.getItemByLabel(label);
|
|
271
|
+
|
|
272
|
+
if (findInfo) {
|
|
273
|
+
this.render(findInfo);
|
|
274
|
+
} else {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return true;
|
|
279
|
+
},
|
|
280
|
+
findHitItem2(offset) {
|
|
281
|
+
const mouseX = offset[0];
|
|
282
|
+
const mouseY = offset[1];
|
|
283
|
+
|
|
284
|
+
const width = this.chartRect.chartWidth;
|
|
285
|
+
const height = this.chartRect.chartHeight;
|
|
286
|
+
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
287
|
+
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
288
|
+
|
|
289
|
+
const dx = mouseX - centerX;
|
|
290
|
+
const dy = mouseY - centerY;
|
|
291
|
+
|
|
292
|
+
let angle;
|
|
293
|
+
angle = ((Math.atan2(-dy, -dx) * 180) / Math.PI) - 90;
|
|
294
|
+
angle = angle < 0 ? 360 + angle : angle;
|
|
295
|
+
const rad = ((angle * Math.PI) / 180) + (1.5 * Math.PI);
|
|
296
|
+
const distance = Math.round(Math.sqrt((dx ** 2) + (dy ** 2)));
|
|
297
|
+
|
|
298
|
+
const graphData = this.graphData;
|
|
299
|
+
let gdata;
|
|
300
|
+
let dsIndex = null;
|
|
301
|
+
let sId = null;
|
|
302
|
+
|
|
303
|
+
for (let ix = 0, ixLen = graphData.length; ix < ixLen; ix++) {
|
|
304
|
+
gdata = graphData[ix];
|
|
305
|
+
if (distance > gdata.ir && distance < gdata.or) {
|
|
306
|
+
dsIndex = ix;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (graphData[dsIndex]) {
|
|
311
|
+
for (let ix = 0, ixLen = graphData[dsIndex].data.length; ix < ixLen; ix++) {
|
|
312
|
+
gdata = graphData[dsIndex].data[ix];
|
|
313
|
+
|
|
314
|
+
if (rad > gdata.sa && rad < gdata.ea) {
|
|
315
|
+
sId = gdata.id;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return { dsIndex, sId };
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export default modules;
|