evui 3.4.206 → 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 -63678
- package/dist/evui.common.js.map +0 -1
- package/dist/evui.umd.js +0 -63688
- 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 -1655
- 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,197 +0,0 @@
|
|
|
1
|
-
import { merge } from 'lodash-es';
|
|
2
|
-
import { PIE_OPTION, COLOR } from '../helpers/helpers.constant';
|
|
3
|
-
import Util from '../helpers/helpers.util';
|
|
4
|
-
|
|
5
|
-
class Pie {
|
|
6
|
-
constructor(sId, opt, sIdx) {
|
|
7
|
-
const merged = merge({}, PIE_OPTION, opt);
|
|
8
|
-
Object.keys(merged).forEach((key) => {
|
|
9
|
-
this[key] = merged[key];
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
if (this.name === undefined) {
|
|
13
|
-
this.name = `series-${sIdx}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (this.color === undefined) {
|
|
17
|
-
this.color = COLOR[sIdx];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.sId = sId;
|
|
21
|
-
this.show = true;
|
|
22
|
-
this.data = [];
|
|
23
|
-
this.type = 'pie';
|
|
24
|
-
this.centerX = 0;
|
|
25
|
-
this.centerY = 0;
|
|
26
|
-
this.radius = 0;
|
|
27
|
-
this.doughnutHoleSize = 0;
|
|
28
|
-
this.startAngle = 0;
|
|
29
|
-
this.endAngle = 0;
|
|
30
|
-
this.ctx = null;
|
|
31
|
-
this.isSelect = false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Draw series data
|
|
36
|
-
* @param context
|
|
37
|
-
* @param strokeOptions
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @returns {undefined}
|
|
41
|
-
*/
|
|
42
|
-
draw(context, strokeOptions) {
|
|
43
|
-
const ctx = context ?? this.ctx;
|
|
44
|
-
const slice = new Path2D();
|
|
45
|
-
|
|
46
|
-
const radius = this.isSelect ? this.radius + 5 : this.radius;
|
|
47
|
-
|
|
48
|
-
const color = this.color;
|
|
49
|
-
const noneDownplayOpacity = color.includes('rgba') ? Util.getOpacity(color) : 1;
|
|
50
|
-
const opacity = this.isDownplay ? 0.1 : noneDownplayOpacity;
|
|
51
|
-
|
|
52
|
-
ctx.beginPath();
|
|
53
|
-
slice.moveTo(this.centerX, this.centerY);
|
|
54
|
-
slice.arc(this.centerX, this.centerY, radius, this.startAngle, this.endAngle);
|
|
55
|
-
slice.lineTo(this.centerX, this.centerY);
|
|
56
|
-
ctx.fillStyle = Util.colorStringToRgba(color, opacity);
|
|
57
|
-
ctx.fill(slice);
|
|
58
|
-
|
|
59
|
-
if (strokeOptions.use) {
|
|
60
|
-
ctx.lineCap = 'round';
|
|
61
|
-
ctx.lineWidth = strokeOptions?.lineWidth;
|
|
62
|
-
ctx.strokeStyle = strokeOptions?.color;
|
|
63
|
-
ctx.stroke(slice);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (this.showValue?.use) {
|
|
67
|
-
this.drawValueLabels(ctx);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
ctx.closePath();
|
|
71
|
-
this.ctx = ctx;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Find graph item
|
|
76
|
-
* @param {array} offset mouse position
|
|
77
|
-
*
|
|
78
|
-
* @returns {object} graph item
|
|
79
|
-
*/
|
|
80
|
-
findGraphData([offsetX, offsetY]) {
|
|
81
|
-
const item = { data: null, hit: false, color: null, index: -1 };
|
|
82
|
-
const {
|
|
83
|
-
radius,
|
|
84
|
-
startAngle,
|
|
85
|
-
endAngle,
|
|
86
|
-
centerX,
|
|
87
|
-
centerY,
|
|
88
|
-
} = this;
|
|
89
|
-
|
|
90
|
-
const distance = Math.sqrt((offsetX - centerX) ** 2 + (offsetY - centerY) ** 2);
|
|
91
|
-
const radian = (2.5 * Math.PI) - Math.atan2((offsetX - centerX), (offsetY - centerY));
|
|
92
|
-
const isPointInPath = radius > distance && radian >= startAngle && radian <= endAngle;
|
|
93
|
-
|
|
94
|
-
if (this.show && isPointInPath) {
|
|
95
|
-
item.type = this.type;
|
|
96
|
-
item.data = this.data;
|
|
97
|
-
item.hit = true;
|
|
98
|
-
item.color = this.color;
|
|
99
|
-
item.index = 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return item;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Draw item highlight
|
|
107
|
-
*
|
|
108
|
-
* @param item {object} object for drawing series data
|
|
109
|
-
* @param context {CanvasRenderingContext2D} canvas context
|
|
110
|
-
*
|
|
111
|
-
* @returns {undefined}
|
|
112
|
-
*/
|
|
113
|
-
itemHighlight(item, context) {
|
|
114
|
-
const ctx = context;
|
|
115
|
-
const radius = this.isSelect ? this.radius + 5 : this.radius;
|
|
116
|
-
|
|
117
|
-
ctx.save();
|
|
118
|
-
ctx.shadowOffsetX = 0;
|
|
119
|
-
ctx.shadowOffsetY = 0;
|
|
120
|
-
ctx.shadowBlur = 4;
|
|
121
|
-
|
|
122
|
-
const color = item?.data?.dataColor || this.color;
|
|
123
|
-
ctx.fillStyle = color;
|
|
124
|
-
ctx.shadowColor = color;
|
|
125
|
-
|
|
126
|
-
ctx.beginPath();
|
|
127
|
-
ctx.moveTo(this.centerX, this.centerY);
|
|
128
|
-
ctx.arc(this.centerX, this.centerY, radius, this.startAngle, this.endAngle);
|
|
129
|
-
ctx.lineTo(this.centerX, this.centerY);
|
|
130
|
-
ctx.fill();
|
|
131
|
-
|
|
132
|
-
if (this.showValue?.use) {
|
|
133
|
-
this.drawValueLabels(ctx);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
ctx.closePath();
|
|
137
|
-
ctx.restore();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Draw value label if series 'use' of showValue option is true
|
|
142
|
-
*
|
|
143
|
-
* @param context canvas context
|
|
144
|
-
*/
|
|
145
|
-
drawValueLabels(context) {
|
|
146
|
-
const ctx = context;
|
|
147
|
-
const value = this.data.o;
|
|
148
|
-
const { fontSize, textColor, formatter } = this.showValue;
|
|
149
|
-
|
|
150
|
-
let formattedTxt;
|
|
151
|
-
if (formatter) {
|
|
152
|
-
formattedTxt = formatter({
|
|
153
|
-
value,
|
|
154
|
-
percentage: this.data.percentage,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (!formatter || typeof formattedTxt !== 'string') {
|
|
159
|
-
formattedTxt = Util.labelSignFormat(value);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const ratio = 1.8;
|
|
163
|
-
const radius = this.radius - this.doughnutHoleSize;
|
|
164
|
-
const innerAngle = ((this.endAngle - this.startAngle) * 180) / Math.PI;
|
|
165
|
-
const valueHeight = fontSize + 4;
|
|
166
|
-
const valueWidth = Math.round(ctx.measureText(formattedTxt).width);
|
|
167
|
-
|
|
168
|
-
if (innerAngle >= valueWidth * ratio
|
|
169
|
-
&& innerAngle >= valueHeight * ratio
|
|
170
|
-
&& radius >= valueWidth * ratio
|
|
171
|
-
&& radius >= valueHeight * ratio
|
|
172
|
-
) {
|
|
173
|
-
ctx.save();
|
|
174
|
-
ctx.beginPath();
|
|
175
|
-
|
|
176
|
-
const noneDownplayOpacity = textColor.includes('rgba') ? Util.getOpacity(textColor) : 1;
|
|
177
|
-
const opacity = this.state === 'downplay' ? 0.1 : noneDownplayOpacity;
|
|
178
|
-
|
|
179
|
-
ctx.font = `normal normal normal ${fontSize}px Roboto`;
|
|
180
|
-
ctx.fillStyle = Util.colorStringToRgba(textColor, opacity);
|
|
181
|
-
ctx.lineWidth = 1;
|
|
182
|
-
ctx.textAlign = 'center';
|
|
183
|
-
ctx.textBaseline = 'middle';
|
|
184
|
-
|
|
185
|
-
const halfRadius = (radius / 2) + this.doughnutHoleSize;
|
|
186
|
-
const centerAngle = ((this.endAngle - this.startAngle) / 2) + this.startAngle;
|
|
187
|
-
const xPos = halfRadius * Math.cos(centerAngle) + this.centerX;
|
|
188
|
-
const yPos = halfRadius * Math.sin(centerAngle) + this.centerY;
|
|
189
|
-
|
|
190
|
-
ctx.fillText(formattedTxt, xPos, yPos);
|
|
191
|
-
|
|
192
|
-
ctx.restore();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export default Pie;
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { merge } from 'lodash-es';
|
|
2
|
-
import { COLOR, LINE_OPTION } from '../helpers/helpers.constant';
|
|
3
|
-
import Util from '../helpers/helpers.util';
|
|
4
|
-
import Canvas from '../helpers/helpers.canvas';
|
|
5
|
-
|
|
6
|
-
class Scatter {
|
|
7
|
-
constructor(sId, opt, sIdx, realTimeScatter = false) {
|
|
8
|
-
const merged = merge({}, LINE_OPTION, opt);
|
|
9
|
-
Object.keys(merged).forEach((key) => {
|
|
10
|
-
this[key] = merged[key];
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (this.name === undefined) {
|
|
14
|
-
this.name = `series-${sIdx}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
['color', 'pointFill', 'fillColor', 'overflowColor'].forEach((colorProp) => {
|
|
18
|
-
if (this[colorProp] === undefined) {
|
|
19
|
-
this[colorProp] = COLOR[sIdx];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
this.sId = sId;
|
|
24
|
-
this.data = [];
|
|
25
|
-
this.type = 'scatter';
|
|
26
|
-
this.realTimeScatter = realTimeScatter;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Draw series data
|
|
31
|
-
* @param {object} param object for drawing series data
|
|
32
|
-
*
|
|
33
|
-
* @returns {undefined}
|
|
34
|
-
*/
|
|
35
|
-
draw(param) {
|
|
36
|
-
if (!this.show) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (this.realTimeScatter) {
|
|
41
|
-
this.realTimeScatterDraw(param);
|
|
42
|
-
} else {
|
|
43
|
-
this.defaultScatterDraw(param);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Calculate opacity for a data item in the series.
|
|
49
|
-
* @param {object} param - The parameter object passed to the draw function.
|
|
50
|
-
* @param {string} colorStr - The color string of the item.
|
|
51
|
-
* @param {number} dataIndex - The index of the item in the data array.
|
|
52
|
-
*
|
|
53
|
-
* @returns {number} - The calculated opacity level for the item.
|
|
54
|
-
*/
|
|
55
|
-
getOpacity(param, colorStr, dataIndex) {
|
|
56
|
-
const noneDownplayOpacity = colorStr.includes('rgba') ? Util.getOpacity(colorStr) : 1;
|
|
57
|
-
let isDownplay = false;
|
|
58
|
-
|
|
59
|
-
const { selectInfo, legendHitInfo } = param;
|
|
60
|
-
if (legendHitInfo) {
|
|
61
|
-
isDownplay = legendHitInfo.sId !== this.sId;
|
|
62
|
-
} else if (selectInfo) {
|
|
63
|
-
isDownplay = selectInfo?.seriesID !== this.sId || selectInfo?.dataIndex !== dataIndex;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return isDownplay ? 0.1 : noneDownplayOpacity;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Calculate x and y coordinates for a data item in the series.
|
|
71
|
-
* @param {object} item - The data item for which coordinates are to be calculated.
|
|
72
|
-
* @param {object} param - The parameter object passed to the draw function.
|
|
73
|
-
*
|
|
74
|
-
* @returns {undefined}
|
|
75
|
-
*/
|
|
76
|
-
calcItem(item, param) {
|
|
77
|
-
const { chartRect, labelOffset, axesSteps, displayOverflow } = param;
|
|
78
|
-
|
|
79
|
-
let aliasPixel;
|
|
80
|
-
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
81
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
82
|
-
|
|
83
|
-
const xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
|
|
84
|
-
const yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
|
|
85
|
-
const xsp = chartRect.x1 + labelOffset.left;
|
|
86
|
-
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
87
|
-
|
|
88
|
-
let x = Canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
89
|
-
const y = Canvas.calculateY(
|
|
90
|
-
displayOverflow && item.y > minmaxY.graphMax
|
|
91
|
-
? minmaxY.graphMax
|
|
92
|
-
: item.y,
|
|
93
|
-
minmaxY.graphMin,
|
|
94
|
-
minmaxY.graphMax,
|
|
95
|
-
yArea,
|
|
96
|
-
ysp,
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if (x !== null) {
|
|
100
|
-
aliasPixel = Util.aliasPixel(x);
|
|
101
|
-
x += aliasPixel;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
item.xp = x;
|
|
105
|
-
item.yp = y;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Draw default scatter chart
|
|
110
|
-
* @param {object} param - The parameter object passed to the draw function.
|
|
111
|
-
*
|
|
112
|
-
* @returns {undefined}
|
|
113
|
-
*/
|
|
114
|
-
defaultScatterDraw(param) {
|
|
115
|
-
const { ctx, axesSteps, duple, legendHitInfo, coordinateDedupe } = param;
|
|
116
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
117
|
-
|
|
118
|
-
// Adjusted because Real Time Scatter is drawn from the back.
|
|
119
|
-
for (let i = 0; i < this.data.length; i++) {
|
|
120
|
-
const item = this.data[i];
|
|
121
|
-
const idx = i;
|
|
122
|
-
const isDedupeOn = coordinateDedupe !== false;
|
|
123
|
-
let shouldDraw;
|
|
124
|
-
if (legendHitInfo) {
|
|
125
|
-
shouldDraw = (legendHitInfo.sId === this.sId);
|
|
126
|
-
} else if (isDedupeOn) {
|
|
127
|
-
shouldDraw = duple.get(`${item.x}${item.y}`) === this.sId;
|
|
128
|
-
} else {
|
|
129
|
-
shouldDraw = true;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (shouldDraw) {
|
|
133
|
-
this.calcItem(item, param);
|
|
134
|
-
|
|
135
|
-
if (item.xp !== null && item.yp !== null) {
|
|
136
|
-
const overflowColor = item.y > minmaxY.graphMax && this.overflowColor;
|
|
137
|
-
const color = overflowColor || item.dataColor || this.color;
|
|
138
|
-
ctx.strokeStyle = Util.colorStringToRgba(color, this.getOpacity(param, color, idx));
|
|
139
|
-
|
|
140
|
-
const pointFillColor = item.dataColor || this.pointFill;
|
|
141
|
-
ctx.fillStyle = Util.colorStringToRgba(
|
|
142
|
-
pointFillColor,
|
|
143
|
-
this.getOpacity(param, pointFillColor, idx),
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, item.xp, item.yp);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Draw real time scatter chart
|
|
154
|
-
* @param {object} param - The parameter object passed to the draw function.
|
|
155
|
-
*
|
|
156
|
-
* @returns {undefined}
|
|
157
|
-
*/
|
|
158
|
-
realTimeScatterDraw(param) {
|
|
159
|
-
const { ctx, axesSteps, duple, legendHitInfo, coordinateDedupe } = param;
|
|
160
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
161
|
-
const pointStyle = typeof this.pointStyle === 'string' ? this.pointStyle : this.pointStyle.value;
|
|
162
|
-
const pointSize = typeof this.pointSize === 'number' ? this.pointSize : this.pointSize.value;
|
|
163
|
-
|
|
164
|
-
for (let i = 0; i < this.data[this.sId]?.dataGroup?.length; i++) {
|
|
165
|
-
for (let j = 0; j < this.data[this.sId]?.dataGroup[i]?.data.length; j++) {
|
|
166
|
-
const item = this.data[this.sId]?.dataGroup[i]?.data[j];
|
|
167
|
-
|
|
168
|
-
const isDedupeOnRT = coordinateDedupe !== false;
|
|
169
|
-
let shouldDraw;
|
|
170
|
-
if (legendHitInfo) {
|
|
171
|
-
shouldDraw = (legendHitInfo.sId === this.sId);
|
|
172
|
-
} else if (isDedupeOnRT) {
|
|
173
|
-
shouldDraw = duple.get(`${item.x}${item.y}`) === this.sId;
|
|
174
|
-
} else {
|
|
175
|
-
shouldDraw = true;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (shouldDraw) {
|
|
179
|
-
this.calcItem(item, param);
|
|
180
|
-
|
|
181
|
-
if (item.xp !== null && item.yp !== null) {
|
|
182
|
-
const overflowColor = item.y > minmaxY.graphMax && this.overflowColor;
|
|
183
|
-
const baseStrokeColor = overflowColor || item.color || this.color;
|
|
184
|
-
const baseFillColor = overflowColor || item.color || this.pointFill || this.color;
|
|
185
|
-
|
|
186
|
-
const strokeOpacity = this.getOpacity(param, baseStrokeColor, j);
|
|
187
|
-
const fillOpacity = this.getOpacity(param, baseFillColor, j);
|
|
188
|
-
|
|
189
|
-
ctx.strokeStyle = Util.colorStringToRgba(baseStrokeColor, strokeOpacity);
|
|
190
|
-
ctx.fillStyle = Util.colorStringToRgba(baseFillColor, fillOpacity);
|
|
191
|
-
|
|
192
|
-
Canvas.drawPoint(ctx, pointStyle, pointSize, item.xp, item.yp);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Filters and returns data items based on input coordinates
|
|
201
|
-
*
|
|
202
|
-
* @param {Array} data - The data to filter
|
|
203
|
-
* @param {number} xsp - Start X coordinate
|
|
204
|
-
* @param {number} ysp - Start Y coordinate
|
|
205
|
-
* @param {number} xep - End X coordinate
|
|
206
|
-
* @param {number} yep - End Y coordinate
|
|
207
|
-
* @returns {Array} Filtered data items
|
|
208
|
-
*/
|
|
209
|
-
findItemsInRange(data, xsp, ysp, xep, yep) {
|
|
210
|
-
return data.filter(seriesData =>
|
|
211
|
-
(xsp - 1 <= seriesData.xp && seriesData.xp <= xep + 1
|
|
212
|
-
&& ysp - 1 <= seriesData.yp && seriesData.yp <= yep + 1));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
defaultScatterFindItems(gdata, xsp, ysp, xep, yep) {
|
|
216
|
-
return this.findItemsInRange(gdata, xsp, ysp, xep, yep);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
realTimeScatterFindItems(gdata, xsp, ysp, xep, yep) {
|
|
220
|
-
const items = [];
|
|
221
|
-
for (let i = 0; i < gdata[this.sId].dataGroup.length; i++) {
|
|
222
|
-
const obj = gdata[this.sId].dataGroup[i];
|
|
223
|
-
items.push(...this.findItemsInRange(obj.data, xsp, ysp, xep, yep));
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return items;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
*Returns items in range
|
|
231
|
-
* @param {object} params range values
|
|
232
|
-
*
|
|
233
|
-
* @returns {array}
|
|
234
|
-
*/
|
|
235
|
-
findItems({ xsp, ysp, width, height }) {
|
|
236
|
-
const gdata = this.data;
|
|
237
|
-
const xep = xsp + width;
|
|
238
|
-
const yep = ysp + height;
|
|
239
|
-
let items = [];
|
|
240
|
-
|
|
241
|
-
if (this.realTimeScatter) {
|
|
242
|
-
items = this.realTimeScatterFindItems(gdata, xsp, ysp, xep, yep);
|
|
243
|
-
} else {
|
|
244
|
-
items = this.defaultScatterFindItems(gdata, xsp, ysp, xep, yep);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return items;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Draw item highlight
|
|
252
|
-
* @param {object} item object for drawing series data
|
|
253
|
-
* @param {object} context canvas context
|
|
254
|
-
* @param {boolean} isMax determines if this series has max value
|
|
255
|
-
*
|
|
256
|
-
* @returns {undefined}
|
|
257
|
-
*/
|
|
258
|
-
itemHighlight(item, context) {
|
|
259
|
-
const gdata = item.data;
|
|
260
|
-
const ctx = context;
|
|
261
|
-
|
|
262
|
-
const x = gdata.xp;
|
|
263
|
-
const y = gdata.yp;
|
|
264
|
-
|
|
265
|
-
ctx.save();
|
|
266
|
-
if (x !== null && y !== null) {
|
|
267
|
-
const color = gdata.dataColor || this.color;
|
|
268
|
-
const pointFillColor = gdata.dataColor || this.pointFill;
|
|
269
|
-
|
|
270
|
-
ctx.strokeStyle = Util.colorStringToRgba(color, 0);
|
|
271
|
-
|
|
272
|
-
ctx.fillStyle = Util.colorStringToRgba(pointFillColor, this.highlight.maxShadowOpacity);
|
|
273
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.highlight.maxShadowSize, x, y);
|
|
274
|
-
|
|
275
|
-
ctx.fillStyle = color;
|
|
276
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.highlight.maxSize, x, y);
|
|
277
|
-
|
|
278
|
-
ctx.fillStyle = '#fff';
|
|
279
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.highlight.defaultSize, x, y);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
ctx.restore();
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Find graph item for tooltip
|
|
287
|
-
* @param {array} offset mouse position
|
|
288
|
-
*
|
|
289
|
-
* @returns {object} graph item
|
|
290
|
-
*/
|
|
291
|
-
findGraphData(offset) {
|
|
292
|
-
if (this.realTimeScatter) return false;
|
|
293
|
-
|
|
294
|
-
const xp = offset[0];
|
|
295
|
-
const yp = offset[1];
|
|
296
|
-
const item = { data: null, hit: false, color: this.color, index: null };
|
|
297
|
-
const pointSize = this.pointSize;
|
|
298
|
-
const gdata = this.data;
|
|
299
|
-
|
|
300
|
-
const targetIndex = gdata.findIndex((data) => {
|
|
301
|
-
const x = data.xp;
|
|
302
|
-
const y = data.yp;
|
|
303
|
-
|
|
304
|
-
return (x - pointSize <= xp)
|
|
305
|
-
&& (xp <= x + pointSize)
|
|
306
|
-
&& (y - pointSize <= yp)
|
|
307
|
-
&& (yp <= y + pointSize);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
if (targetIndex > -1) {
|
|
311
|
-
item.data = gdata[targetIndex];
|
|
312
|
-
item.index = targetIndex;
|
|
313
|
-
item.hit = true;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return item;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export default Scatter;
|