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
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import BaseChart from './chart.base';
|
|
2
|
-
import Util from '../core/core.util';
|
|
3
|
-
|
|
4
|
-
export default class LineChart extends BaseChart {
|
|
5
|
-
drawChart() {
|
|
6
|
-
if (!this.chartRect.width || !this.chartRect.height ||
|
|
7
|
-
this.chartRect.width < 1 || this.chartRect.height < 1) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
this.setLabelOffset();
|
|
12
|
-
this.createAxis();
|
|
13
|
-
this.createLine();
|
|
14
|
-
|
|
15
|
-
this.displayCtx.drawImage(this.bufferCanvas, 0, 0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
createLine() {
|
|
19
|
-
const groups = this.data.groups;
|
|
20
|
-
const graphData = this.graphData;
|
|
21
|
-
const skey = Object.keys(graphData);
|
|
22
|
-
let series;
|
|
23
|
-
|
|
24
|
-
if (groups.length) {
|
|
25
|
-
for (let ix = 0, ixLen = groups.length; ix < ixLen; ix++) {
|
|
26
|
-
const group = groups[ix];
|
|
27
|
-
for (let jx = 0, jxLen = group.length; jx < jxLen; jx++) {
|
|
28
|
-
series = this.seriesList[group[jx]];
|
|
29
|
-
|
|
30
|
-
if (series.show) {
|
|
31
|
-
this.drawSeries(group[jx], graphData[group[jx]]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
for (let ix = 0, ixLen = skey.length; ix < ixLen; ix++) {
|
|
38
|
-
series = this.seriesList[skey[ix]];
|
|
39
|
-
|
|
40
|
-
if (!series.isExistGrp && series.show) {
|
|
41
|
-
this.drawSeries(skey[ix], graphData[skey[ix]]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
drawSeries(seriesId, data) {
|
|
47
|
-
const series = this.seriesList[seriesId];
|
|
48
|
-
const ctx = this.bufferCtx;
|
|
49
|
-
const color = series.color;
|
|
50
|
-
|
|
51
|
-
const isFill = series.fill;
|
|
52
|
-
const stackIndex = series.stackIndex;
|
|
53
|
-
|
|
54
|
-
ctx.beginPath();
|
|
55
|
-
ctx.lineJoin = 'round';
|
|
56
|
-
ctx.lineWidth = series.lineWidth;
|
|
57
|
-
ctx.strokeStyle = color;
|
|
58
|
-
|
|
59
|
-
if (isFill) {
|
|
60
|
-
ctx.fillStyle = `rgba(${Util.hexToRgb(color)},${series.fillOpacity})` || '';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let startFillIndex = 0;
|
|
64
|
-
const endPoint = this.chartRect.y2 - this.labelOffset.bottom;
|
|
65
|
-
const dataLen = data.length;
|
|
66
|
-
|
|
67
|
-
let x;
|
|
68
|
-
let y;
|
|
69
|
-
let gdata;
|
|
70
|
-
let prev;
|
|
71
|
-
let convX;
|
|
72
|
-
let convY;
|
|
73
|
-
let aliasPixel;
|
|
74
|
-
|
|
75
|
-
for (let ix = 0; ix < dataLen; ix++) {
|
|
76
|
-
gdata = data[ix];
|
|
77
|
-
prev = data[ix - 1];
|
|
78
|
-
|
|
79
|
-
x = this.calculateX(gdata.x, series.xAxisIndex, true);
|
|
80
|
-
y = this.calculateY(gdata.y, series.yAxisIndex, false);
|
|
81
|
-
|
|
82
|
-
aliasPixel = Util.aliasPixel(x);
|
|
83
|
-
x += aliasPixel;
|
|
84
|
-
|
|
85
|
-
if (y === null) {
|
|
86
|
-
if (ix - 1 > -1) {
|
|
87
|
-
if (isFill && prev.y !== null) {
|
|
88
|
-
ctx.stroke();
|
|
89
|
-
ctx.lineTo(prev.xp, endPoint);
|
|
90
|
-
ctx.lineTo(data[startFillIndex].xp, endPoint);
|
|
91
|
-
|
|
92
|
-
// 단순히 fill을 위해서 하단 lineTo는 의미가 없으나 명확성을 위해 남겨둠
|
|
93
|
-
ctx.lineTo(data[startFillIndex].xp, data[startFillIndex].yp);
|
|
94
|
-
|
|
95
|
-
ctx.fill();
|
|
96
|
-
ctx.beginPath();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
startFillIndex = ix + 1;
|
|
101
|
-
} else if (ix === 0 || prev.y === null || gdata.y === null ||
|
|
102
|
-
// 시작 지점 혹은 이전/현 X또는 Y값이 없다면 moveTo로 좌표를 이동
|
|
103
|
-
// null 데이터가 들어왔을 시 차트를 끊어내기 위함.
|
|
104
|
-
prev.x === null || gdata.x === null) {
|
|
105
|
-
ctx.moveTo(x, y);
|
|
106
|
-
} else {
|
|
107
|
-
ctx.lineTo(x, y);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
gdata.xp = x;
|
|
111
|
-
gdata.yp = y;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
ctx.stroke();
|
|
115
|
-
if (isFill && dataLen && data[dataLen - 1].y !== null) {
|
|
116
|
-
ctx.fillStyle = `rgba(${Util.hexToRgb(color)},${series.fillOpacity})` || '';
|
|
117
|
-
|
|
118
|
-
if (stackIndex) {
|
|
119
|
-
for (let ix = dataLen - 1; ix >= startFillIndex; ix--) {
|
|
120
|
-
gdata = data[ix];
|
|
121
|
-
|
|
122
|
-
convX = this.calculateX(gdata.x, series.xAxisIndex, true);
|
|
123
|
-
convY = this.calculateY(gdata.b, series.yAxisIndex, false);
|
|
124
|
-
|
|
125
|
-
ctx.lineTo(convX, convY);
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
ctx.lineTo(data[dataLen - 1].xp, endPoint);
|
|
129
|
-
ctx.lineTo(data[startFillIndex].xp, endPoint);
|
|
130
|
-
}
|
|
131
|
-
// 단순히 fill을 위해서 하단 lineTo는 의미가 없으나 명확성을 위해 남겨둠
|
|
132
|
-
ctx.lineTo(data[startFillIndex].xp, data[startFillIndex].yp);
|
|
133
|
-
|
|
134
|
-
ctx.fill();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// 포인트 효과를 마지막에 다시 그리는 이유는 마지막에 그려야 다른 그림과 겹치지 않음.
|
|
138
|
-
if (series.point) {
|
|
139
|
-
ctx.strokeStyle = color;
|
|
140
|
-
ctx.fillStyle = series.pointFill;
|
|
141
|
-
ctx.lineWidth = series.lineWidth;
|
|
142
|
-
for (let ix = 0, ixLen = dataLen; ix < ixLen; ix++) {
|
|
143
|
-
gdata = data[ix];
|
|
144
|
-
|
|
145
|
-
if (gdata.xp !== null && gdata.yp !== null) {
|
|
146
|
-
this.drawPoint(ctx, series.pointStyle, series.pointSize, gdata.xp, gdata.yp);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
seriesHighlight(seriesId) {
|
|
153
|
-
const ctx = this.overlayCtx;
|
|
154
|
-
const series = this.seriesList[seriesId];
|
|
155
|
-
const data = this.graphData[seriesId];
|
|
156
|
-
const color = series.color;
|
|
157
|
-
|
|
158
|
-
let x = null;
|
|
159
|
-
let y = null;
|
|
160
|
-
let gdata;
|
|
161
|
-
let prev;
|
|
162
|
-
|
|
163
|
-
ctx.beginPath();
|
|
164
|
-
ctx.lineJoin = 'round';
|
|
165
|
-
ctx.lineWidth = 2;
|
|
166
|
-
ctx.strokeStyle = color;
|
|
167
|
-
ctx.shadowOffsetX = 0;
|
|
168
|
-
ctx.shadowOffsetY = 0;
|
|
169
|
-
ctx.shadowBlur = 8;
|
|
170
|
-
ctx.shadowColor = color;
|
|
171
|
-
|
|
172
|
-
for (let ix = 0, ixLen = data.length; ix < ixLen; ix++) {
|
|
173
|
-
gdata = data[ix];
|
|
174
|
-
prev = data[ix - 1];
|
|
175
|
-
|
|
176
|
-
x = gdata.xp;
|
|
177
|
-
y = gdata.yp;
|
|
178
|
-
|
|
179
|
-
// 시작 지점 혹은 이전/현 X또는 Y값이 없다면 moveTo로 좌표를 이동
|
|
180
|
-
// null 데이터가 들어왔을 시 차트를 끊어내기 위함.
|
|
181
|
-
if (ix === 0 || prev.y === null || gdata.y === null || prev.x === null || gdata.x === null) {
|
|
182
|
-
ctx.moveTo(x, y);
|
|
183
|
-
} else {
|
|
184
|
-
ctx.lineTo(x, y);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
ctx.stroke();
|
|
189
|
-
ctx.closePath();
|
|
190
|
-
|
|
191
|
-
if (series.point) {
|
|
192
|
-
const pSize = series.highlight.pointSize;
|
|
193
|
-
|
|
194
|
-
ctx.beginPath();
|
|
195
|
-
ctx.strokeStyle = color;
|
|
196
|
-
ctx.lineWidth = 2;
|
|
197
|
-
ctx.fillStyle = color;
|
|
198
|
-
|
|
199
|
-
for (let ix = 0, ixLen = data.length; ix < ixLen; ix++) {
|
|
200
|
-
gdata = data[ix];
|
|
201
|
-
|
|
202
|
-
if (gdata.xp !== null && gdata.yp !== null) {
|
|
203
|
-
this.drawPoint(ctx, series.pointStyle, pSize, gdata.xp, gdata.yp);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
itemHighlight(item) {
|
|
210
|
-
if (item.index === null || item.sId === null) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const graphData = this.graphData;
|
|
215
|
-
const gdata = graphData[item.sId];
|
|
216
|
-
const ctx = this.overlayCtx;
|
|
217
|
-
const series = this.seriesList[item.sId];
|
|
218
|
-
|
|
219
|
-
if (!series.point) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const color = series.color;
|
|
224
|
-
const x = gdata[item.index].xp;
|
|
225
|
-
const y = gdata[item.index].yp;
|
|
226
|
-
const pSize = series.highlight.pointSize;
|
|
227
|
-
|
|
228
|
-
ctx.strokeStyle = color;
|
|
229
|
-
ctx.lineWidth = series.lineWidth;
|
|
230
|
-
ctx.fillStyle = series.pointFill;
|
|
231
|
-
ctx.shadowOffsetX = 0;
|
|
232
|
-
ctx.shadowOffsetY = 0;
|
|
233
|
-
ctx.shadowBlur = 4;
|
|
234
|
-
ctx.shadowColor = color;
|
|
235
|
-
|
|
236
|
-
if (x !== null && y !== null) {
|
|
237
|
-
this.drawPoint(ctx, series.pointStyle, pSize, x, y);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
showCrosshair(offset) {
|
|
242
|
-
const ctx = this.overlayCtx;
|
|
243
|
-
const x = offset[0];
|
|
244
|
-
const y = offset[1];
|
|
245
|
-
const graphPos = this.getChartGraphPos();
|
|
246
|
-
|
|
247
|
-
if ((x >= (graphPos.x1 - 1) && x <= (graphPos.x2 + 1))
|
|
248
|
-
&& (y >= (graphPos.y1 - 1) && y <= (graphPos.y2 + 1))) {
|
|
249
|
-
ctx.strokeStyle = '#ff5500';
|
|
250
|
-
ctx.lineWidth = 2;
|
|
251
|
-
|
|
252
|
-
ctx.beginPath();
|
|
253
|
-
ctx.save();
|
|
254
|
-
ctx.shadowBlur = 0;
|
|
255
|
-
ctx.moveTo(x, graphPos.y1);
|
|
256
|
-
ctx.lineTo(x, graphPos.y2);
|
|
257
|
-
|
|
258
|
-
ctx.stroke();
|
|
259
|
-
ctx.restore();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import BaseChart from './chart.base';
|
|
3
|
-
import PieDataStore from '../core/data/data.pie';
|
|
4
|
-
|
|
5
|
-
export default class PieChart extends BaseChart {
|
|
6
|
-
constructor(target, data, options) {
|
|
7
|
-
super(target, data, options);
|
|
8
|
-
|
|
9
|
-
this.radiusArr = [];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
createDataStore() {
|
|
13
|
-
this.store = new PieDataStore({
|
|
14
|
-
chartData: this.data,
|
|
15
|
-
chartOptions: this.options,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
drawChart() {
|
|
20
|
-
this.createPie();
|
|
21
|
-
this.displayCtx.drawImage(this.bufferCanvas, 0, 0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
createPie() {
|
|
25
|
-
const graphData = this.graphData;
|
|
26
|
-
let dsLength = 0;
|
|
27
|
-
let showIndex = 0;
|
|
28
|
-
|
|
29
|
-
for (let ix = 0, ixLen = graphData.length; ix < ixLen; ix++) {
|
|
30
|
-
if (graphData[ix].total) {
|
|
31
|
-
dsLength += 1;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
for (let ix = 0, ixLen = graphData.length; ix < ixLen; ix++) {
|
|
36
|
-
this.store.sortingDescDataSet(ix);
|
|
37
|
-
if (graphData[ix].total) {
|
|
38
|
-
this.drawPieDataSet(graphData[ix], showIndex, dsLength);
|
|
39
|
-
showIndex += 1;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (this.options.doughnutHoleSize > 0) {
|
|
44
|
-
this.drawDoughnutHole(graphData.length - 1);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
drawPieDataSet(dataSetInfo, dsIndex, dsLength) {
|
|
49
|
-
let item;
|
|
50
|
-
let val;
|
|
51
|
-
let sliceAngle;
|
|
52
|
-
let color;
|
|
53
|
-
let startAngle = 1.5 * Math.PI;
|
|
54
|
-
let endAngle;
|
|
55
|
-
let series;
|
|
56
|
-
|
|
57
|
-
const dsInfo = dataSetInfo;
|
|
58
|
-
const width = this.chartRect.chartWidth - this.chartRect.padding.left;
|
|
59
|
-
const height = this.chartRect.chartHeight - this.chartRect.padding.top;
|
|
60
|
-
|
|
61
|
-
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
62
|
-
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
63
|
-
|
|
64
|
-
const innerRadius = Math.min(width / 2, height / 2) * this.options.doughnutHoleSize;
|
|
65
|
-
const outerRadius = Math.min(width / 2, height / 2);
|
|
66
|
-
|
|
67
|
-
const radius = outerRadius - (((outerRadius - innerRadius) / dsLength) * dsIndex);
|
|
68
|
-
|
|
69
|
-
dsInfo.or = radius;
|
|
70
|
-
if (dsIndex < dsLength - 1) {
|
|
71
|
-
dsInfo.ir = outerRadius - (((outerRadius - innerRadius) / dsLength) * (dsIndex + 1));
|
|
72
|
-
} else {
|
|
73
|
-
dsInfo.ir = 1;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (dsInfo.total) {
|
|
77
|
-
for (let ix = 0, ixLen = dsInfo.data.length; ix < ixLen; ix++) {
|
|
78
|
-
item = dsInfo.data[ix];
|
|
79
|
-
series = this.seriesList[item.id];
|
|
80
|
-
val = item.value;
|
|
81
|
-
sliceAngle = 2 * Math.PI * (val / dsInfo.total);
|
|
82
|
-
endAngle = startAngle + sliceAngle;
|
|
83
|
-
color = this.seriesList[item.id].color;
|
|
84
|
-
|
|
85
|
-
item.sa = startAngle;
|
|
86
|
-
item.ea = endAngle;
|
|
87
|
-
|
|
88
|
-
if (val && series.show) {
|
|
89
|
-
this.drawPieSlice(centerX, centerY, radius, startAngle, endAngle, color, ixLen === 1);
|
|
90
|
-
startAngle += sliceAngle;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.bufferCtx.beginPath();
|
|
95
|
-
this.bufferCtx.lineWidth = this.options.border;
|
|
96
|
-
this.bufferCtx.strokeStyle = '#fff';
|
|
97
|
-
this.bufferCtx.strokeOpacity = 0;
|
|
98
|
-
this.bufferCtx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
99
|
-
this.bufferCtx.stroke();
|
|
100
|
-
this.bufferCtx.closePath();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
drawPieSlice(centerX, centerY, radius, startAngle, endAngle, color, isSingle) {
|
|
105
|
-
const ctx = this.bufferCtx;
|
|
106
|
-
ctx.beginPath();
|
|
107
|
-
ctx.fillStyle = color;
|
|
108
|
-
if (!isSingle) {
|
|
109
|
-
ctx.moveTo(centerX, centerY);
|
|
110
|
-
}
|
|
111
|
-
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
|
|
112
|
-
ctx.fill();
|
|
113
|
-
ctx.closePath();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
drawDoughnutHole(dsIndex) {
|
|
117
|
-
const ctx = this.bufferCtx;
|
|
118
|
-
|
|
119
|
-
const width = this.chartRect.chartWidth - this.chartRect.padding.left;
|
|
120
|
-
const height = this.chartRect.chartHeight - this.chartRect.padding.top;
|
|
121
|
-
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
122
|
-
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
123
|
-
|
|
124
|
-
const radius = Math.min(width / 2, height / 2) * this.options.doughnutHoleSize;
|
|
125
|
-
ctx.save();
|
|
126
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
127
|
-
ctx.beginPath();
|
|
128
|
-
ctx.fillStyle = '#fff';
|
|
129
|
-
ctx.fillOpacity = 0;
|
|
130
|
-
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
131
|
-
ctx.fill();
|
|
132
|
-
ctx.strokeStyle = '#fff';
|
|
133
|
-
ctx.stroke();
|
|
134
|
-
ctx.closePath();
|
|
135
|
-
ctx.restore();
|
|
136
|
-
|
|
137
|
-
// inner stroke
|
|
138
|
-
ctx.beginPath();
|
|
139
|
-
ctx.strokeStyle = '#fff';
|
|
140
|
-
ctx.lineWidth = this.options.border;
|
|
141
|
-
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
142
|
-
ctx.stroke();
|
|
143
|
-
ctx.closePath();
|
|
144
|
-
|
|
145
|
-
this.graphData[dsIndex].ir = radius;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
seriesHighlight(seriesId) {
|
|
149
|
-
const ctx = this.overlayCtx;
|
|
150
|
-
const series = this.seriesList[seriesId];
|
|
151
|
-
const color = series.color;
|
|
152
|
-
const graphData = this.graphData;
|
|
153
|
-
|
|
154
|
-
const width = this.chartRect.chartWidth - this.chartRect.padding.left;
|
|
155
|
-
const height = this.chartRect.chartHeight - this.chartRect.padding.top;
|
|
156
|
-
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
157
|
-
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
158
|
-
|
|
159
|
-
let findIndex = false;
|
|
160
|
-
for (let ix = 0, ixLen = graphData.length; ix < ixLen; ix++) {
|
|
161
|
-
const gdata = graphData[ix];
|
|
162
|
-
|
|
163
|
-
for (let jx = 0, jxLen = gdata.data.length; jx < jxLen; jx++) {
|
|
164
|
-
if (gdata.data[jx].id === seriesId) {
|
|
165
|
-
findIndex = jx;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const info = gdata.data[findIndex];
|
|
170
|
-
const or = gdata.or;
|
|
171
|
-
const ir = gdata.ir;
|
|
172
|
-
|
|
173
|
-
const sa = info.sa;
|
|
174
|
-
const ea = info.ea;
|
|
175
|
-
|
|
176
|
-
ctx.fillStyle = color;
|
|
177
|
-
ctx.shadowOffsetX = 0;
|
|
178
|
-
ctx.shadowOffsetY = 0;
|
|
179
|
-
ctx.shadowBlur = 8;
|
|
180
|
-
ctx.shadowColor = color;
|
|
181
|
-
ctx.lineWidth = this.options.border;
|
|
182
|
-
ctx.strokeStyle = '#fff';
|
|
183
|
-
ctx.beginPath();
|
|
184
|
-
ctx.moveTo(centerX, centerY);
|
|
185
|
-
ctx.arc(centerX, centerY, or, sa, ea);
|
|
186
|
-
ctx.fill();
|
|
187
|
-
ctx.closePath();
|
|
188
|
-
ctx.save();
|
|
189
|
-
ctx.beginPath();
|
|
190
|
-
ctx.moveTo(centerX, centerY);
|
|
191
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
192
|
-
ctx.fillOpacity = 1;
|
|
193
|
-
ctx.arc(centerX, centerY, ir, sa - 1, ea + 1);
|
|
194
|
-
ctx.fill();
|
|
195
|
-
ctx.closePath();
|
|
196
|
-
ctx.restore();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const hole = Math.min(width / 2, height / 2) * this.options.doughnutHoleSize;
|
|
200
|
-
ctx.save();
|
|
201
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
202
|
-
ctx.beginPath();
|
|
203
|
-
ctx.fillStyle = '#fff';
|
|
204
|
-
ctx.fillOpacity = 0;
|
|
205
|
-
ctx.arc(centerX, centerY, hole, 0, 2 * Math.PI);
|
|
206
|
-
ctx.fill();
|
|
207
|
-
ctx.strokeStyle = '#fff';
|
|
208
|
-
ctx.stroke();
|
|
209
|
-
ctx.closePath();
|
|
210
|
-
ctx.restore();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
itemHighlight(item) {
|
|
214
|
-
if (item.dsIndex === null || item.sId === null) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
const ctx = this.overlayCtx;
|
|
218
|
-
|
|
219
|
-
const series = this.seriesList[item.sId];
|
|
220
|
-
const color = series.color;
|
|
221
|
-
const ds = this.graphData[item.dsIndex];
|
|
222
|
-
const gdata = _.find(ds.data, { id: item.sId });
|
|
223
|
-
|
|
224
|
-
const width = this.chartRect.chartWidth - this.chartRect.padding.left;
|
|
225
|
-
const height = this.chartRect.chartHeight - this.chartRect.padding.top;
|
|
226
|
-
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
227
|
-
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
228
|
-
|
|
229
|
-
const or = ds.or;
|
|
230
|
-
const ir = ds.ir;
|
|
231
|
-
|
|
232
|
-
const sa = gdata.sa;
|
|
233
|
-
const ea = gdata.ea;
|
|
234
|
-
|
|
235
|
-
ctx.fillStyle = color;
|
|
236
|
-
ctx.shadowOffsetX = 0;
|
|
237
|
-
ctx.shadowOffsetY = 0;
|
|
238
|
-
ctx.shadowBlur = 8;
|
|
239
|
-
ctx.shadowColor = color;
|
|
240
|
-
ctx.lineWidth = this.options.border;
|
|
241
|
-
ctx.strokeStyle = '#fff';
|
|
242
|
-
|
|
243
|
-
ctx.save();
|
|
244
|
-
ctx.beginPath();
|
|
245
|
-
ctx.moveTo(centerX, centerY);
|
|
246
|
-
ctx.arc(centerX, centerY, or, sa, ea);
|
|
247
|
-
ctx.fill();
|
|
248
|
-
ctx.closePath();
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
ctx.beginPath();
|
|
252
|
-
ctx.moveTo(centerX, centerY);
|
|
253
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
254
|
-
ctx.fillOpacity = 1;
|
|
255
|
-
ctx.arc(centerX, centerY, ir, sa - 1, ea + 1);
|
|
256
|
-
ctx.fill();
|
|
257
|
-
ctx.closePath();
|
|
258
|
-
ctx.restore();
|
|
259
|
-
|
|
260
|
-
const hole = Math.min(width / 2, height / 2) * this.options.doughnutHoleSize;
|
|
261
|
-
ctx.save();
|
|
262
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
263
|
-
ctx.beginPath();
|
|
264
|
-
ctx.fillStyle = '#fff';
|
|
265
|
-
ctx.fillOpacity = 0;
|
|
266
|
-
ctx.arc(centerX, centerY, hole, 0, 2 * Math.PI);
|
|
267
|
-
ctx.fill();
|
|
268
|
-
ctx.strokeStyle = '#fff';
|
|
269
|
-
ctx.stroke();
|
|
270
|
-
ctx.closePath();
|
|
271
|
-
ctx.restore();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
findHitItem(offset) {
|
|
275
|
-
const mouseX = offset[0];
|
|
276
|
-
const mouseY = offset[1];
|
|
277
|
-
|
|
278
|
-
const width = this.chartRect.chartWidth;
|
|
279
|
-
const height = this.chartRect.chartHeight;
|
|
280
|
-
const centerX = (width / 2) + this.chartRect.padding.left;
|
|
281
|
-
const centerY = (height / 2) + this.chartRect.padding.top;
|
|
282
|
-
|
|
283
|
-
const dx = mouseX - centerX;
|
|
284
|
-
const dy = mouseY - centerY;
|
|
285
|
-
|
|
286
|
-
let angle;
|
|
287
|
-
angle = ((Math.atan2(-dy, -dx) * 180) / Math.PI) - 90;
|
|
288
|
-
angle = angle < 0 ? 360 + angle : angle;
|
|
289
|
-
const rad = ((angle * Math.PI) / 180) + (1.5 * Math.PI);
|
|
290
|
-
const distance = Math.round(Math.sqrt((dx ** 2) + (dy ** 2)));
|
|
291
|
-
|
|
292
|
-
const graphData = this.graphData;
|
|
293
|
-
let gdata;
|
|
294
|
-
let dsIndex = null;
|
|
295
|
-
let sId = null;
|
|
296
|
-
|
|
297
|
-
for (let ix = 0, ixLen = graphData.length; ix < ixLen; ix++) {
|
|
298
|
-
gdata = graphData[ix];
|
|
299
|
-
if (distance > gdata.ir && distance < gdata.or) {
|
|
300
|
-
dsIndex = ix;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (graphData[dsIndex]) {
|
|
305
|
-
for (let ix = 0, ixLen = graphData[dsIndex].data.length; ix < ixLen; ix++) {
|
|
306
|
-
gdata = graphData[dsIndex].data[ix];
|
|
307
|
-
|
|
308
|
-
if (rad > gdata.sa && rad < gdata.ea) {
|
|
309
|
-
sId = gdata.id;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return { dsIndex, sId };
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
showTooltip(offset, e, item) {
|
|
318
|
-
const index = item.dsIndex;
|
|
319
|
-
if (index === null) {
|
|
320
|
-
this.tooltipDOM.style.display = 'none';
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const graphData = this.graphData[item.dsIndex].data;
|
|
325
|
-
const offsetX = offset[0];
|
|
326
|
-
const offsetY = offset[1];
|
|
327
|
-
|
|
328
|
-
const mouseX = e.pageX;
|
|
329
|
-
const mouseY = e.pageY;
|
|
330
|
-
const clientX = e.clientX;
|
|
331
|
-
const clientY = e.clientY;
|
|
332
|
-
const bodyWidth = document.body.clientWidth;
|
|
333
|
-
const bodyHeight = document.body.clientHeight;
|
|
334
|
-
|
|
335
|
-
const graphPos = {
|
|
336
|
-
x1: this.chartRect.x1 + this.labelOffset.left,
|
|
337
|
-
x2: this.chartRect.x2 - this.labelOffset.right,
|
|
338
|
-
y1: this.chartRect.y1 + this.labelOffset.top,
|
|
339
|
-
y2: this.chartRect.y2 - this.labelOffset.bottom,
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
if ((offsetX >= (graphPos.x1 - 1) && offsetX <= (graphPos.x2))
|
|
343
|
-
&& (offsetY >= (graphPos.y1 - 1) && offsetY <= (graphPos.y2 + 1))) {
|
|
344
|
-
this.tooltipTitleDOM.style.display = 'none';
|
|
345
|
-
|
|
346
|
-
const listDOM = this.ulDOM.children;
|
|
347
|
-
let sId;
|
|
348
|
-
let series;
|
|
349
|
-
let valueDOM;
|
|
350
|
-
let gdata;
|
|
351
|
-
|
|
352
|
-
for (let ix = 0, ixLen = listDOM.length; ix < ixLen; ix++) {
|
|
353
|
-
sId = listDOM[ix].dataset.seriesId;
|
|
354
|
-
series = this.seriesList[sId];
|
|
355
|
-
|
|
356
|
-
if (series && series.show) {
|
|
357
|
-
gdata = _.find(graphData, { id: sId }).value;
|
|
358
|
-
listDOM[ix].style.display = 'block';
|
|
359
|
-
valueDOM = listDOM[ix].children[3];
|
|
360
|
-
valueDOM.textContent = gdata;
|
|
361
|
-
} else {
|
|
362
|
-
listDOM[ix].style.display = 'none';
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
this.tooltipDOM.style.display = 'block';
|
|
367
|
-
|
|
368
|
-
if (offsetX > ((graphPos.x2 * 4) / 5) || clientX > ((bodyWidth * 4) / 5)) {
|
|
369
|
-
this.tooltipDOM.style.left = `${mouseX - (this.tooltipDOM.clientWidth + 10)}px`;
|
|
370
|
-
} else {
|
|
371
|
-
this.tooltipDOM.style.left = `${mouseX + 15}px`;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (offsetY > ((graphPos.y2 * 3) / 4) || clientY > ((bodyHeight * 3) / 4)) {
|
|
375
|
-
this.tooltipDOM.style.top = `${mouseY - (this.tooltipDOM.clientHeight + 5)}px`;
|
|
376
|
-
} else {
|
|
377
|
-
this.tooltipDOM.style.top = `${mouseY + 10}px`;
|
|
378
|
-
}
|
|
379
|
-
} else {
|
|
380
|
-
this.tooltipDOM.style.display = 'none';
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|