evui 2.0.8 → 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 +12 -59485
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -1
- package/dist/main.css +85 -0
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -0
- package/package.json +58 -89
- 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 +699 -0
- package/src/components/chart/chart.vue +200 -204
- package/src/components/chart/element/element.bar.js +311 -0
- package/src/components/chart/element/element.bar.time.js +115 -0
- package/src/components/chart/element/element.line.js +288 -0
- package/src/components/chart/element/element.pie.js +86 -0
- package/src/components/chart/element/element.scatter.js +83 -0
- package/src/components/chart/element/element.tip.js +356 -0
- package/src/components/chart/helpers/helpers.canvas.js +237 -0
- package/src/components/chart/helpers/helpers.constant.js +138 -0
- package/src/components/chart/helpers/helpers.util.js +154 -0
- package/src/components/chart/index.js +0 -1
- package/src/components/chart/model/index.js +4 -0
- package/src/components/chart/model/model.series.js +86 -0
- package/src/components/chart/model/model.store.js +559 -0
- package/src/components/chart/plugins/plugins.interaction.js +324 -0
- package/src/components/chart/plugins/plugins.legend.js +589 -0
- package/src/components/chart/plugins/plugins.pie.js +179 -0
- package/src/components/chart/plugins/plugins.title.js +56 -0
- package/src/components/chart/plugins/plugins.tooltip.js +384 -0
- package/src/components/chart/scale/scale.js +272 -0
- package/src/components/chart/scale/scale.linear.js +30 -0
- package/src/components/chart/scale/scale.logarithmic.js +120 -0
- package/src/components/chart/scale/scale.step.js +197 -0
- package/src/components/chart/scale/scale.time.category.js +204 -0
- package/src/components/chart/scale/scale.time.js +40 -0
- package/src/components/checkbox/checkbox-group.vue +31 -12
- package/src/components/checkbox/checkbox.vue +269 -19
- 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 +604 -510
- package/src/components/datepicker/calendar.vue +0 -3
- package/src/components/datepicker/datepicker.vue +73 -14
- 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 +52 -63
- package/src/components/loginfield/index.js +3 -0
- package/src/components/loginfield/loginfield.vue +339 -0
- 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 +12 -2
- package/src/components/radio/radio.vue +186 -25
- package/src/components/selectbox/dropdown.vue +96 -39
- package/src/components/selectbox/listbox.vue +68 -29
- package/src/components/selectbox/option.vue +1 -1
- package/src/components/selectbox/selectbox.vue +445 -245
- package/src/components/slider/slider-tooltip.vue +7 -7
- package/src/components/slider/slider.vue +20 -25
- package/src/components/splitter/index.js +3 -0
- package/src/components/splitter/splitter.vue +294 -0
- package/src/components/table/table.black.css +1 -1
- package/src/components/table/table.filter.lite.vue +8 -8
- 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 +60 -55
- package/src/components/tabs/tab-panel.vue +19 -5
- package/src/components/tabs/tabs.vue +182 -87
- package/src/components/textfield/textfield.vue +140 -80
- 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 +206 -158
- 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 +12 -12
- package/src/components/{tree → tree-table}/tree.table.vue +151 -95
- package/src/components/tree-table/tree.util.js +119 -0
- package/src/components/window/window.vue +238 -183
- package/src/index.js +29 -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 -91
- 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/components/tree/tree.util.js +0 -39
- package/src/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { reverse } from 'lodash-es';
|
|
2
|
+
|
|
3
|
+
const modules = {
|
|
4
|
+
/**
|
|
5
|
+
* Take chart data and labels to create normalized data and min/max info
|
|
6
|
+
* @param {object} data chart series info
|
|
7
|
+
* @param {object} label chart label
|
|
8
|
+
*
|
|
9
|
+
* @returns {undefined}
|
|
10
|
+
*/
|
|
11
|
+
createDataSet(data, label) {
|
|
12
|
+
Object.keys(this.seriesInfo.charts).forEach((typeKey) => {
|
|
13
|
+
const type = this.seriesInfo.charts[typeKey];
|
|
14
|
+
|
|
15
|
+
if (type.length) {
|
|
16
|
+
if (typeKey === 'pie') {
|
|
17
|
+
if (this.options.sunburst) {
|
|
18
|
+
this.createSunburstDataSet(data);
|
|
19
|
+
} else {
|
|
20
|
+
this.createPieDataSet(data, type);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
type.forEach((sId) => {
|
|
24
|
+
const series = this.seriesList[sId];
|
|
25
|
+
|
|
26
|
+
if (series && data[sId]) {
|
|
27
|
+
if (series.isExistGrp && series.stackIndex) {
|
|
28
|
+
const bs = this.seriesList[series.bsId];
|
|
29
|
+
series.data = this.addSeriesStackDS(data[sId], label, bs.data, series.stackIndex);
|
|
30
|
+
} else {
|
|
31
|
+
series.data = this.addSeriesDS(data[sId], label);
|
|
32
|
+
}
|
|
33
|
+
series.minMax = this.getSeriesMinMax(series.data);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Take chart data and to create normalized pie data
|
|
43
|
+
* @param {object} data chart series info
|
|
44
|
+
*
|
|
45
|
+
* @returns {undefined}
|
|
46
|
+
*/
|
|
47
|
+
createSunburstDataSet(data) {
|
|
48
|
+
this.pieDataSet = [];
|
|
49
|
+
const ds = this.pieDataSet;
|
|
50
|
+
const sunburstQueue = [];
|
|
51
|
+
|
|
52
|
+
for (let ix = 0; ix < data.length; ix++) {
|
|
53
|
+
const slice = data[ix];
|
|
54
|
+
const series = this.seriesList[slice.id];
|
|
55
|
+
let showChildren = false;
|
|
56
|
+
|
|
57
|
+
if (!ds[0]) {
|
|
58
|
+
ds[0] = { ir: 0, or: 0, total: 0, data: [] };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (series.show) {
|
|
62
|
+
ds[0].total += slice.value || 0;
|
|
63
|
+
ds[0].data.push({ parent: '$ev-root', id: slice.id, value: slice.value, sa: 0, ea: 0 });
|
|
64
|
+
|
|
65
|
+
if (slice.children) {
|
|
66
|
+
for (let jx = 0; jx < slice.children.length; jx++) {
|
|
67
|
+
const childSeries = this.seriesList[slice.children[jx].id];
|
|
68
|
+
if (childSeries.show) {
|
|
69
|
+
showChildren = true;
|
|
70
|
+
}
|
|
71
|
+
sunburstQueue.push({ parent: slice.id, data: slice.children[jx], depth: 1 });
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
const dummy = {
|
|
75
|
+
id: 'dummy',
|
|
76
|
+
value: slice.value,
|
|
77
|
+
};
|
|
78
|
+
sunburstQueue.push({ parent: slice.id, data: dummy, depth: 1 });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!showChildren) {
|
|
82
|
+
const dummy = {
|
|
83
|
+
id: 'dummy',
|
|
84
|
+
value: slice.value,
|
|
85
|
+
};
|
|
86
|
+
sunburstQueue.push({ parent: slice.id, data: dummy, depth: 1 });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ds[0].data.sort((a, b) => b.value - a.value);
|
|
92
|
+
|
|
93
|
+
while (sunburstQueue.length) {
|
|
94
|
+
const item = sunburstQueue.shift();
|
|
95
|
+
const parent = item.parent;
|
|
96
|
+
const slice = item.data;
|
|
97
|
+
const depth = item.depth;
|
|
98
|
+
let showChildren = false;
|
|
99
|
+
|
|
100
|
+
if (!ds[depth]) {
|
|
101
|
+
ds[depth] = { ir: 0, or: 0, total: {}, data: [] };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!ds[depth].total[parent]) {
|
|
105
|
+
ds[depth].total[parent] = 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const series = this.seriesList[slice.id];
|
|
109
|
+
if (slice.id === 'dummy') {
|
|
110
|
+
ds[depth].data.push({ parent, id: 'dummy', value: slice.value, sa: 0, ea: 0 });
|
|
111
|
+
ds[depth].total[parent] += slice.value;
|
|
112
|
+
} else if (series && series.show) {
|
|
113
|
+
ds[depth].data.push({ parent, id: slice.id, value: slice.value, sa: 0, ea: 0 });
|
|
114
|
+
ds[depth].total[parent] += slice.value;
|
|
115
|
+
|
|
116
|
+
if (slice.children) {
|
|
117
|
+
for (let ix = 0; ix < slice.children.length; ix++) {
|
|
118
|
+
if (this.seriesList[slice.children[ix].id].show) {
|
|
119
|
+
showChildren = true;
|
|
120
|
+
}
|
|
121
|
+
sunburstQueue.push({ parent: slice.id, data: slice.children[ix], depth: depth + 1 });
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
const dummy = {
|
|
125
|
+
id: 'dummy',
|
|
126
|
+
value: slice.value,
|
|
127
|
+
};
|
|
128
|
+
sunburstQueue.push({ parent: slice.id, data: dummy, depth: depth + 1 });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!showChildren) {
|
|
132
|
+
const dummy = {
|
|
133
|
+
id: 'dummy',
|
|
134
|
+
value: slice.value,
|
|
135
|
+
};
|
|
136
|
+
sunburstQueue.push({ parent: slice.id, data: dummy, depth: depth + 1 });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
ds[depth].data.sort((a, b) => b.value - a.value);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Take chart data and to create normalized pie data
|
|
146
|
+
* @param {object} data chart series info
|
|
147
|
+
*
|
|
148
|
+
* @returns {undefined}
|
|
149
|
+
*/
|
|
150
|
+
createPieDataSet(data, pie) {
|
|
151
|
+
this.pieDataSet = [];
|
|
152
|
+
const ds = this.pieDataSet;
|
|
153
|
+
|
|
154
|
+
pie.forEach((sId) => {
|
|
155
|
+
data[sId].forEach((value, index) => {
|
|
156
|
+
if (!ds[index]) {
|
|
157
|
+
ds[index] = { data: [], ir: 0, or: 0, total: 0 };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (this.seriesList[sId].show) {
|
|
161
|
+
ds[index].total += value || 0;
|
|
162
|
+
ds[index].data.push({ id: sId, value, sa: 0, ea: 0 });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
ds.forEach((item) => {
|
|
168
|
+
item.data.sort((a, b) => b.value - a.value);
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Take data and label to create stack data for each series
|
|
174
|
+
* @param {object} data chart series info
|
|
175
|
+
* @param {object} label chart label
|
|
176
|
+
* @param {array} base stacked base data
|
|
177
|
+
* @param {number} sIdx series ordered index
|
|
178
|
+
*
|
|
179
|
+
* @returns {array} data for each series
|
|
180
|
+
*/
|
|
181
|
+
addSeriesStackDS(data, label, base, sIdx = 0) {
|
|
182
|
+
const isHorizontal = this.options.horizontal;
|
|
183
|
+
const sdata = [];
|
|
184
|
+
|
|
185
|
+
data.forEach((curr, index) => {
|
|
186
|
+
let bdata = base[index];
|
|
187
|
+
let odata = curr;
|
|
188
|
+
let ldata = label[index];
|
|
189
|
+
let gdata = curr;
|
|
190
|
+
|
|
191
|
+
if (bdata != null && ldata != null) {
|
|
192
|
+
if (gdata && typeof gdata === 'object') {
|
|
193
|
+
odata = isHorizontal ? curr.x : curr.y;
|
|
194
|
+
ldata = isHorizontal ? curr.y : curr.x;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (sIdx > 0) {
|
|
198
|
+
bdata = isHorizontal ? bdata.x : bdata.y;
|
|
199
|
+
gdata = bdata + odata;
|
|
200
|
+
} else {
|
|
201
|
+
bdata = 0;
|
|
202
|
+
gdata = odata;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
sdata.push(this.addData(gdata, ldata, odata, bdata));
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
return sdata;
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Take data and label to create data for each series
|
|
214
|
+
* @param {object} data chart series info
|
|
215
|
+
* @param {object} label chart label
|
|
216
|
+
*
|
|
217
|
+
* @returns {array} data for each series
|
|
218
|
+
*/
|
|
219
|
+
addSeriesDS(data, label) {
|
|
220
|
+
const isHorizontal = this.options.horizontal;
|
|
221
|
+
const sdata = [];
|
|
222
|
+
|
|
223
|
+
data.forEach((curr, index) => {
|
|
224
|
+
let gdata = curr;
|
|
225
|
+
let ldata = label[index];
|
|
226
|
+
|
|
227
|
+
if (gdata && typeof gdata === 'object') {
|
|
228
|
+
gdata = isHorizontal ? curr.x : curr.y;
|
|
229
|
+
ldata = isHorizontal ? curr.y : curr.x;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (ldata !== null) {
|
|
233
|
+
sdata.push(this.addData(gdata, ldata));
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
return sdata;
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Take data to create data object for graph
|
|
242
|
+
* @param {object} gdata graph data (y-axis value for vertical chart)
|
|
243
|
+
* @param {object} ldata label data (x-axis value for vertical chart)
|
|
244
|
+
* @param {object} odata original data (without stacked value)
|
|
245
|
+
* @param {object} bdata base data (stacked value)
|
|
246
|
+
|
|
247
|
+
* @returns {object} data for each graph point
|
|
248
|
+
*/
|
|
249
|
+
addData(gdata, ldata, odata = null, bdata = null) {
|
|
250
|
+
let data;
|
|
251
|
+
|
|
252
|
+
if (this.options.horizontal) {
|
|
253
|
+
data = { x: gdata, y: ldata, o: odata, b: bdata, xp: null, yp: null, w: null, h: null };
|
|
254
|
+
} else {
|
|
255
|
+
data = { x: ldata, y: gdata, o: odata, b: bdata, xp: null, yp: null, w: null, h: null };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return data;
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Take series data to create min/max info for each series
|
|
263
|
+
* @param {object} data series data
|
|
264
|
+
*
|
|
265
|
+
* @returns {object} min/max info for series
|
|
266
|
+
*/
|
|
267
|
+
getSeriesMinMax(data) {
|
|
268
|
+
const def = { minX: null, minY: null, maxX: null, maxY: null, maxDomain: null };
|
|
269
|
+
const isHorizontal = this.options.horizontal;
|
|
270
|
+
|
|
271
|
+
if (data.length) {
|
|
272
|
+
return data.reduce((acc, p, index) => {
|
|
273
|
+
const minmax = acc;
|
|
274
|
+
if (p.x <= minmax.minX) {
|
|
275
|
+
minmax.minX = (p.x === null) ? 0 : p.x;
|
|
276
|
+
}
|
|
277
|
+
if (p.y <= minmax.minY) {
|
|
278
|
+
minmax.minY = (p.y === null) ? 0 : p.y;
|
|
279
|
+
}
|
|
280
|
+
if (p.x >= minmax.maxX) {
|
|
281
|
+
minmax.maxX = (p.x === null) ? 0 : p.x;
|
|
282
|
+
|
|
283
|
+
if (isHorizontal && p.x !== null) {
|
|
284
|
+
minmax.maxDomain = p.y;
|
|
285
|
+
minmax.maxDomainIndex = index;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (p.y >= minmax.maxY) {
|
|
289
|
+
minmax.maxY = (p.y === null) ? 0 : p.y;
|
|
290
|
+
|
|
291
|
+
if (!isHorizontal && p.y !== null) {
|
|
292
|
+
minmax.maxDomain = p.x;
|
|
293
|
+
minmax.maxDomainIndex = index;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return minmax;
|
|
298
|
+
}, {
|
|
299
|
+
minX: data[0].x,
|
|
300
|
+
minY: data[0].y,
|
|
301
|
+
maxX: data[0].x,
|
|
302
|
+
maxY: data[0].y,
|
|
303
|
+
maxDomain: isHorizontal ? data[0].y : data[0].x,
|
|
304
|
+
maxDomainIndex: 0,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return def;
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Get graph item by label index
|
|
313
|
+
* @param {number} pos label index position
|
|
314
|
+
*
|
|
315
|
+
* @returns {object} graph item
|
|
316
|
+
*/
|
|
317
|
+
getItemByLabelIndex(pos) {
|
|
318
|
+
if (pos < 0) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return this.getItem(pos);
|
|
323
|
+
},
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get graph item by label
|
|
327
|
+
* @param {any} label label value for searching graph item
|
|
328
|
+
*
|
|
329
|
+
* @returns {object} graph item
|
|
330
|
+
*/
|
|
331
|
+
getItemByLabel(label) {
|
|
332
|
+
if (label === null || label === undefined) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const labels = this.data.labels;
|
|
337
|
+
const labelIndex = labels && labels.indexOf ? labels.indexOf(label) : -1;
|
|
338
|
+
|
|
339
|
+
return this.getItem(labelIndex);
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Get graph items for each series by label index
|
|
344
|
+
* @param {number} labelIndex label index
|
|
345
|
+
*
|
|
346
|
+
* @returns {object} graph item
|
|
347
|
+
*/
|
|
348
|
+
getItem(labelIndex) {
|
|
349
|
+
const sIds = Object.keys(this.seriesList);
|
|
350
|
+
const isHorizontal = !!this.options.horizontal;
|
|
351
|
+
|
|
352
|
+
let maxl = null;
|
|
353
|
+
let maxp = null;
|
|
354
|
+
let maxg = null;
|
|
355
|
+
let maxSID = '';
|
|
356
|
+
let acc = 0;
|
|
357
|
+
let useStack = false;
|
|
358
|
+
let findInfo = false;
|
|
359
|
+
|
|
360
|
+
if (labelIndex > -1) {
|
|
361
|
+
for (let ix = 0; ix < sIds.length; ix++) {
|
|
362
|
+
const sId = sIds[ix];
|
|
363
|
+
const series = this.seriesList[sId];
|
|
364
|
+
const data = series.data[labelIndex];
|
|
365
|
+
|
|
366
|
+
if (data && series.show && series.showLegend) {
|
|
367
|
+
const ldata = isHorizontal ? data.y : data.x;
|
|
368
|
+
const lp = isHorizontal ? data.yp : data.xp;
|
|
369
|
+
|
|
370
|
+
if (ldata !== null && ldata !== undefined) {
|
|
371
|
+
const g = isHorizontal ? data.o || data.x : data.o || data.y;
|
|
372
|
+
|
|
373
|
+
if (series.stackIndex) {
|
|
374
|
+
acc += !isNaN(data.o) ? data.o : 0;
|
|
375
|
+
useStack = true;
|
|
376
|
+
} else {
|
|
377
|
+
acc += data.y;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (maxg === null || maxg <= g) {
|
|
381
|
+
maxg = g;
|
|
382
|
+
maxSID = sId;
|
|
383
|
+
maxl = ldata;
|
|
384
|
+
maxp = lp;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
findInfo = {
|
|
391
|
+
label: maxl,
|
|
392
|
+
pos: maxp,
|
|
393
|
+
value: maxg === null ? 0 : maxg,
|
|
394
|
+
sId: maxSID,
|
|
395
|
+
acc,
|
|
396
|
+
useStack,
|
|
397
|
+
maxIndex: labelIndex,
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return findInfo;
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Create min/max information for all of data
|
|
406
|
+
* @property seriesList
|
|
407
|
+
*
|
|
408
|
+
* @returns {object} min/max info for all of data
|
|
409
|
+
*/
|
|
410
|
+
getStoreMinMax() {
|
|
411
|
+
const keys = Object.keys(this.seriesList);
|
|
412
|
+
const isHorizontal = this.options.horizontal;
|
|
413
|
+
const def = {
|
|
414
|
+
x: [{ min: null, max: null }],
|
|
415
|
+
y: [{ min: null, max: null }],
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
if (keys.length) {
|
|
419
|
+
return keys.reduce((acc, key) => {
|
|
420
|
+
const minmax = acc;
|
|
421
|
+
const series = this.seriesList[key];
|
|
422
|
+
const smm = series.minMax;
|
|
423
|
+
const axisX = series.xAxisIndex;
|
|
424
|
+
const axisY = series.yAxisIndex;
|
|
425
|
+
|
|
426
|
+
if (!minmax.x[axisX]) {
|
|
427
|
+
minmax.x[axisX] = { min: null, max: null, maxSID: null };
|
|
428
|
+
}
|
|
429
|
+
if (!minmax.y[axisY]) {
|
|
430
|
+
minmax.y[axisY] = { min: null, max: null, maxSID: null };
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (smm && series.show) {
|
|
434
|
+
if (!isHorizontal) {
|
|
435
|
+
if (smm.minX && ((!minmax.x[axisX].min || (smm.minX < minmax.x[axisX].min)))) {
|
|
436
|
+
minmax.x[axisX].min = smm.minX;
|
|
437
|
+
}
|
|
438
|
+
if (!minmax.y[axisY].min || (smm.minY < minmax.y[axisY].min)) {
|
|
439
|
+
minmax.y[axisY].min = smm.minY;
|
|
440
|
+
}
|
|
441
|
+
} else {
|
|
442
|
+
if (!minmax.x[axisX].min || (smm.minX < minmax.x[axisX].min)) {
|
|
443
|
+
minmax.x[axisX].min = smm.minX;
|
|
444
|
+
}
|
|
445
|
+
if (smm.minY && (!minmax.y[axisY].min || (smm.minY < minmax.y[axisY].min))) {
|
|
446
|
+
minmax.y[axisY].min = smm.minY;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
if (smm.maxX >= minmax.x[axisX].max) {
|
|
450
|
+
minmax.x[axisX].max = smm.maxX;
|
|
451
|
+
minmax.x[axisX].maxSID = key;
|
|
452
|
+
}
|
|
453
|
+
if (smm.maxY >= minmax.y[axisY].max) {
|
|
454
|
+
minmax.y[axisY].max = smm.maxY;
|
|
455
|
+
minmax.y[axisX].maxSID = key;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
return minmax;
|
|
460
|
+
}, {
|
|
461
|
+
x: [{ min: null, max: null, maxSID: null }],
|
|
462
|
+
y: [{ min: null, max: null, maxSID: null }],
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return def;
|
|
467
|
+
},
|
|
468
|
+
|
|
469
|
+
calculateAngle() {
|
|
470
|
+
const pieDataSet = this.pieDataSet;
|
|
471
|
+
|
|
472
|
+
let slice;
|
|
473
|
+
let value;
|
|
474
|
+
let parent;
|
|
475
|
+
let totalValue;
|
|
476
|
+
|
|
477
|
+
let sliceAngle;
|
|
478
|
+
let startAngle;
|
|
479
|
+
let endAngle;
|
|
480
|
+
let totalAngle;
|
|
481
|
+
let isDummy;
|
|
482
|
+
|
|
483
|
+
const dummyIndex = [];
|
|
484
|
+
const saStore = {
|
|
485
|
+
'$ev-root': 1.5 * Math.PI,
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
for (let ix = 0; ix < pieDataSet.length; ix++) {
|
|
489
|
+
const pie = pieDataSet[ix];
|
|
490
|
+
isDummy = true;
|
|
491
|
+
|
|
492
|
+
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
493
|
+
slice = pie.data[jx];
|
|
494
|
+
value = slice.value;
|
|
495
|
+
|
|
496
|
+
if (isDummy) {
|
|
497
|
+
isDummy = slice.id === 'dummy';
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (!ix) {
|
|
501
|
+
startAngle = saStore['$ev-root'];
|
|
502
|
+
sliceAngle = 2 * Math.PI * (value / pie.total);
|
|
503
|
+
endAngle = startAngle + sliceAngle;
|
|
504
|
+
|
|
505
|
+
slice.sa = startAngle;
|
|
506
|
+
slice.ea = endAngle;
|
|
507
|
+
saStore['$ev-root'] += sliceAngle;
|
|
508
|
+
} else {
|
|
509
|
+
parent = this.getParentInfo(ix - 1, slice.parent);
|
|
510
|
+
if (!parent) {
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (!saStore[slice.parent]) {
|
|
515
|
+
saStore[slice.parent] = parent.sa;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
startAngle = saStore[slice.parent];
|
|
519
|
+
totalAngle = parent.ea - parent.sa;
|
|
520
|
+
totalValue = pie.total[slice.parent] || 0;
|
|
521
|
+
sliceAngle = totalAngle * (value / totalValue);
|
|
522
|
+
endAngle = startAngle + sliceAngle;
|
|
523
|
+
|
|
524
|
+
slice.sa = startAngle;
|
|
525
|
+
slice.ea = endAngle;
|
|
526
|
+
|
|
527
|
+
saStore[slice.parent] += sliceAngle;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (isDummy) {
|
|
532
|
+
dummyIndex.push(ix);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
for (let ix = 0; ix < dummyIndex.length; ix++) {
|
|
537
|
+
this.pieDataSet.splice(dummyIndex, 1);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (this.options.reverse) {
|
|
541
|
+
this.pieDataSet = reverse(this.pieDataSet);
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
|
|
545
|
+
getParentInfo(depth, parentId) {
|
|
546
|
+
for (let ix = depth; ix >= 0; ix--) {
|
|
547
|
+
const pie = this.pieDataSet[ix];
|
|
548
|
+
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
549
|
+
if (pie.data[jx].id === parentId) {
|
|
550
|
+
return pie.data[jx];
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return null;
|
|
556
|
+
},
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
export default modules;
|