evui 3.3.36 → 3.3.39
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/LICENSE +21 -21
- package/README.md +40 -40
- package/dist/evui.common.js +1907 -1832
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1907 -1832
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/dist/img/{EVUI.7f3588fb.svg → EVUI.b82ee81a.svg} +292 -292
- package/dist/img/{icon_mysql.7ea26d5d.svg → icon_mysql.1085fdc9.svg} +78 -78
- package/dist/img/{icon_oracle.9009b108.svg → icon_oracle.0572d3ee.svg} +13 -13
- package/dist/img/{icon_postgresql.f8fffba9.svg → icon_postgresql.ee12bde8.svg} +58 -58
- package/package.json +61 -61
- package/src/common/emitter.js +20 -20
- package/src/common/utils.debounce.js +223 -223
- package/src/common/utils.js +134 -134
- package/src/common/utils.table.js +78 -78
- package/src/common/utils.throttle.js +83 -83
- package/src/common/utils.tree.js +18 -18
- package/src/components/button/Button.vue +198 -198
- package/src/components/button/index.js +7 -7
- package/src/components/buttonGroup/ButtonGroup.vue +11 -11
- package/src/components/buttonGroup/index.js +7 -7
- package/src/components/calendar/Calendar.vue +661 -661
- package/src/components/calendar/index.js +7 -7
- package/src/components/calendar/uses.js +1272 -1272
- package/src/components/chart/Chart.vue +189 -192
- package/src/components/chart/chart.core.js +870 -870
- package/src/components/chart/element/element.bar.js +524 -524
- package/src/components/chart/element/element.bar.time.js +156 -156
- package/src/components/chart/element/element.heatmap.js +533 -533
- package/src/components/chart/element/element.line.js +339 -339
- package/src/components/chart/element/element.pie.js +197 -197
- package/src/components/chart/element/element.scatter.js +184 -184
- package/src/components/chart/element/element.tip.js +550 -542
- package/src/components/chart/helpers/helpers.canvas.js +265 -265
- package/src/components/chart/helpers/helpers.constant.js +206 -206
- package/src/components/chart/helpers/helpers.util.js +346 -338
- package/src/components/chart/index.js +9 -9
- package/src/components/chart/model/index.js +4 -4
- package/src/components/chart/model/model.series.js +93 -93
- package/src/components/chart/model/model.store.js +977 -967
- package/src/components/chart/plugins/plugins.interaction.js +769 -769
- package/src/components/chart/plugins/plugins.legend.gradient.js +602 -602
- package/src/components/chart/plugins/plugins.legend.js +1155 -1151
- package/src/components/chart/plugins/plugins.pie.js +254 -254
- package/src/components/chart/plugins/plugins.title.js +56 -56
- package/src/components/chart/plugins/plugins.tooltip.js +692 -692
- package/src/components/chart/scale/scale.js +848 -848
- package/src/components/chart/scale/scale.linear.js +38 -38
- package/src/components/chart/scale/scale.logarithmic.js +128 -128
- package/src/components/chart/scale/scale.step.js +336 -336
- package/src/components/chart/scale/scale.time.category.js +277 -277
- package/src/components/chart/scale/scale.time.js +48 -48
- package/src/components/chart/style/chart.scss +312 -312
- package/src/components/chart/uses.js +264 -252
- package/src/components/checkbox/Checkbox.vue +200 -200
- package/src/components/checkbox/index.js +7 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +44 -44
- package/src/components/checkboxGroup/index.js +7 -7
- package/src/components/contextMenu/ContextMenu.vue +80 -80
- package/src/components/contextMenu/MenuList.vue +149 -149
- package/src/components/contextMenu/index.js +7 -7
- package/src/components/contextMenu/uses.js +203 -203
- package/src/components/datePicker/DatePicker.vue +437 -437
- package/src/components/datePicker/index.js +7 -7
- package/src/components/datePicker/uses.js +419 -419
- package/src/components/grid/Grid.vue +827 -827
- package/src/components/grid/grid.filter.window.vue +493 -493
- package/src/components/grid/grid.pagination.vue +75 -75
- package/src/components/grid/grid.summary.vue +265 -265
- package/src/components/grid/grid.toolbar.vue +26 -26
- package/src/components/grid/index.js +11 -11
- package/src/components/grid/style/grid.scss +263 -263
- package/src/components/grid/uses.js +1002 -1007
- package/src/components/icon/Icon.vue +49 -49
- package/src/components/icon/index.js +8 -8
- package/src/components/inputNumber/InputNumber.vue +212 -212
- package/src/components/inputNumber/index.js +7 -7
- package/src/components/inputNumber/uses.js +217 -217
- package/src/components/loading/Loading.vue +125 -125
- package/src/components/loading/index.js +7 -7
- package/src/components/menu/Menu.vue +68 -68
- package/src/components/menu/MenuItem.vue +187 -187
- package/src/components/menu/index.js +7 -7
- package/src/components/message/Message.vue +223 -223
- package/src/components/message/index.js +31 -31
- package/src/components/messageBox/MessageBox.vue +358 -358
- package/src/components/messageBox/index.js +22 -22
- package/src/components/notification/Notification.vue +316 -316
- package/src/components/notification/index.js +49 -49
- package/src/components/pagination/Pagination.vue +271 -271
- package/src/components/pagination/index.js +7 -7
- package/src/components/pagination/pageButton.vue +30 -30
- package/src/components/progress/Progress.vue +139 -139
- package/src/components/progress/index.js +7 -7
- package/src/components/radio/Radio.vue +159 -159
- package/src/components/radio/index.js +7 -7
- package/src/components/radioGroup/RadioGroup.vue +41 -41
- package/src/components/radioGroup/index.js +7 -7
- package/src/components/scheduler/Scheduler.vue +149 -149
- package/src/components/scheduler/index.js +7 -7
- package/src/components/scheduler/uses.js +183 -183
- package/src/components/select/Select.vue +440 -440
- package/src/components/select/index.js +7 -7
- package/src/components/select/uses.js +270 -270
- package/src/components/slider/Slider.vue +505 -505
- package/src/components/slider/index.js +7 -7
- package/src/components/slider/uses.js +390 -390
- package/src/components/tabPanel/TabPanel.vue +74 -74
- package/src/components/tabPanel/index.js +7 -7
- package/src/components/tabs/Tabs.vue +517 -517
- package/src/components/tabs/index.js +7 -7
- package/src/components/textField/TextField.vue +375 -375
- package/src/components/textField/index.js +7 -7
- package/src/components/timePicker/TimePicker.vue +352 -352
- package/src/components/timePicker/index.js +7 -7
- package/src/components/toggle/Toggle.vue +115 -115
- package/src/components/toggle/index.js +7 -7
- package/src/components/tree/Tree.vue +313 -313
- package/src/components/tree/TreeNode.vue +293 -293
- package/src/components/tree/index.js +7 -7
- package/src/components/treeGrid/TreeGrid.vue +758 -758
- package/src/components/treeGrid/TreeGridNode.vue +275 -275
- package/src/components/treeGrid/index.js +9 -9
- package/src/components/treeGrid/style/treeGrid.scss +261 -261
- package/src/components/treeGrid/treeGrid.toolbar.vue +26 -26
- package/src/components/treeGrid/uses.js +867 -867
- package/src/components/window/Window.vue +329 -329
- package/src/components/window/index.js +7 -7
- package/src/components/window/uses.js +899 -899
- package/src/directives/clickoutside.js +90 -90
- package/src/main.js +116 -116
- package/src/style/components/input.scss +108 -108
- package/src/style/functions.scss +3 -3
- package/src/style/index.scss +6 -6
- package/src/style/lib/fonts/EVUI.svg +292 -292
- package/src/style/lib/icon.css +888 -888
- package/src/style/mixins.scss +94 -94
- package/src/style/themes.scss +67 -67
- package/src/style/variables.scss +22 -22
|
@@ -1,254 +1,254 @@
|
|
|
1
|
-
const modules = {
|
|
2
|
-
pieDataSet: [],
|
|
3
|
-
/**
|
|
4
|
-
* Draw series data
|
|
5
|
-
*
|
|
6
|
-
* @params hitInfo
|
|
7
|
-
*
|
|
8
|
-
* @returns {undefined}
|
|
9
|
-
*/
|
|
10
|
-
drawPie(hitInfo) {
|
|
11
|
-
const ctx = this.bufferCtx;
|
|
12
|
-
const chartRect = this.chartRect;
|
|
13
|
-
const pieDataSet = this.pieDataSet;
|
|
14
|
-
const pieOption = this.options;
|
|
15
|
-
const padding = this.options.padding;
|
|
16
|
-
const isDoughnut = !!pieOption.doughnutHoleSize;
|
|
17
|
-
|
|
18
|
-
let slice;
|
|
19
|
-
let value;
|
|
20
|
-
let sliceAngle;
|
|
21
|
-
let startAngle = 1.5 * Math.PI;
|
|
22
|
-
let endAngle;
|
|
23
|
-
let series;
|
|
24
|
-
let percentage;
|
|
25
|
-
|
|
26
|
-
const centerX = chartRect.width / 2;
|
|
27
|
-
const centerY = chartRect.height / 2;
|
|
28
|
-
|
|
29
|
-
const chartWidth = centerX - (padding.left + padding.right);
|
|
30
|
-
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
31
|
-
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
32
|
-
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const innerRadius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
37
|
-
const outerRadius = Math.min(chartWidth, chartHeight);
|
|
38
|
-
|
|
39
|
-
for (let ix = 0; ix < pieDataSet.length; ix++) {
|
|
40
|
-
const pie = pieDataSet[ix];
|
|
41
|
-
if (!pie) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let radius = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * ix);
|
|
46
|
-
if (pieOption?.pieStroke?.use) {
|
|
47
|
-
radius -= pieOption.pieStroke.lineWidth;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (radius < 0) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
pie.or = radius;
|
|
55
|
-
if (ix < pieDataSet.length - 1) {
|
|
56
|
-
pie.ir = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * (ix + 1));
|
|
57
|
-
} else {
|
|
58
|
-
pie.ir = 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (pie.total) {
|
|
62
|
-
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
63
|
-
slice = pie.data[jx];
|
|
64
|
-
value = slice.value;
|
|
65
|
-
percentage = (value / pie.total) * 100;
|
|
66
|
-
sliceAngle = 2 * Math.PI * (value / pie.total);
|
|
67
|
-
endAngle = startAngle + sliceAngle;
|
|
68
|
-
|
|
69
|
-
slice.sa = startAngle;
|
|
70
|
-
slice.ea = endAngle;
|
|
71
|
-
series = this.seriesList[slice.id];
|
|
72
|
-
|
|
73
|
-
if (value) {
|
|
74
|
-
const strokeOptions = { ...pieOption.pieStroke };
|
|
75
|
-
if (pie.data.length === 1 && pieOption.pieStroke.use) {
|
|
76
|
-
strokeOptions.use = false;
|
|
77
|
-
|
|
78
|
-
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
79
|
-
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
80
|
-
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
81
|
-
ctx.stroke();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const { selectInfo, legendHitInfo } = hitInfo;
|
|
85
|
-
series.isSelect = selectInfo?.sId === slice.id;
|
|
86
|
-
series.isDownplay = (legendHitInfo && legendHitInfo.sId !== slice.id);
|
|
87
|
-
series.type = isDoughnut ? 'doughnut' : 'pie';
|
|
88
|
-
series.centerX = centerX;
|
|
89
|
-
series.centerY = centerY;
|
|
90
|
-
series.radius = radius;
|
|
91
|
-
series.doughnutHoleSize = radius * (pieOption.doughnutHoleSize ?? 0);
|
|
92
|
-
series.startAngle = startAngle;
|
|
93
|
-
series.endAngle = endAngle;
|
|
94
|
-
series.data = { o: value, percentage };
|
|
95
|
-
|
|
96
|
-
series.draw(ctx, strokeOptions);
|
|
97
|
-
startAngle += sliceAngle;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Draw series data
|
|
106
|
-
*
|
|
107
|
-
* @params hitInfo
|
|
108
|
-
*
|
|
109
|
-
* @returns {undefined}
|
|
110
|
-
*/
|
|
111
|
-
drawSunburst(hitInfo) {
|
|
112
|
-
const ctx = this.bufferCtx;
|
|
113
|
-
const { width, height } = this.chartRect;
|
|
114
|
-
const pieDataSet = this.pieDataSet;
|
|
115
|
-
const pieOption = this.options;
|
|
116
|
-
const padding = this.options.padding;
|
|
117
|
-
|
|
118
|
-
this.calculateAngle();
|
|
119
|
-
|
|
120
|
-
let slice;
|
|
121
|
-
let series;
|
|
122
|
-
|
|
123
|
-
const centerX = width / 2;
|
|
124
|
-
const centerY = height / 2;
|
|
125
|
-
|
|
126
|
-
const chartWidth = centerX - (padding.left + padding.right);
|
|
127
|
-
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
128
|
-
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
129
|
-
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const innerRadius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
134
|
-
const outerRadius = Math.min(chartWidth, chartHeight);
|
|
135
|
-
|
|
136
|
-
for (let ix = 0; ix < pieDataSet.length; ix++) {
|
|
137
|
-
const pie = pieDataSet[ix];
|
|
138
|
-
if (!pie) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let radius = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * ix);
|
|
143
|
-
if (pieOption?.pieStroke?.use) {
|
|
144
|
-
radius -= pieOption.pieStroke.lineWidth;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (radius < 0) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
pie.or = radius;
|
|
152
|
-
if (ix < pieDataSet.length - 1) {
|
|
153
|
-
pie.ir = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * (ix + 1));
|
|
154
|
-
} else {
|
|
155
|
-
pie.ir = 1;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
159
|
-
slice = pie.data[jx];
|
|
160
|
-
|
|
161
|
-
if (slice.id === 'dummy') {
|
|
162
|
-
ctx.save();
|
|
163
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
164
|
-
ctx.beginPath();
|
|
165
|
-
ctx.fillStyle = '#fff';
|
|
166
|
-
ctx.lineWidth = 2;
|
|
167
|
-
ctx.strokeStyle = '#fff';
|
|
168
|
-
ctx.moveTo(centerX, centerY);
|
|
169
|
-
ctx.arc(centerX, centerY, radius, slice.sa, slice.ea);
|
|
170
|
-
ctx.stroke();
|
|
171
|
-
ctx.fill();
|
|
172
|
-
ctx.closePath();
|
|
173
|
-
ctx.restore();
|
|
174
|
-
} else {
|
|
175
|
-
series = this.seriesList[slice.id];
|
|
176
|
-
|
|
177
|
-
if (slice.value) {
|
|
178
|
-
const strokeOptions = { ...pieOption.pieStroke };
|
|
179
|
-
if (pie.data.length === 1 && pieOption.pieStroke.use) {
|
|
180
|
-
strokeOptions.use = false;
|
|
181
|
-
|
|
182
|
-
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
183
|
-
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
184
|
-
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
185
|
-
ctx.stroke();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const { selectInfo, legendHitInfo } = hitInfo;
|
|
189
|
-
series.isSelect = selectInfo?.sId === slice.id;
|
|
190
|
-
series.isDownplay = (legendHitInfo && legendHitInfo.sId !== slice.id);
|
|
191
|
-
series.type = 'sunburst';
|
|
192
|
-
series.centerX = centerX;
|
|
193
|
-
series.centerY = centerY;
|
|
194
|
-
series.radius = radius;
|
|
195
|
-
series.doughnutHoleSize = radius * (pieOption.doughnutHoleSize ?? 0);
|
|
196
|
-
series.startAngle = slice.sa;
|
|
197
|
-
series.endAngle = slice.ea;
|
|
198
|
-
series.data = { o: slice.value };
|
|
199
|
-
|
|
200
|
-
series.draw(ctx, strokeOptions);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Draw doughnut hole
|
|
209
|
-
* @param ctx
|
|
210
|
-
*/
|
|
211
|
-
drawDoughnutHole(ctx = this.bufferCtx) {
|
|
212
|
-
const pieOption = this.options;
|
|
213
|
-
const { width, height } = this.chartRect;
|
|
214
|
-
const padding = this.options.padding;
|
|
215
|
-
|
|
216
|
-
const centerX = width / 2;
|
|
217
|
-
const centerY = height / 2;
|
|
218
|
-
|
|
219
|
-
const chartWidth = centerX - (padding.left + padding.right);
|
|
220
|
-
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
221
|
-
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
222
|
-
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const radius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
227
|
-
|
|
228
|
-
ctx.save();
|
|
229
|
-
ctx.globalCompositeOperation = 'destination-out';
|
|
230
|
-
ctx.beginPath();
|
|
231
|
-
ctx.fillStyle = '#fff';
|
|
232
|
-
ctx.fillOpacity = 0;
|
|
233
|
-
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
234
|
-
ctx.fill();
|
|
235
|
-
ctx.strokeStyle = '#fff';
|
|
236
|
-
ctx.stroke();
|
|
237
|
-
ctx.closePath();
|
|
238
|
-
ctx.restore();
|
|
239
|
-
|
|
240
|
-
// inner stroke
|
|
241
|
-
if (pieOption?.pieStroke?.use) {
|
|
242
|
-
ctx.beginPath();
|
|
243
|
-
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
244
|
-
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
245
|
-
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
246
|
-
ctx.stroke();
|
|
247
|
-
ctx.closePath();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
this.pieDataSet[this.pieDataSet.length - 1].ir = radius;
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
export default modules;
|
|
1
|
+
const modules = {
|
|
2
|
+
pieDataSet: [],
|
|
3
|
+
/**
|
|
4
|
+
* Draw series data
|
|
5
|
+
*
|
|
6
|
+
* @params hitInfo
|
|
7
|
+
*
|
|
8
|
+
* @returns {undefined}
|
|
9
|
+
*/
|
|
10
|
+
drawPie(hitInfo) {
|
|
11
|
+
const ctx = this.bufferCtx;
|
|
12
|
+
const chartRect = this.chartRect;
|
|
13
|
+
const pieDataSet = this.pieDataSet;
|
|
14
|
+
const pieOption = this.options;
|
|
15
|
+
const padding = this.options.padding;
|
|
16
|
+
const isDoughnut = !!pieOption.doughnutHoleSize;
|
|
17
|
+
|
|
18
|
+
let slice;
|
|
19
|
+
let value;
|
|
20
|
+
let sliceAngle;
|
|
21
|
+
let startAngle = 1.5 * Math.PI;
|
|
22
|
+
let endAngle;
|
|
23
|
+
let series;
|
|
24
|
+
let percentage;
|
|
25
|
+
|
|
26
|
+
const centerX = chartRect.width / 2;
|
|
27
|
+
const centerY = chartRect.height / 2;
|
|
28
|
+
|
|
29
|
+
const chartWidth = centerX - (padding.left + padding.right);
|
|
30
|
+
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
31
|
+
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
32
|
+
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const innerRadius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
37
|
+
const outerRadius = Math.min(chartWidth, chartHeight);
|
|
38
|
+
|
|
39
|
+
for (let ix = 0; ix < pieDataSet.length; ix++) {
|
|
40
|
+
const pie = pieDataSet[ix];
|
|
41
|
+
if (!pie) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let radius = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * ix);
|
|
46
|
+
if (pieOption?.pieStroke?.use) {
|
|
47
|
+
radius -= pieOption.pieStroke.lineWidth;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (radius < 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pie.or = radius;
|
|
55
|
+
if (ix < pieDataSet.length - 1) {
|
|
56
|
+
pie.ir = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * (ix + 1));
|
|
57
|
+
} else {
|
|
58
|
+
pie.ir = 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (pie.total) {
|
|
62
|
+
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
63
|
+
slice = pie.data[jx];
|
|
64
|
+
value = slice.value;
|
|
65
|
+
percentage = (value / pie.total) * 100;
|
|
66
|
+
sliceAngle = 2 * Math.PI * (value / pie.total);
|
|
67
|
+
endAngle = startAngle + sliceAngle;
|
|
68
|
+
|
|
69
|
+
slice.sa = startAngle;
|
|
70
|
+
slice.ea = endAngle;
|
|
71
|
+
series = this.seriesList[slice.id];
|
|
72
|
+
|
|
73
|
+
if (value) {
|
|
74
|
+
const strokeOptions = { ...pieOption.pieStroke };
|
|
75
|
+
if (pie.data.length === 1 && pieOption.pieStroke.use) {
|
|
76
|
+
strokeOptions.use = false;
|
|
77
|
+
|
|
78
|
+
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
79
|
+
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
80
|
+
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
81
|
+
ctx.stroke();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const { selectInfo, legendHitInfo } = hitInfo;
|
|
85
|
+
series.isSelect = selectInfo?.sId === slice.id;
|
|
86
|
+
series.isDownplay = (legendHitInfo && legendHitInfo.sId !== slice.id);
|
|
87
|
+
series.type = isDoughnut ? 'doughnut' : 'pie';
|
|
88
|
+
series.centerX = centerX;
|
|
89
|
+
series.centerY = centerY;
|
|
90
|
+
series.radius = radius;
|
|
91
|
+
series.doughnutHoleSize = radius * (pieOption.doughnutHoleSize ?? 0);
|
|
92
|
+
series.startAngle = startAngle;
|
|
93
|
+
series.endAngle = endAngle;
|
|
94
|
+
series.data = { o: value, percentage };
|
|
95
|
+
|
|
96
|
+
series.draw(ctx, strokeOptions);
|
|
97
|
+
startAngle += sliceAngle;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Draw series data
|
|
106
|
+
*
|
|
107
|
+
* @params hitInfo
|
|
108
|
+
*
|
|
109
|
+
* @returns {undefined}
|
|
110
|
+
*/
|
|
111
|
+
drawSunburst(hitInfo) {
|
|
112
|
+
const ctx = this.bufferCtx;
|
|
113
|
+
const { width, height } = this.chartRect;
|
|
114
|
+
const pieDataSet = this.pieDataSet;
|
|
115
|
+
const pieOption = this.options;
|
|
116
|
+
const padding = this.options.padding;
|
|
117
|
+
|
|
118
|
+
this.calculateAngle();
|
|
119
|
+
|
|
120
|
+
let slice;
|
|
121
|
+
let series;
|
|
122
|
+
|
|
123
|
+
const centerX = width / 2;
|
|
124
|
+
const centerY = height / 2;
|
|
125
|
+
|
|
126
|
+
const chartWidth = centerX - (padding.left + padding.right);
|
|
127
|
+
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
128
|
+
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
129
|
+
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const innerRadius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
134
|
+
const outerRadius = Math.min(chartWidth, chartHeight);
|
|
135
|
+
|
|
136
|
+
for (let ix = 0; ix < pieDataSet.length; ix++) {
|
|
137
|
+
const pie = pieDataSet[ix];
|
|
138
|
+
if (!pie) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let radius = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * ix);
|
|
143
|
+
if (pieOption?.pieStroke?.use) {
|
|
144
|
+
radius -= pieOption.pieStroke.lineWidth;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (radius < 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
pie.or = radius;
|
|
152
|
+
if (ix < pieDataSet.length - 1) {
|
|
153
|
+
pie.ir = outerRadius - (((outerRadius - innerRadius) / pieDataSet.length) * (ix + 1));
|
|
154
|
+
} else {
|
|
155
|
+
pie.ir = 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
for (let jx = 0; jx < pie.data.length; jx++) {
|
|
159
|
+
slice = pie.data[jx];
|
|
160
|
+
|
|
161
|
+
if (slice.id === 'dummy') {
|
|
162
|
+
ctx.save();
|
|
163
|
+
ctx.globalCompositeOperation = 'destination-out';
|
|
164
|
+
ctx.beginPath();
|
|
165
|
+
ctx.fillStyle = '#fff';
|
|
166
|
+
ctx.lineWidth = 2;
|
|
167
|
+
ctx.strokeStyle = '#fff';
|
|
168
|
+
ctx.moveTo(centerX, centerY);
|
|
169
|
+
ctx.arc(centerX, centerY, radius, slice.sa, slice.ea);
|
|
170
|
+
ctx.stroke();
|
|
171
|
+
ctx.fill();
|
|
172
|
+
ctx.closePath();
|
|
173
|
+
ctx.restore();
|
|
174
|
+
} else {
|
|
175
|
+
series = this.seriesList[slice.id];
|
|
176
|
+
|
|
177
|
+
if (slice.value) {
|
|
178
|
+
const strokeOptions = { ...pieOption.pieStroke };
|
|
179
|
+
if (pie.data.length === 1 && pieOption.pieStroke.use) {
|
|
180
|
+
strokeOptions.use = false;
|
|
181
|
+
|
|
182
|
+
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
183
|
+
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
184
|
+
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
185
|
+
ctx.stroke();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const { selectInfo, legendHitInfo } = hitInfo;
|
|
189
|
+
series.isSelect = selectInfo?.sId === slice.id;
|
|
190
|
+
series.isDownplay = (legendHitInfo && legendHitInfo.sId !== slice.id);
|
|
191
|
+
series.type = 'sunburst';
|
|
192
|
+
series.centerX = centerX;
|
|
193
|
+
series.centerY = centerY;
|
|
194
|
+
series.radius = radius;
|
|
195
|
+
series.doughnutHoleSize = radius * (pieOption.doughnutHoleSize ?? 0);
|
|
196
|
+
series.startAngle = slice.sa;
|
|
197
|
+
series.endAngle = slice.ea;
|
|
198
|
+
series.data = { o: slice.value };
|
|
199
|
+
|
|
200
|
+
series.draw(ctx, strokeOptions);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Draw doughnut hole
|
|
209
|
+
* @param ctx
|
|
210
|
+
*/
|
|
211
|
+
drawDoughnutHole(ctx = this.bufferCtx) {
|
|
212
|
+
const pieOption = this.options;
|
|
213
|
+
const { width, height } = this.chartRect;
|
|
214
|
+
const padding = this.options.padding;
|
|
215
|
+
|
|
216
|
+
const centerX = width / 2;
|
|
217
|
+
const centerY = height / 2;
|
|
218
|
+
|
|
219
|
+
const chartWidth = centerX - (padding.left + padding.right);
|
|
220
|
+
const chartHeight = centerY - (padding.bottom + padding.top);
|
|
221
|
+
if ((typeof chartWidth === 'number' && chartWidth < 0)
|
|
222
|
+
|| (typeof chartHeight === 'number' && chartHeight < 0)) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const radius = Math.min(chartWidth, chartHeight) * pieOption.doughnutHoleSize;
|
|
227
|
+
|
|
228
|
+
ctx.save();
|
|
229
|
+
ctx.globalCompositeOperation = 'destination-out';
|
|
230
|
+
ctx.beginPath();
|
|
231
|
+
ctx.fillStyle = '#fff';
|
|
232
|
+
ctx.fillOpacity = 0;
|
|
233
|
+
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
234
|
+
ctx.fill();
|
|
235
|
+
ctx.strokeStyle = '#fff';
|
|
236
|
+
ctx.stroke();
|
|
237
|
+
ctx.closePath();
|
|
238
|
+
ctx.restore();
|
|
239
|
+
|
|
240
|
+
// inner stroke
|
|
241
|
+
if (pieOption?.pieStroke?.use) {
|
|
242
|
+
ctx.beginPath();
|
|
243
|
+
ctx.strokeStyle = pieOption.pieStroke.color;
|
|
244
|
+
ctx.lineWidth = pieOption.pieStroke.lineWidth;
|
|
245
|
+
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2);
|
|
246
|
+
ctx.stroke();
|
|
247
|
+
ctx.closePath();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
this.pieDataSet[this.pieDataSet.length - 1].ir = radius;
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export default modules;
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
const modules = {
|
|
2
|
-
/**
|
|
3
|
-
* Create title DOM
|
|
4
|
-
*
|
|
5
|
-
* @returns {undefined}
|
|
6
|
-
*/
|
|
7
|
-
createTitle() {
|
|
8
|
-
this.titleDOM = document.createElement('div');
|
|
9
|
-
this.titleDOM.className = 'ev-chart-title';
|
|
10
|
-
this.wrapperDOM.appendChild(this.titleDOM);
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Initialize title DOM
|
|
15
|
-
*
|
|
16
|
-
* @returns {undefined}
|
|
17
|
-
*/
|
|
18
|
-
initTitle() {
|
|
19
|
-
if (!this.isInitTitle) {
|
|
20
|
-
this.createTitle();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const opt = this.options.title;
|
|
24
|
-
Object.keys(opt.style).forEach((key) => {
|
|
25
|
-
this.titleDOM.style[key] = opt.style[key];
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
this.titleDOM.textContent = opt.text;
|
|
29
|
-
this.titleDOM.style.height = `${opt.height}px`;
|
|
30
|
-
this.titleDOM.style.lineHeight = `${opt.height}px`;
|
|
31
|
-
|
|
32
|
-
this.isInitTitle = true;
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* show title DOM with manipulating css
|
|
37
|
-
*
|
|
38
|
-
* @returns {undefined}
|
|
39
|
-
*/
|
|
40
|
-
showTitle() {
|
|
41
|
-
this.titleDOM.style.display = 'block';
|
|
42
|
-
this.wrapperDOM.style.paddingTop = `${this.options.title.height}px`;
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* hide title DOM with manipulating css
|
|
47
|
-
*
|
|
48
|
-
* @returns {undefined}
|
|
49
|
-
*/
|
|
50
|
-
hideTitle() {
|
|
51
|
-
this.titleDOM.style.display = 'none';
|
|
52
|
-
this.wrapperDOM.style.paddingTop = '0px';
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default modules;
|
|
1
|
+
const modules = {
|
|
2
|
+
/**
|
|
3
|
+
* Create title DOM
|
|
4
|
+
*
|
|
5
|
+
* @returns {undefined}
|
|
6
|
+
*/
|
|
7
|
+
createTitle() {
|
|
8
|
+
this.titleDOM = document.createElement('div');
|
|
9
|
+
this.titleDOM.className = 'ev-chart-title';
|
|
10
|
+
this.wrapperDOM.appendChild(this.titleDOM);
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initialize title DOM
|
|
15
|
+
*
|
|
16
|
+
* @returns {undefined}
|
|
17
|
+
*/
|
|
18
|
+
initTitle() {
|
|
19
|
+
if (!this.isInitTitle) {
|
|
20
|
+
this.createTitle();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const opt = this.options.title;
|
|
24
|
+
Object.keys(opt.style).forEach((key) => {
|
|
25
|
+
this.titleDOM.style[key] = opt.style[key];
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
this.titleDOM.textContent = opt.text;
|
|
29
|
+
this.titleDOM.style.height = `${opt.height}px`;
|
|
30
|
+
this.titleDOM.style.lineHeight = `${opt.height}px`;
|
|
31
|
+
|
|
32
|
+
this.isInitTitle = true;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* show title DOM with manipulating css
|
|
37
|
+
*
|
|
38
|
+
* @returns {undefined}
|
|
39
|
+
*/
|
|
40
|
+
showTitle() {
|
|
41
|
+
this.titleDOM.style.display = 'block';
|
|
42
|
+
this.wrapperDOM.style.paddingTop = `${this.options.title.height}px`;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* hide title DOM with manipulating css
|
|
47
|
+
*
|
|
48
|
+
* @returns {undefined}
|
|
49
|
+
*/
|
|
50
|
+
hideTitle() {
|
|
51
|
+
this.titleDOM.style.display = 'none';
|
|
52
|
+
this.wrapperDOM.style.paddingTop = '0px';
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default modules;
|