evui 2.1.0 → 2.1.3
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 +317 -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 +23 -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 +7 -0
- package/src/components/message-box/message-box.js +32 -0
- package/src/components/message-box/message-box.vue +291 -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 +28 -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
|
@@ -1,38 +1,67 @@
|
|
|
1
1
|
import Line from '../element/element.line';
|
|
2
2
|
import Scatter from '../element/element.scatter';
|
|
3
3
|
import Bar from '../element/element.bar';
|
|
4
|
+
import TimeBar from '../element/element.bar.time';
|
|
5
|
+
import Pie from '../element/element.pie';
|
|
4
6
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
+
const modules = {
|
|
8
|
+
/**
|
|
9
|
+
* Takes series information to create series list.
|
|
10
|
+
* @param {object} series chart series info
|
|
11
|
+
* @param {string} defaultType default series type in options
|
|
12
|
+
* @param {boolean} isHorizontal determines if a horizontal option's value
|
|
13
|
+
*
|
|
14
|
+
* @returns {undefined}
|
|
15
|
+
*/
|
|
16
|
+
createSeriesSet(series, defaultType, isHorizontal) {
|
|
7
17
|
Object.keys(series).forEach((key, index) => {
|
|
8
18
|
const type = series[key].type || defaultType;
|
|
9
19
|
this.seriesList[key] = this.addSeries({
|
|
10
20
|
type,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
id: key,
|
|
22
|
+
opt: series[key],
|
|
23
|
+
index,
|
|
24
|
+
isHorizontal,
|
|
14
25
|
});
|
|
15
26
|
});
|
|
16
27
|
},
|
|
17
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Takes series information to create series list.
|
|
31
|
+
* @param {object} param series info
|
|
32
|
+
*
|
|
33
|
+
* @returns {object} object for proper series type
|
|
34
|
+
*/
|
|
18
35
|
addSeries(param) {
|
|
19
|
-
const type = param
|
|
20
|
-
const id = param.sId;
|
|
21
|
-
const opt = param.sOpt;
|
|
22
|
-
const idx = param.sIdx;
|
|
36
|
+
const { type, id, opt, index, isHorizontal } = param;
|
|
23
37
|
|
|
24
38
|
if (type === 'line') {
|
|
25
|
-
|
|
39
|
+
this.seriesInfo.charts.line.push(id);
|
|
40
|
+
return new Line(id, opt, index);
|
|
26
41
|
} else if (type === 'scatter') {
|
|
27
|
-
|
|
42
|
+
this.seriesInfo.charts.scatter.push(id);
|
|
43
|
+
return new Scatter(id, opt, index);
|
|
28
44
|
} else if (type === 'bar') {
|
|
29
|
-
this.
|
|
30
|
-
|
|
45
|
+
this.seriesInfo.charts.bar.push(id);
|
|
46
|
+
|
|
47
|
+
if (opt.timeMode) {
|
|
48
|
+
return new TimeBar(id, opt, index, isHorizontal);
|
|
49
|
+
}
|
|
50
|
+
return new Bar(id, opt, index, isHorizontal);
|
|
51
|
+
} else if (type === 'pie') {
|
|
52
|
+
this.seriesInfo.charts.pie.push(id);
|
|
53
|
+
return new Pie(id, opt, index);
|
|
31
54
|
}
|
|
32
55
|
|
|
33
56
|
return false;
|
|
34
57
|
},
|
|
35
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Set series group to create stack chart
|
|
61
|
+
* @param {object} groups group info
|
|
62
|
+
*
|
|
63
|
+
* @returns {undefined}
|
|
64
|
+
*/
|
|
36
65
|
addGroupInfo(groups) {
|
|
37
66
|
groups.forEach((group, gIdx) => {
|
|
38
67
|
let interpolation = 0;
|
|
@@ -54,4 +83,4 @@ const module = {
|
|
|
54
83
|
},
|
|
55
84
|
};
|
|
56
85
|
|
|
57
|
-
export default
|
|
86
|
+
export default modules;
|
|
@@ -1,65 +1,251 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
11
|
createDataSet(data, label) {
|
|
3
|
-
Object.keys(this.
|
|
4
|
-
const
|
|
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;
|
|
5
115
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
}
|
|
10
123
|
} else {
|
|
11
|
-
|
|
124
|
+
const dummy = {
|
|
125
|
+
id: 'dummy',
|
|
126
|
+
value: slice.value,
|
|
127
|
+
};
|
|
128
|
+
sunburstQueue.push({ parent: slice.id, data: dummy, depth: depth + 1 });
|
|
12
129
|
}
|
|
13
130
|
|
|
14
|
-
|
|
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
|
+
}
|
|
15
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);
|
|
16
169
|
});
|
|
17
170
|
},
|
|
18
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
|
+
*/
|
|
19
181
|
addSeriesStackDS(data, label, base, sIdx = 0) {
|
|
20
182
|
const isHorizontal = this.options.horizontal;
|
|
183
|
+
const sdata = [];
|
|
21
184
|
|
|
22
|
-
|
|
185
|
+
data.forEach((curr, index) => {
|
|
23
186
|
let bdata = base[index];
|
|
24
187
|
let odata = curr;
|
|
25
188
|
let ldata = label[index];
|
|
26
189
|
let gdata = curr;
|
|
27
190
|
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
+
}
|
|
33
196
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
197
|
+
if (sIdx > 0) {
|
|
198
|
+
bdata = isHorizontal ? bdata.x : bdata.y;
|
|
199
|
+
gdata = bdata + odata;
|
|
200
|
+
} else {
|
|
201
|
+
bdata = 0;
|
|
202
|
+
gdata = odata;
|
|
203
|
+
}
|
|
41
204
|
|
|
42
|
-
|
|
205
|
+
sdata.push(this.addData(gdata, ldata, odata, bdata));
|
|
206
|
+
}
|
|
43
207
|
});
|
|
208
|
+
|
|
209
|
+
return sdata;
|
|
44
210
|
},
|
|
45
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
|
+
*/
|
|
46
219
|
addSeriesDS(data, label) {
|
|
47
220
|
const isHorizontal = this.options.horizontal;
|
|
221
|
+
const sdata = [];
|
|
48
222
|
|
|
49
|
-
|
|
223
|
+
data.forEach((curr, index) => {
|
|
50
224
|
let gdata = curr;
|
|
51
225
|
let ldata = label[index];
|
|
52
226
|
|
|
53
227
|
if (gdata && typeof gdata === 'object') {
|
|
54
228
|
gdata = isHorizontal ? curr.x : curr.y;
|
|
55
229
|
ldata = isHorizontal ? curr.y : curr.x;
|
|
56
|
-
this.addIntegratedLabels(ldata);
|
|
57
230
|
}
|
|
58
231
|
|
|
59
|
-
|
|
232
|
+
if (ldata !== null) {
|
|
233
|
+
sdata.push(this.addData(gdata, ldata));
|
|
234
|
+
}
|
|
60
235
|
});
|
|
236
|
+
|
|
237
|
+
return sdata;
|
|
61
238
|
},
|
|
62
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
|
+
*/
|
|
63
249
|
addData(gdata, ldata, odata = null, bdata = null) {
|
|
64
250
|
let data;
|
|
65
251
|
|
|
@@ -72,38 +258,155 @@ const module = {
|
|
|
72
258
|
return data;
|
|
73
259
|
},
|
|
74
260
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
+
*/
|
|
81
267
|
getSeriesMinMax(data) {
|
|
82
|
-
const def = { minX: null, minY: null, maxX: null, maxY: null };
|
|
268
|
+
const def = { minX: null, minY: null, maxX: null, maxY: null, maxDomain: null };
|
|
269
|
+
const isHorizontal = this.options.horizontal;
|
|
83
270
|
|
|
84
271
|
if (data.length) {
|
|
85
|
-
return data.reduce((acc, p) => {
|
|
272
|
+
return data.reduce((acc, p, index) => {
|
|
86
273
|
const minmax = acc;
|
|
87
|
-
if (p.x
|
|
274
|
+
if (p.x <= minmax.minX) {
|
|
88
275
|
minmax.minX = (p.x === null) ? 0 : p.x;
|
|
89
276
|
}
|
|
90
|
-
if (p.y
|
|
277
|
+
if (p.y <= minmax.minY) {
|
|
91
278
|
minmax.minY = (p.y === null) ? 0 : p.y;
|
|
92
279
|
}
|
|
93
|
-
if (p.x
|
|
280
|
+
if (p.x >= minmax.maxX) {
|
|
94
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
|
+
}
|
|
95
287
|
}
|
|
96
|
-
if (p.y
|
|
288
|
+
if (p.y >= minmax.maxY) {
|
|
97
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
|
+
}
|
|
98
295
|
}
|
|
99
296
|
|
|
100
297
|
return minmax;
|
|
101
|
-
}, {
|
|
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
|
+
});
|
|
102
306
|
}
|
|
103
307
|
|
|
104
308
|
return def;
|
|
105
309
|
},
|
|
106
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
|
+
*/
|
|
107
410
|
getStoreMinMax() {
|
|
108
411
|
const keys = Object.keys(this.seriesList);
|
|
109
412
|
const isHorizontal = this.options.horizontal;
|
|
@@ -121,10 +424,10 @@ const module = {
|
|
|
121
424
|
const axisY = series.yAxisIndex;
|
|
122
425
|
|
|
123
426
|
if (!minmax.x[axisX]) {
|
|
124
|
-
minmax.x[axisX] = { min: null, max: null };
|
|
427
|
+
minmax.x[axisX] = { min: null, max: null, maxSID: null };
|
|
125
428
|
}
|
|
126
429
|
if (!minmax.y[axisY]) {
|
|
127
|
-
minmax.y[axisY] = { min: null, max: null };
|
|
430
|
+
minmax.y[axisY] = { min: null, max: null, maxSID: null };
|
|
128
431
|
}
|
|
129
432
|
|
|
130
433
|
if (smm && series.show) {
|
|
@@ -143,23 +446,114 @@ const module = {
|
|
|
143
446
|
minmax.y[axisY].min = smm.minY;
|
|
144
447
|
}
|
|
145
448
|
}
|
|
146
|
-
if (smm.maxX
|
|
449
|
+
if (smm.maxX >= minmax.x[axisX].max) {
|
|
147
450
|
minmax.x[axisX].max = smm.maxX;
|
|
451
|
+
minmax.x[axisX].maxSID = key;
|
|
148
452
|
}
|
|
149
|
-
if (smm.maxY
|
|
453
|
+
if (smm.maxY >= minmax.y[axisY].max) {
|
|
150
454
|
minmax.y[axisY].max = smm.maxY;
|
|
455
|
+
minmax.y[axisX].maxSID = key;
|
|
151
456
|
}
|
|
152
457
|
}
|
|
153
458
|
|
|
154
459
|
return minmax;
|
|
155
460
|
}, {
|
|
156
|
-
x: [{ min: null, max: null }],
|
|
157
|
-
y: [{ min: null, max: null }],
|
|
461
|
+
x: [{ min: null, max: null, maxSID: null }],
|
|
462
|
+
y: [{ min: null, max: null, maxSID: null }],
|
|
158
463
|
});
|
|
159
464
|
}
|
|
160
465
|
|
|
161
466
|
return def;
|
|
162
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
|
+
},
|
|
163
557
|
};
|
|
164
558
|
|
|
165
|
-
export default
|
|
559
|
+
export default modules;
|