evui 3.4.207 → 3.4.208
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/README.md +18 -33
- package/dist/404.html +44 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.js +22645 -0
- package/dist/index.umd.cjs +28 -0
- package/dist/style.css +1 -0
- package/package.json +46 -43
- package/dist/evui.common.js +0 -63681
- package/dist/evui.common.js.map +0 -1
- package/dist/evui.umd.js +0 -63691
- package/dist/evui.umd.js.map +0 -1
- package/dist/evui.umd.min.js +0 -2
- package/dist/evui.umd.min.js.map +0 -1
- package/dist/img/EVUI.b82ee81a.svg +0 -293
- package/src/assets/logo.png +0 -0
- package/src/common/emitter.js +0 -20
- package/src/common/utils.bignumber.js +0 -67
- package/src/common/utils.debounce.js +0 -223
- package/src/common/utils.js +0 -151
- package/src/common/utils.table.js +0 -78
- package/src/common/utils.throttle.js +0 -83
- package/src/common/utils.tree.js +0 -18
- package/src/components/button/Button.vue +0 -195
- package/src/components/button/index.js +0 -7
- package/src/components/buttonGroup/ButtonGroup.vue +0 -11
- package/src/components/buttonGroup/index.js +0 -7
- package/src/components/calendar/Calendar.vue +0 -725
- package/src/components/calendar/index.js +0 -7
- package/src/components/calendar/uses.js +0 -1410
- package/src/components/chart/Chart.vue +0 -363
- package/src/components/chart/ChartToolbar.vue +0 -52
- package/src/components/chart/chart.core.js +0 -1170
- package/src/components/chart/chartZoom.core.js +0 -540
- package/src/components/chart/element/element.bar.js +0 -672
- package/src/components/chart/element/element.bar.time.js +0 -166
- package/src/components/chart/element/element.heatmap.js +0 -743
- package/src/components/chart/element/element.line.js +0 -611
- package/src/components/chart/element/element.pie.js +0 -197
- package/src/components/chart/element/element.scatter.js +0 -320
- package/src/components/chart/element/element.tip.js +0 -717
- package/src/components/chart/helpers/helpers.canvas.js +0 -265
- package/src/components/chart/helpers/helpers.constant.js +0 -235
- package/src/components/chart/helpers/helpers.util.js +0 -400
- package/src/components/chart/index.js +0 -9
- package/src/components/chart/model/index.js +0 -50
- package/src/components/chart/model/model.series.js +0 -125
- package/src/components/chart/model/model.store.js +0 -1427
- package/src/components/chart/plugins/plugins.interaction.js +0 -1659
- package/src/components/chart/plugins/plugins.legend.gradient.js +0 -606
- package/src/components/chart/plugins/plugins.legend.js +0 -1543
- package/src/components/chart/plugins/plugins.pie.js +0 -254
- package/src/components/chart/plugins/plugins.scrollbar.js +0 -732
- package/src/components/chart/plugins/plugins.title.js +0 -61
- package/src/components/chart/plugins/plugins.tooltip.js +0 -1041
- package/src/components/chart/scale/scale.js +0 -951
- package/src/components/chart/scale/scale.linear.js +0 -268
- package/src/components/chart/scale/scale.logarithmic.js +0 -135
- package/src/components/chart/scale/scale.step.js +0 -430
- package/src/components/chart/scale/scale.time.category.js +0 -338
- package/src/components/chart/scale/scale.time.js +0 -49
- package/src/components/chart/style/chart.scss +0 -405
- package/src/components/chart/uses.js +0 -721
- package/src/components/chartBrush/ChartBrush.vue +0 -323
- package/src/components/chartBrush/chartBrush.core.js +0 -691
- package/src/components/chartBrush/index.js +0 -9
- package/src/components/chartBrush/uses.js +0 -23
- package/src/components/chartGroup/ChartGroup.vue +0 -144
- package/src/components/chartGroup/index.js +0 -9
- package/src/components/chartGroup/style/chartGroup.scss +0 -5
- package/src/components/chartGroup/uses.js +0 -53
- package/src/components/checkbox/Checkbox.vue +0 -229
- package/src/components/checkbox/index.js +0 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +0 -44
- package/src/components/checkboxGroup/index.js +0 -7
- package/src/components/contextMenu/ContextMenu.vue +0 -95
- package/src/components/contextMenu/MenuList.vue +0 -182
- package/src/components/contextMenu/index.js +0 -7
- package/src/components/contextMenu/uses.js +0 -223
- package/src/components/datePicker/DatePicker.vue +0 -504
- package/src/components/datePicker/index.js +0 -7
- package/src/components/datePicker/uses.js +0 -460
- package/src/components/grid/Grid.vue +0 -1535
- package/src/components/grid/GridColumnSetting.vue +0 -358
- package/src/components/grid/GridFilterSetting.vue +0 -323
- package/src/components/grid/GridPagination.vue +0 -75
- package/src/components/grid/GridSummary.vue +0 -314
- package/src/components/grid/GridToolbar.vue +0 -35
- package/src/components/grid/icon/icon-option-button.vue +0 -17
- package/src/components/grid/icon/icon-sort-button.vue +0 -67
- package/src/components/grid/index.js +0 -11
- package/src/components/grid/style/grid.scss +0 -417
- package/src/components/grid/uses.js +0 -1629
- package/src/components/icon/Icon.vue +0 -53
- package/src/components/icon/index.js +0 -8
- package/src/components/inputNumber/InputNumber.vue +0 -212
- package/src/components/inputNumber/index.js +0 -7
- package/src/components/inputNumber/uses.js +0 -217
- package/src/components/loading/Loading.vue +0 -125
- package/src/components/loading/index.js +0 -7
- package/src/components/menu/Menu.vue +0 -79
- package/src/components/menu/MenuItem.vue +0 -201
- package/src/components/menu/index.js +0 -7
- package/src/components/message/Message.vue +0 -229
- package/src/components/message/index.js +0 -34
- package/src/components/messageBox/MessageBox.vue +0 -358
- package/src/components/messageBox/index.js +0 -22
- package/src/components/notification/Notification.vue +0 -316
- package/src/components/notification/index.js +0 -49
- package/src/components/pagination/Pagination.vue +0 -317
- package/src/components/pagination/index.js +0 -7
- package/src/components/pagination/pageButton.vue +0 -31
- package/src/components/progress/Progress.vue +0 -139
- package/src/components/progress/index.js +0 -7
- package/src/components/radio/Radio.vue +0 -159
- package/src/components/radio/index.js +0 -7
- package/src/components/radioGroup/RadioGroup.vue +0 -41
- package/src/components/radioGroup/index.js +0 -7
- package/src/components/scheduler/Scheduler.vue +0 -149
- package/src/components/scheduler/index.js +0 -7
- package/src/components/scheduler/uses.js +0 -183
- package/src/components/select/Select.vue +0 -556
- package/src/components/select/index.js +0 -7
- package/src/components/select/uses.js +0 -379
- package/src/components/slider/Slider.vue +0 -505
- package/src/components/slider/index.js +0 -7
- package/src/components/slider/uses.js +0 -391
- package/src/components/tabPanel/TabPanel.vue +0 -74
- package/src/components/tabPanel/index.js +0 -7
- package/src/components/tabs/Tabs.vue +0 -517
- package/src/components/tabs/index.js +0 -7
- package/src/components/textField/TextField.vue +0 -399
- package/src/components/textField/index.js +0 -7
- package/src/components/timePicker/TimePicker.vue +0 -364
- package/src/components/timePicker/index.js +0 -7
- package/src/components/toggle/Toggle.vue +0 -115
- package/src/components/toggle/index.js +0 -7
- package/src/components/tree/Tree.vue +0 -338
- package/src/components/tree/TreeNode.vue +0 -293
- package/src/components/tree/index.js +0 -7
- package/src/components/treeGrid/TreeGrid.vue +0 -1074
- package/src/components/treeGrid/TreeGridNode.vue +0 -349
- package/src/components/treeGrid/TreeGridToolbar.vue +0 -35
- package/src/components/treeGrid/icon/icon-tree.png +0 -0
- package/src/components/treeGrid/index.js +0 -9
- package/src/components/treeGrid/style/treeGrid.scss +0 -277
- package/src/components/treeGrid/uses.js +0 -1178
- package/src/components/window/Window.vue +0 -329
- package/src/components/window/index.js +0 -7
- package/src/components/window/uses.js +0 -908
- package/src/directives/clickoutside.js +0 -90
- package/src/main.js +0 -120
- package/src/style/components/input.scss +0 -108
- package/src/style/functions.scss +0 -3
- package/src/style/index.scss +0 -6
- package/src/style/lib/fonts/EVUI.eot +0 -0
- package/src/style/lib/fonts/EVUI.svg +0 -293
- package/src/style/lib/fonts/EVUI.ttf +0 -0
- package/src/style/lib/fonts/EVUI.woff +0 -0
- package/src/style/lib/icon.css +0 -888
- package/src/style/mixins.scss +0 -94
- package/src/style/themes.scss +0 -69
- package/src/style/variables.scss +0 -22
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
billions,
|
|
3
|
-
millions,
|
|
4
|
-
quadrillion,
|
|
5
|
-
trillion,
|
|
6
|
-
truthy,
|
|
7
|
-
} from '@/common/utils';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
/**
|
|
11
|
-
* Transforming hex to rgb code
|
|
12
|
-
* @param {string} hex hex color code
|
|
13
|
-
*
|
|
14
|
-
* @returns {string} rgb code
|
|
15
|
-
*/
|
|
16
|
-
hexToRgb(hex) {
|
|
17
|
-
if (!hex) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
22
|
-
|
|
23
|
-
const r = parseInt(result[1], 16);
|
|
24
|
-
const g = parseInt(result[2], 16);
|
|
25
|
-
const b = parseInt(result[3], 16);
|
|
26
|
-
|
|
27
|
-
return `${r},${g},${b}`;
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Check color string and return what type it is. ('HEX', 'RGB', 'RGBA' or 'NONE')
|
|
32
|
-
* @param colorStr
|
|
33
|
-
* @returns {string} color type
|
|
34
|
-
*/
|
|
35
|
-
getColorStringType(colorStr) {
|
|
36
|
-
if (!colorStr) {
|
|
37
|
-
return '';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const noneWhiteSpaceColorStr = colorStr.replace(/ /g, '');
|
|
41
|
-
const isHEX = /^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(noneWhiteSpaceColorStr);
|
|
42
|
-
const isRGB = /^rgb[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*(?:,(?![)])|(?=[)]))){3}[)]$/.exec(noneWhiteSpaceColorStr);
|
|
43
|
-
const isRGBA = /^rgba[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*,){3}\s*0*(?:\.\d+|1?)\s*[)]$/.exec(noneWhiteSpaceColorStr);
|
|
44
|
-
let result = '';
|
|
45
|
-
|
|
46
|
-
if (isHEX) {
|
|
47
|
-
result = 'HEX';
|
|
48
|
-
} else if (isRGB) {
|
|
49
|
-
result = 'RGB';
|
|
50
|
-
} else if (isRGBA) {
|
|
51
|
-
result = 'RGBA';
|
|
52
|
-
} else {
|
|
53
|
-
result = 'NONE';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return result;
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Transforming color string to rgba code
|
|
61
|
-
* Return BLACK ('rgba(0, 0, 0, ${opacity})') if fail transforming
|
|
62
|
-
* @param colorStr hex color code, rgb, rgba .. etc
|
|
63
|
-
* @param opacity color opacity. (default 1)translate
|
|
64
|
-
* @returns {string} transformed rgba
|
|
65
|
-
*/
|
|
66
|
-
colorStringToRgba(colorStr, opacity = 1) {
|
|
67
|
-
const noneWhiteSpaceColorStr = colorStr.replace(/ /g, '');
|
|
68
|
-
const colorType = this.getColorStringType(noneWhiteSpaceColorStr);
|
|
69
|
-
let resultRGBA = '';
|
|
70
|
-
|
|
71
|
-
switch (colorType) {
|
|
72
|
-
case 'HEX':
|
|
73
|
-
resultRGBA = `rgba(${this.hexToRgb(noneWhiteSpaceColorStr)},${opacity})`;
|
|
74
|
-
break;
|
|
75
|
-
case 'RGB':
|
|
76
|
-
resultRGBA = noneWhiteSpaceColorStr.replace(')', `, ${opacity})`).replace('rgb', 'rgba');
|
|
77
|
-
break;
|
|
78
|
-
case 'RGBA':
|
|
79
|
-
resultRGBA = noneWhiteSpaceColorStr.replace(`${this.getOpacity(colorStr)})`, `${opacity})`);
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
resultRGBA = `rgba(0, 0, 0, ${opacity})`;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return resultRGBA;
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* get opacity value on rgba color string
|
|
91
|
-
* ex) input : rgba(255, 255, 255, 0.1)
|
|
92
|
-
* return : 0.1
|
|
93
|
-
* @param rgbaColorString
|
|
94
|
-
* @returns {string} opacity
|
|
95
|
-
*/
|
|
96
|
-
getOpacity(rgbaColorString) {
|
|
97
|
-
const noneWhiteSpaceColorStr = rgbaColorString?.replace(/ /g, '');
|
|
98
|
-
const colorType = this.getColorStringType(noneWhiteSpaceColorStr);
|
|
99
|
-
|
|
100
|
-
if (colorType === 'RGBA') {
|
|
101
|
-
return noneWhiteSpaceColorStr.replace(/^.*,(.+)\)/, '$1');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return '1';
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* To logarithmic scale, compute log value
|
|
109
|
-
* @param {number} value graph value
|
|
110
|
-
*
|
|
111
|
-
* @returns {number} computed value
|
|
112
|
-
*/
|
|
113
|
-
calculateMagnitude(value) {
|
|
114
|
-
return Math.floor(Math.log(value) / Math.LN10);
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Set alias pixel to deal with anti-aliasing
|
|
119
|
-
* @param {number} width line width
|
|
120
|
-
*
|
|
121
|
-
* @returns {number} computed value
|
|
122
|
-
*/
|
|
123
|
-
aliasPixel(width) {
|
|
124
|
-
return width % 2 === 0 ? 0 : 0.5;
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Create string for canvas font style
|
|
129
|
-
* @param {object} style style object by user
|
|
130
|
-
*
|
|
131
|
-
* @returns {string} computed value
|
|
132
|
-
*/
|
|
133
|
-
getLabelStyle(style) {
|
|
134
|
-
const {
|
|
135
|
-
fontStyle = 'normal',
|
|
136
|
-
fontWeight = 'normal',
|
|
137
|
-
fontSize = '12',
|
|
138
|
-
fontFamily = 'Roboto',
|
|
139
|
-
} = style;
|
|
140
|
-
|
|
141
|
-
return `${fontStyle} normal ${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Create sign format with number
|
|
146
|
-
* @param {number} value graph value
|
|
147
|
-
* @param {number} decimalPoint decimal point
|
|
148
|
-
*
|
|
149
|
-
* @returns {string} signed value
|
|
150
|
-
*/
|
|
151
|
-
labelSignFormat(value, decimalPoint = 0) {
|
|
152
|
-
const quad = quadrillion(1);
|
|
153
|
-
const trill = trillion(1);
|
|
154
|
-
const billi = billions(1);
|
|
155
|
-
const milli = millions(1);
|
|
156
|
-
const killo = 1000;
|
|
157
|
-
|
|
158
|
-
let label;
|
|
159
|
-
if (!truthy(value)) {
|
|
160
|
-
return value;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const isNegative = value < 0;
|
|
164
|
-
const absValue = Math.abs(value);
|
|
165
|
-
|
|
166
|
-
const assignLabelWith = (v, target, lb) => {
|
|
167
|
-
const result = v % target === 0
|
|
168
|
-
? `${(v / target).toFixed(decimalPoint)}${lb}`
|
|
169
|
-
: `${(v / target).toFixed(1)}${lb}`;
|
|
170
|
-
|
|
171
|
-
return isNegative ? `-${result}` : result;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
if (absValue >= quad) {
|
|
175
|
-
label = assignLabelWith(absValue, quad, 'P');
|
|
176
|
-
} else if (absValue >= trill) {
|
|
177
|
-
label = assignLabelWith(absValue, trill, 'T');
|
|
178
|
-
} else if (absValue >= billi) {
|
|
179
|
-
label = assignLabelWith(absValue, billi, 'G');
|
|
180
|
-
} else if (absValue >= milli) {
|
|
181
|
-
label = assignLabelWith(absValue, milli, 'M');
|
|
182
|
-
} else if (absValue >= killo) {
|
|
183
|
-
label = assignLabelWith(absValue, 1000, 'K');
|
|
184
|
-
} else {
|
|
185
|
-
label = isNegative ? `-${absValue.toFixed(decimalPoint)}` : value.toFixed(decimalPoint);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return label;
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Calculate text size with html
|
|
193
|
-
* @param {string} text text is needed to check size
|
|
194
|
-
* @param {string} fontStyle text font style
|
|
195
|
-
* @param {number} padding user define text padding
|
|
196
|
-
*
|
|
197
|
-
* @returns {object} text size information
|
|
198
|
-
*/
|
|
199
|
-
calcTextSize(text, fontStyle, padding = 0) {
|
|
200
|
-
const calc = document.createElement('span');
|
|
201
|
-
const style = `visibility:hidden; position:absolute; top:-10000px; font: ${fontStyle}; padding: 0 ${padding}px`;
|
|
202
|
-
|
|
203
|
-
calc.setAttribute('style', style);
|
|
204
|
-
calc.style.font = fontStyle;
|
|
205
|
-
calc.textContent = text;
|
|
206
|
-
document.body.appendChild(calc);
|
|
207
|
-
|
|
208
|
-
const rect = calc.getBoundingClientRect();
|
|
209
|
-
const width = rect.width || 2;
|
|
210
|
-
const height = rect.height || 2;
|
|
211
|
-
|
|
212
|
-
calc.remove();
|
|
213
|
-
|
|
214
|
-
return { width, height };
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Comparing strings
|
|
219
|
-
* @param {array} array compared array
|
|
220
|
-
*
|
|
221
|
-
* @returns {object} min/max information
|
|
222
|
-
*/
|
|
223
|
-
getStringMinMax(array) {
|
|
224
|
-
const minMax = {
|
|
225
|
-
min: array[0],
|
|
226
|
-
max: array[0],
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
array.forEach((item) => {
|
|
230
|
-
if (minMax?.max?.length < item?.length) {
|
|
231
|
-
minMax.max = item;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (minMax?.min?.length > item?.length) {
|
|
235
|
-
minMax.min = item;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
return minMax;
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Truncate the long string to short string with ellipsis until fitting maxWidth
|
|
244
|
-
* @param {string} str target string
|
|
245
|
-
* @param {number} maxWidth maximum string width on canvas
|
|
246
|
-
* @param {Object} ctx canvas context
|
|
247
|
-
* @param {string} direction left or right (default: right)
|
|
248
|
-
*/
|
|
249
|
-
truncateLabelWithEllipsis(str, maxWidth, ctx, direction = 'right') {
|
|
250
|
-
if (!str) {
|
|
251
|
-
return '';
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (!maxWidth) {
|
|
255
|
-
return str;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const ellipsis = '…';
|
|
259
|
-
const ellipsisWidth = ctx.measureText(ellipsis).width;
|
|
260
|
-
|
|
261
|
-
let temp = str;
|
|
262
|
-
let tempWidth = ctx.measureText(temp).width;
|
|
263
|
-
|
|
264
|
-
if (tempWidth <= maxWidth || tempWidth <= ellipsisWidth) {
|
|
265
|
-
return str;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
let len = temp.length;
|
|
269
|
-
while (tempWidth >= maxWidth - ellipsisWidth && len-- > 0) {
|
|
270
|
-
temp = direction === 'right' ? temp.substring(0, len) : temp.substring(1, temp.length);
|
|
271
|
-
tempWidth = ctx.measureText(temp).width;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return direction === 'right' ? temp + ellipsis : ellipsis + temp;
|
|
275
|
-
},
|
|
276
|
-
/**
|
|
277
|
-
* Draw text tip
|
|
278
|
-
* @param {object} param object for drawing text tip
|
|
279
|
-
*
|
|
280
|
-
* @returns {undefined}
|
|
281
|
-
*/
|
|
282
|
-
showLabelTip(param) {
|
|
283
|
-
const {
|
|
284
|
-
ctx,
|
|
285
|
-
width,
|
|
286
|
-
height,
|
|
287
|
-
x,
|
|
288
|
-
y,
|
|
289
|
-
arrowSize,
|
|
290
|
-
borderRadius,
|
|
291
|
-
text,
|
|
292
|
-
backgroundColor,
|
|
293
|
-
textColor,
|
|
294
|
-
} = param;
|
|
295
|
-
const sx = x - (width / 2);
|
|
296
|
-
const ex = x + (width / 2);
|
|
297
|
-
const sy = y - height;
|
|
298
|
-
const ey = y;
|
|
299
|
-
|
|
300
|
-
ctx.beginPath();
|
|
301
|
-
ctx.save();
|
|
302
|
-
ctx.fillStyle = backgroundColor || '#E96E2C';
|
|
303
|
-
ctx.strokeStyle = backgroundColor || '#E96E2C';
|
|
304
|
-
ctx.shadowBlur = 0;
|
|
305
|
-
ctx.moveTo(sx + borderRadius, sy);
|
|
306
|
-
ctx.quadraticCurveTo(sx, sy, sx, sy + borderRadius);
|
|
307
|
-
ctx.lineTo(sx, ey - borderRadius);
|
|
308
|
-
ctx.quadraticCurveTo(sx, ey, sx + borderRadius, ey);
|
|
309
|
-
ctx.lineTo(ex - borderRadius, ey);
|
|
310
|
-
ctx.quadraticCurveTo(ex, ey, ex, ey - borderRadius);
|
|
311
|
-
ctx.lineTo(ex, sy + borderRadius);
|
|
312
|
-
ctx.quadraticCurveTo(ex, sy, ex - borderRadius, sy);
|
|
313
|
-
ctx.lineTo(x - arrowSize, sy);
|
|
314
|
-
ctx.lineTo(x, sy - arrowSize);
|
|
315
|
-
ctx.lineTo(x + arrowSize, sy);
|
|
316
|
-
ctx.lineTo(sx + borderRadius, sy);
|
|
317
|
-
ctx.closePath();
|
|
318
|
-
ctx.fill();
|
|
319
|
-
ctx.restore();
|
|
320
|
-
ctx.save();
|
|
321
|
-
ctx.font = 'normal normal bold 12px Roboto';
|
|
322
|
-
ctx.fillStyle = textColor || '#FFF';
|
|
323
|
-
ctx.textBaseline = 'middle';
|
|
324
|
-
ctx.textAlign = 'center';
|
|
325
|
-
ctx.fillText(`${text}`, x, sy + (height / 2));
|
|
326
|
-
ctx.restore();
|
|
327
|
-
ctx.beginPath();
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
isPieType(type) {
|
|
331
|
-
return type === 'pie' || type === 'doughnut' || type === 'sunburst';
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
isDoughnutHole(type) {
|
|
335
|
-
return type === 'doughnut' || type === 'sunburst';
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
setDOMStyle(targetDOM, styleObject) {
|
|
339
|
-
if (!targetDOM || !styleObject) {
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
Object.keys(styleObject)?.forEach((key) => {
|
|
344
|
-
targetDOM.style[key] = styleObject[key];
|
|
345
|
-
});
|
|
346
|
-
},
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Check the value exceeds 9007199254740991 or less than -9007199254740991
|
|
350
|
-
* null => safe Integer
|
|
351
|
-
* string and undefined => Not Safe Integer
|
|
352
|
-
* @param {any} value
|
|
353
|
-
* @returns {boolean}
|
|
354
|
-
*/
|
|
355
|
-
checkSafeInteger(value) {
|
|
356
|
-
return value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER;
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Convert html(string) To Element
|
|
361
|
-
* @param htmlString
|
|
362
|
-
* @returns {ChildNode}
|
|
363
|
-
*/
|
|
364
|
-
htmlToElement(htmlString) {
|
|
365
|
-
const template = document.createElement('template');
|
|
366
|
-
template.innerHTML = htmlString.trim();
|
|
367
|
-
return template.content.firstChild;
|
|
368
|
-
},
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Check The value is null or undefined
|
|
372
|
-
* @param { number | undefined | null } value
|
|
373
|
-
* @returns {boolean}
|
|
374
|
-
*/
|
|
375
|
-
isNullOrUndefined(value) {
|
|
376
|
-
return value === null || value === undefined;
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
rgbaAdjustHalfOpacity(color) {
|
|
380
|
-
const rgbRegex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
|
|
381
|
-
const rgbaRegex = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
|
|
382
|
-
|
|
383
|
-
if (rgbRegex.test(color)) {
|
|
384
|
-
const [, r, g, b] = color.match(rgbRegex);
|
|
385
|
-
return `rgba(${r}, ${g}, ${b}, 0.5)`;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (rgbaRegex.test(color)) {
|
|
389
|
-
const [, r, g, b, a] = color.match(rgbaRegex);
|
|
390
|
-
const newOpacity = (parseFloat(a) / 2).toFixed(2);
|
|
391
|
-
return `rgba(${r}, ${g}, ${b}, ${newOpacity})`;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
if (color.startsWith('#') && color.length > 7) {
|
|
395
|
-
return color;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
return `${color}80`;
|
|
399
|
-
},
|
|
400
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import Store from './model.store';
|
|
2
|
-
import Series from './model.series';
|
|
3
|
-
|
|
4
|
-
export default { Store, Series };
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {Object} ChartDOMSize
|
|
9
|
-
* @property {number} width - 차트 DOM의 너비
|
|
10
|
-
* @property {number} height - 차트 DOM의 높이
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {Object} ChartRect
|
|
15
|
-
* @property {number} x1 - 차트 영역의 시작 X 좌표
|
|
16
|
-
* @property {number} x2 - 차트 영역의 끝 X 좌표
|
|
17
|
-
* @property {number} y1 - 차트 영역의 시작 Y 좌표
|
|
18
|
-
* @property {number} y2 - 차트 영역의 끝 Y 좌표
|
|
19
|
-
* @property {number} chartWidth - 실제 차트 그리기 영역의 너비
|
|
20
|
-
* @property {number} chartHeight - 실제 차트 그리기 영역의 높이
|
|
21
|
-
* @property {number} width - 전체 차트 컨테이너의 너비
|
|
22
|
-
* @property {number} height - 전체 차트 컨테이너의 높이
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} MouseLabelValue
|
|
28
|
-
* @property {string|number} labelVal - 마우스 위치에 해당하는 라벨 값
|
|
29
|
-
* @property {number} labelIdx - 라벨 인덱스 (없으면 -1)
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {Object} ChartSeriesDataPoint
|
|
35
|
-
* @property {number|null} x - x축 값 또는 라벨
|
|
36
|
-
* @property {number|null} y - y축 값 또는 데이터 값
|
|
37
|
-
* @property {number|null} o - 원본 데이터 값
|
|
38
|
-
* @property {number|null} b - 스택형 차트의 베이스 값
|
|
39
|
-
* @property {number|null} xp - x좌표 위치(픽셀 등)
|
|
40
|
-
* @property {number|null} yp - y좌표 위치(픽셀 등)
|
|
41
|
-
* @property {number|null} w - 너비
|
|
42
|
-
* @property {number|null} h - 높이
|
|
43
|
-
* @property {string|null} dataColor - 데이터 색상
|
|
44
|
-
* @property {string|null} dataTextColor - 텍스트 색상
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @typedef {'none' | 'linear' | 'zero'} InterpolationType
|
|
50
|
-
*/
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import Line from '../element/element.line';
|
|
2
|
-
import Scatter from '../element/element.scatter';
|
|
3
|
-
import Bar from '../element/element.bar';
|
|
4
|
-
import TimeBar from '../element/element.bar.time';
|
|
5
|
-
import Pie from '../element/element.pie';
|
|
6
|
-
import HeatMap from '../element/element.heatmap';
|
|
7
|
-
|
|
8
|
-
const modules = {
|
|
9
|
-
/**
|
|
10
|
-
* Takes series information to create series list.
|
|
11
|
-
* @param {object} series chart series info
|
|
12
|
-
* @param {string} defaultType default series type in options
|
|
13
|
-
* @param {boolean} isHorizontal determines if a horizontal option's value
|
|
14
|
-
* @param {object} groups group info
|
|
15
|
-
*
|
|
16
|
-
* @returns {undefined}
|
|
17
|
-
*/
|
|
18
|
-
createSeriesSet(series, defaultType, isHorizontal, groups) {
|
|
19
|
-
let seriesKeys = Object.keys(series);
|
|
20
|
-
|
|
21
|
-
if (this.options.overlapping.use) {
|
|
22
|
-
seriesKeys = this.getOverlappingSeriesKeys(series, defaultType, groups);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
seriesKeys.forEach((key, index) => {
|
|
26
|
-
const type = series[key].type || defaultType;
|
|
27
|
-
this.seriesList[key] = this.addSeries({
|
|
28
|
-
type,
|
|
29
|
-
id: key,
|
|
30
|
-
opt: series[key],
|
|
31
|
-
index,
|
|
32
|
-
isHorizontal,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
getOverlappingSeriesKeys(series, defaultType, groups) {
|
|
38
|
-
const barSeries = [];
|
|
39
|
-
const otherSeries = [];
|
|
40
|
-
const allGroups = groups.flat();
|
|
41
|
-
|
|
42
|
-
Object.keys(series).forEach((key) => {
|
|
43
|
-
const type = series[key].type || defaultType;
|
|
44
|
-
const isOverlappingBar = type === 'bar' && allGroups.length;
|
|
45
|
-
|
|
46
|
-
if (isOverlappingBar) {
|
|
47
|
-
const overlappingIdx = allGroups.findIndex(group => group === key);
|
|
48
|
-
barSeries.push({ key, overlappingIdx });
|
|
49
|
-
} else {
|
|
50
|
-
otherSeries.push({ key });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// 큰 값을 가지는 series가 먼저 그려지도록 groups에서 지정한 순서의 역순으로 정렬
|
|
55
|
-
barSeries.sort((a, b) => b.overlappingIdx - a.overlappingIdx);
|
|
56
|
-
|
|
57
|
-
return [...barSeries, ...otherSeries]
|
|
58
|
-
.map(({ key }) => key);
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Takes series information to create series list.
|
|
63
|
-
* @param {object} param series info
|
|
64
|
-
*
|
|
65
|
-
* @returns {object} object for proper series type
|
|
66
|
-
*/
|
|
67
|
-
addSeries(param) {
|
|
68
|
-
const { type, id, opt, index, isHorizontal } = param;
|
|
69
|
-
|
|
70
|
-
if (type === 'line') {
|
|
71
|
-
this.seriesInfo.charts.line.push(id);
|
|
72
|
-
return new Line(id, opt, index);
|
|
73
|
-
} else if (type === 'scatter') {
|
|
74
|
-
this.seriesInfo.charts.scatter.push(id);
|
|
75
|
-
return new Scatter(id, opt, index, this.options.realTimeScatter?.use);
|
|
76
|
-
} else if (type === 'bar') {
|
|
77
|
-
this.seriesInfo.charts.bar.push(id);
|
|
78
|
-
|
|
79
|
-
if (opt.timeMode) {
|
|
80
|
-
return new TimeBar(id, opt, index, isHorizontal);
|
|
81
|
-
}
|
|
82
|
-
return new Bar(id, opt, index, isHorizontal);
|
|
83
|
-
} else if (type === 'pie') {
|
|
84
|
-
this.seriesInfo.charts.pie.push(id);
|
|
85
|
-
return new Pie(id, opt, index);
|
|
86
|
-
} else if (type === 'heatMap') {
|
|
87
|
-
this.seriesInfo.charts.heatMap.push(id);
|
|
88
|
-
const { heatMapColor, legend } = this.options;
|
|
89
|
-
const isGradient = legend.type === 'gradient';
|
|
90
|
-
return new HeatMap(id, opt, heatMapColor, isHorizontal, isGradient);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return false;
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Set series group to create stack chart
|
|
98
|
-
* @param {object} groups group info
|
|
99
|
-
*
|
|
100
|
-
* @returns {undefined}
|
|
101
|
-
*/
|
|
102
|
-
addGroupInfo(groups) {
|
|
103
|
-
groups.forEach((group, gIdx) => {
|
|
104
|
-
let interpolation = 0;
|
|
105
|
-
group.reduce((prev, curr, sIdx) => {
|
|
106
|
-
const series = this.seriesList[curr];
|
|
107
|
-
|
|
108
|
-
series.stackIndex = sIdx + interpolation;
|
|
109
|
-
series.groupIndex = gIdx;
|
|
110
|
-
series.isExistGrp = true;
|
|
111
|
-
series.bsId = prev;
|
|
112
|
-
series.bsIds = group.filter((item, idx) => item !== curr && sIdx > idx);
|
|
113
|
-
series.isOverlapping = this.options.overlapping.use;
|
|
114
|
-
|
|
115
|
-
if (!series.show) {
|
|
116
|
-
interpolation--;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return !series.show ? prev : curr;
|
|
120
|
-
}, group[0]);
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export default modules;
|