evui 3.5.0 → 3.5.2
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/index.js +23148 -0
- package/dist/index.umd.cjs +28 -0
- package/package.json +5 -11
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/common/utils.bignumber.js +0 -23
- package/dist/common/utils.debounce.js +0 -66
- package/dist/common/utils.js +0 -64
- package/dist/common/utils.throttle.js +0 -15
- package/dist/components/button/Button.vue.js +0 -65
- package/dist/components/button/index.js +0 -7
- package/dist/components/buttonGroup/ButtonGroup.vue.js +0 -14
- package/dist/components/buttonGroup/index.js +0 -7
- package/dist/components/calendar/Calendar.vue.js +0 -299
- package/dist/components/calendar/index.js +0 -7
- package/dist/components/calendar/uses.js +0 -579
- package/dist/components/chart/Chart.vue.js +0 -261
- package/dist/components/chart/ChartToolbar.vue.js +0 -32
- package/dist/components/chart/chart.core.js +0 -738
- package/dist/components/chart/chartZoom.core.js +0 -221
- package/dist/components/chart/element/element.bar.js +0 -358
- package/dist/components/chart/element/element.bar.time.js +0 -55
- package/dist/components/chart/element/element.heatmap.js +0 -403
- package/dist/components/chart/element/element.line.js +0 -292
- package/dist/components/chart/element/element.pie.js +0 -73
- package/dist/components/chart/element/element.scatter.js +0 -209
- package/dist/components/chart/element/element.tip.js +0 -312
- package/dist/components/chart/helpers/helpers.canvas.js +0 -141
- package/dist/components/chart/helpers/helpers.constant.js +0 -253
- package/dist/components/chart/helpers/helpers.util.js +0 -265
- package/dist/components/chart/index.js +0 -7
- package/dist/components/chart/model/index.js +0 -6
- package/dist/components/chart/model/model.series.js +0 -82
- package/dist/components/chart/model/model.store.js +0 -650
- package/dist/components/chart/plugins/plugins.interaction.js +0 -823
- package/dist/components/chart/plugins/plugins.legend.gradient.js +0 -281
- package/dist/components/chart/plugins/plugins.legend.js +0 -665
- package/dist/components/chart/plugins/plugins.pie.js +0 -86
- package/dist/components/chart/plugins/plugins.scrollbar.js +0 -345
- package/dist/components/chart/plugins/plugins.title.js +0 -43
- package/dist/components/chart/plugins/plugins.tooltip.js +0 -508
- package/dist/components/chart/scale/scale.js +0 -492
- package/dist/components/chart/scale/scale.linear.js +0 -248
- package/dist/components/chart/scale/scale.logarithmic.js +0 -82
- package/dist/components/chart/scale/scale.step.js +0 -227
- package/dist/components/chart/scale/scale.time.category.js +0 -148
- package/dist/components/chart/scale/scale.time.js +0 -95
- package/dist/components/chart/uses.js +0 -479
- package/dist/components/chartBrush/ChartBrush.vue.js +0 -198
- package/dist/components/chartBrush/chartBrush.core.js +0 -265
- package/dist/components/chartBrush/index.js +0 -7
- package/dist/components/chartBrush/uses.js +0 -18
- package/dist/components/chartGroup/ChartGroup.vue.js +0 -128
- package/dist/components/chartGroup/index.js +0 -7
- package/dist/components/chartGroup/uses.js +0 -47
- package/dist/components/checkbox/Checkbox.vue.js +0 -99
- package/dist/components/checkbox/index.js +0 -7
- package/dist/components/checkboxGroup/CheckboxGroup.vue.js +0 -40
- package/dist/components/checkboxGroup/index.js +0 -7
- package/dist/components/contextMenu/ContextMenu.vue.js +0 -70
- package/dist/components/contextMenu/MenuList.vue.js +0 -105
- package/dist/components/contextMenu/index.js +0 -7
- package/dist/components/contextMenu/uses.js +0 -79
- package/dist/components/datePicker/DatePicker.vue.js +0 -310
- package/dist/components/datePicker/index.js +0 -7
- package/dist/components/datePicker/uses.js +0 -190
- package/dist/components/grid/Grid.vue.js +0 -1261
- package/dist/components/grid/GridColumnSetting.vue.js +0 -212
- package/dist/components/grid/GridFilterSetting.vue.js +0 -222
- package/dist/components/grid/GridPagination.vue.js +0 -69
- package/dist/components/grid/GridSummary.vue.js +0 -186
- package/dist/components/grid/GridToolbar.vue.js +0 -15
- package/dist/components/grid/icon/icon-option-button.vue.js +0 -39
- package/dist/components/grid/icon/icon-sort-button.vue.js +0 -56
- package/dist/components/grid/index.js +0 -7
- package/dist/components/grid/uses.js +0 -697
- package/dist/components/icon/Icon.vue.js +0 -50
- package/dist/components/icon/index.js +0 -8
- package/dist/components/inputNumber/InputNumber.vue.js +0 -112
- package/dist/components/inputNumber/index.js +0 -7
- package/dist/components/inputNumber/uses.js +0 -76
- package/dist/components/loading/Loading.vue.js +0 -78
- package/dist/components/loading/index.js +0 -7
- package/dist/components/menu/Menu.vue.js +0 -66
- package/dist/components/menu/MenuItem.vue.js +0 -125
- package/dist/components/menu/index.js +0 -7
- package/dist/components/message/Message.vue.js +0 -122
- package/dist/components/message/index.js +0 -16
- package/dist/components/messageBox/MessageBox.vue.js +0 -216
- package/dist/components/messageBox/index.js +0 -13
- package/dist/components/notification/Notification.vue.js +0 -140
- package/dist/components/notification/index.js +0 -23
- package/dist/components/pagination/Pagination.vue.js +0 -215
- package/dist/components/pagination/index.js +0 -7
- package/dist/components/pagination/pageButton.vue.js +0 -35
- package/dist/components/progress/Progress.vue.js +0 -88
- package/dist/components/progress/index.js +0 -7
- package/dist/components/radio/Radio.vue.js +0 -75
- package/dist/components/radio/index.js +0 -7
- package/dist/components/radioGroup/RadioGroup.vue.js +0 -37
- package/dist/components/radioGroup/index.js +0 -7
- package/dist/components/scheduler/Scheduler.vue.js +0 -128
- package/dist/components/scheduler/index.js +0 -7
- package/dist/components/scheduler/uses.js +0 -73
- package/dist/components/select/Select.vue.js +0 -381
- package/dist/components/select/index.js +0 -7
- package/dist/components/select/uses.js +0 -147
- package/dist/components/slider/Slider.vue.js +0 -243
- package/dist/components/slider/index.js +0 -7
- package/dist/components/slider/uses.js +0 -188
- package/dist/components/tabPanel/TabPanel.vue.js +0 -39
- package/dist/components/tabPanel/index.js +0 -7
- package/dist/components/tabs/Tabs.vue.js +0 -220
- package/dist/components/tabs/index.js +0 -7
- package/dist/components/textField/TextField.vue.js +0 -209
- package/dist/components/textField/index.js +0 -7
- package/dist/components/timePicker/TimePicker.vue.js +0 -227
- package/dist/components/timePicker/index.js +0 -7
- package/dist/components/toggle/Toggle.vue.js +0 -66
- package/dist/components/toggle/index.js +0 -7
- package/dist/components/tree/Tree.vue.js +0 -220
- package/dist/components/tree/TreeNode.vue.js +0 -146
- package/dist/components/tree/index.js +0 -7
- package/dist/components/treeGrid/TreeGrid.vue.js +0 -898
- package/dist/components/treeGrid/TreeGridNode.vue.js +0 -274
- package/dist/components/treeGrid/TreeGridToolbar.vue.js +0 -15
- package/dist/components/treeGrid/index.js +0 -7
- package/dist/components/treeGrid/uses.js +0 -497
- package/dist/components/window/Window.vue.js +0 -211
- package/dist/components/window/index.js +0 -7
- package/dist/components/window/uses.js +0 -345
- package/dist/directives/clickoutside.js +0 -47
- package/dist/main.js +0 -142
- package/dist/package.json.js +0 -4
- package/dist/resolver.js +0 -17
|
@@ -1,823 +0,0 @@
|
|
|
1
|
-
import { inRange as w, cloneDeep as T, isEqual as A, defaultsDeep as O, isNil as V } from "lodash-es";
|
|
2
|
-
import R from "dayjs";
|
|
3
|
-
import { numberWithComma as C } from "../../../common/utils.js";
|
|
4
|
-
import P from "../../../common/utils.throttle.js";
|
|
5
|
-
const z = {
|
|
6
|
-
/**
|
|
7
|
-
* Hide legend components by manipulating css
|
|
8
|
-
*
|
|
9
|
-
* @returns {undefined}
|
|
10
|
-
*/
|
|
11
|
-
createEventFunctions() {
|
|
12
|
-
var o, l, i, n;
|
|
13
|
-
this.onMouseMove = (t) => {
|
|
14
|
-
var m, I;
|
|
15
|
-
if ((m = this.dragInfo) != null && m.isMove || this.isMobile)
|
|
16
|
-
return;
|
|
17
|
-
const e = { e: t }, { indicator: s, tooltip: r, type: c } = this.options, h = this.getMousePosition(t), a = this.findHitItem(h);
|
|
18
|
-
r != null && r.showAllValueInRange && (a != null && a.items) && this.addNotHitInfo(a);
|
|
19
|
-
const b = this.overlayCtx;
|
|
20
|
-
if (this.overlayClear(), Object.keys(a.items).length) {
|
|
21
|
-
if (r.use && this.isInitTooltip)
|
|
22
|
-
if (this.drawItemsHighlight(a, b), typeof (r == null ? void 0 : r.returnValue) == "function") {
|
|
23
|
-
const d = [];
|
|
24
|
-
Object.keys(a.items).forEach((p) => {
|
|
25
|
-
d.push({
|
|
26
|
-
sId: p,
|
|
27
|
-
data: a.items[p].data,
|
|
28
|
-
color: a.items[p].color,
|
|
29
|
-
name: a.items[p].name,
|
|
30
|
-
dataId: a.items[p].id,
|
|
31
|
-
index: a.items[p].index
|
|
32
|
-
});
|
|
33
|
-
}), this.hideTooltipDOM(), r.returnValue(d, t);
|
|
34
|
-
} else (I = r == null ? void 0 : r.formatter) != null && I.html ? (this.drawCustomTooltip(a == null ? void 0 : a.items), this.setCustomTooltipLayoutPosition(a, t)) : (this.setTooltipLayoutPosition(a, t), c === "scatter" ? this.drawTooltipForScatter(a, this.tooltipCtx) : c === "heatMap" ? this.drawToolTipForHeatMap(a, this.tooltipCtx) : this.drawTooltip(a, this.tooltipCtx));
|
|
35
|
-
const u = Object.values(this.seriesList || {}).some(
|
|
36
|
-
(d) => d.type === "line"
|
|
37
|
-
);
|
|
38
|
-
if (r.use && (c === "line" || u)) {
|
|
39
|
-
const d = this.drawIndicatorForTooltip(a, s.color), p = d == null ? void 0 : d.labelValue, y = this.getTimeLabel(h);
|
|
40
|
-
e.hoveredLabel = {
|
|
41
|
-
horizontal: this.options.horizontal,
|
|
42
|
-
label: y,
|
|
43
|
-
mousePosition: [t.clientX, t.clientY],
|
|
44
|
-
dataLabel: p
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
} else r.use && this.isInitTooltip && (typeof (r == null ? void 0 : r.returnValue) == "function" && r.returnValue([], t), this.hideTooltipDOM());
|
|
48
|
-
if (this.dragInfoBackup && this.drawSelectionArea(this.dragInfoBackup), !e.hoveredLabel && !this.isNotUseIndicator()) {
|
|
49
|
-
const u = Object.values(this.seriesList || {}).some(
|
|
50
|
-
(p) => p.type === "line"
|
|
51
|
-
);
|
|
52
|
-
(c !== "line" && !u || !r.use || !Object.keys(a.items).length) && this.drawIndicator(h, s.color);
|
|
53
|
-
const d = this.getTimeLabel(h);
|
|
54
|
-
e.hoveredLabel = {
|
|
55
|
-
horizontal: this.options.horizontal,
|
|
56
|
-
label: d,
|
|
57
|
-
mousePosition: [t.clientX, t.clientY]
|
|
58
|
-
};
|
|
59
|
-
} else e.hoveredLabel || (e.hoveredLabel = {
|
|
60
|
-
label: ""
|
|
61
|
-
});
|
|
62
|
-
typeof this.listeners["mouse-move"] == "function" && (c !== "pie" && (e.curMouseTargetVal = this.getCurMouseTargetVal(h, a)), this.listeners["mouse-move"](e));
|
|
63
|
-
}, this.onMouseLeave = (t) => {
|
|
64
|
-
const { tooltip: e, dragSelection: s } = this.options;
|
|
65
|
-
e.throttledMove && this.onMouseMove.cancel(), (!s.use || !s.keepDisplay) && this.overlayClear(), e.use && this.isInitTooltip && (typeof (e == null ? void 0 : e.returnValue) == "function" && e.returnValue([], t), this.tooltipClear()), this.listeners["mouse-leave"]();
|
|
66
|
-
}, this.onDblClick = (t) => {
|
|
67
|
-
const e = { e: t }, s = this.getMousePosition(t), {
|
|
68
|
-
type: r,
|
|
69
|
-
selectItem: c,
|
|
70
|
-
selectLabel: h,
|
|
71
|
-
selectSeries: a
|
|
72
|
-
} = this.options, b = (c == null ? void 0 : c.use) && (c == null ? void 0 : c.useClick), m = (h == null ? void 0 : h.use) && (h == null ? void 0 : h.useClick), I = (a == null ? void 0 : a.use) && (a == null ? void 0 : a.useClick);
|
|
73
|
-
b ? e.eventTarget = "item" : m ? e.eventTarget = "label" : I && (e.eventTarget = "series");
|
|
74
|
-
const u = () => {
|
|
75
|
-
var x, M;
|
|
76
|
-
const y = this.findHitItem(s), f = y.hitId || Object.keys(y.items)[0], g = y.items[f];
|
|
77
|
-
g && (e.label = g.label, e.value = (x = g.data) == null ? void 0 : x.o, e.seriesId = f, e.dataIndex = g.index, e.acc = (M = g.data) == null ? void 0 : M.acc);
|
|
78
|
-
}, d = (y) => {
|
|
79
|
-
var L, v;
|
|
80
|
-
const f = this.findHitItem(s), g = f.hitId || Object.keys(f.items)[0], x = f.items[g], { labelIndex: M } = this.getLabelInfoByPosition(s, y), { dataIndex: S } = this.regulateSelectedLabelInfo(
|
|
81
|
-
M,
|
|
82
|
-
y
|
|
83
|
-
);
|
|
84
|
-
this.defaultSelectInfo = this.getSelectedLabelInfoWithLabelData(S, y), x && (e.label = x.label, e.seriesId = g, e.value = (L = x.data) == null ? void 0 : L.o, e.acc = (v = x.data) == null ? void 0 : v.acc, e.dataIndex = x.index);
|
|
85
|
-
}, p = () => {
|
|
86
|
-
var x, M, S;
|
|
87
|
-
const y = this.findHitItem(s), f = y.hitId || Object.keys(y.items)[0], g = y.items[f];
|
|
88
|
-
if (f !== null) {
|
|
89
|
-
const L = this.updateSelectedSeriesInfo(f, !0);
|
|
90
|
-
g && (e.label = g.label, e.value = (x = g.data) == null ? void 0 : x.o, e.seriesId = (M = L.seriesId) == null ? void 0 : M.at(0), e.acc = (S = g.data) == null ? void 0 : S.acc, e.dataIndex = g.index);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
switch (r) {
|
|
94
|
-
case "bar": {
|
|
95
|
-
m ? d(this.options.horizontal ? "yAxis" : "xAxis") : u();
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
case "line": {
|
|
99
|
-
b ? u() : m ? d() : I && p();
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
default: {
|
|
103
|
-
u();
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
typeof this.listeners["dbl-click"] == "function" && this.listeners["dbl-click"](e);
|
|
108
|
-
}, this.onClick = (t) => {
|
|
109
|
-
var y;
|
|
110
|
-
if (this.isMouseMove) {
|
|
111
|
-
this.isMouseMove = !1;
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const e = { e: t }, s = this.getMousePosition(t), {
|
|
115
|
-
type: r,
|
|
116
|
-
selectItem: c,
|
|
117
|
-
selectLabel: h,
|
|
118
|
-
selectSeries: a
|
|
119
|
-
} = this.options, b = (c == null ? void 0 : c.use) && (c == null ? void 0 : c.useClick), m = (h == null ? void 0 : h.use) && (h == null ? void 0 : h.useClick), I = (a == null ? void 0 : a.use) && (a == null ? void 0 : a.useClick), u = () => {
|
|
120
|
-
const f = this.getItemByPosition(s, !1);
|
|
121
|
-
({
|
|
122
|
-
label: e.label,
|
|
123
|
-
value: e.value,
|
|
124
|
-
sId: e.seriesId,
|
|
125
|
-
maxIndex: e.dataIndex,
|
|
126
|
-
acc: e.acc
|
|
127
|
-
} = f), f != null && f.sId && (e.selected = {
|
|
128
|
-
eventTarget: "item",
|
|
129
|
-
seriesId: this.isDeselectItem(f) ? null : f.sId,
|
|
130
|
-
dataIndex: this.isDeselectItem(f) ? null : f.maxIndex
|
|
131
|
-
});
|
|
132
|
-
}, d = (f) => {
|
|
133
|
-
var M, S, L, v;
|
|
134
|
-
const { labelIndex: g } = this.getLabelInfoByPosition(s, f), { dataIndex: x } = this.regulateSelectedLabelInfo(
|
|
135
|
-
g,
|
|
136
|
-
f
|
|
137
|
-
);
|
|
138
|
-
this.defaultSelectInfo = this.getSelectedLabelInfoWithLabelData(x, f), f && (this.defaultSelectInfo.targetAxis = x != null && x.length ? f : null), e.selected = {
|
|
139
|
-
eventTarget: "label",
|
|
140
|
-
...T(this.defaultSelectInfo)
|
|
141
|
-
}, e.label = (S = (M = this.defaultSelectInfo) == null ? void 0 : M.label) == null ? void 0 : S.at(0), e.dataIndex = (v = (L = this.defaultSelectInfo) == null ? void 0 : L.dataIndex) == null ? void 0 : v.at(0);
|
|
142
|
-
}, p = () => {
|
|
143
|
-
const f = this.findHitItem(s), g = f.hitId || Object.keys(f.items)[0], x = f.items[g];
|
|
144
|
-
if (!V(g)) {
|
|
145
|
-
const M = this.updateSelectedSeriesInfo(g, !1);
|
|
146
|
-
this.defaultSelectInfo.seriesId = M.seriesId, e.selected = {
|
|
147
|
-
eventTarget: "series",
|
|
148
|
-
...T(this.defaultSelectInfo)
|
|
149
|
-
}, e.label = x.label, e.dataIndex = x.index;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
switch (r) {
|
|
153
|
-
default:
|
|
154
|
-
case "bar": {
|
|
155
|
-
b ? u() : m && d(this.options.horizontal ? "yAxis" : "xAxis");
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
case "line": {
|
|
159
|
-
b ? u() : m ? d() : I && p();
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
case "heatMap": {
|
|
163
|
-
const f = !!this.options.horizontal;
|
|
164
|
-
if (b && m) {
|
|
165
|
-
const { useBothAxis: g } = h, x = this.getCurMouseLocation(s);
|
|
166
|
-
if (x === "chartBackground")
|
|
167
|
-
this.clearSelectedLabelInfo(), e.deselected = { eventTarget: "label" }, u();
|
|
168
|
-
else if (x === "yAxis" || x === "xAxis") {
|
|
169
|
-
if (this.clearSelectedItemInfo(), e.deselected = { eventTarget: "item" }, !g && x !== (f ? "yAxis" : "xAxis"))
|
|
170
|
-
return;
|
|
171
|
-
d(x);
|
|
172
|
-
}
|
|
173
|
-
} else if (b)
|
|
174
|
-
u();
|
|
175
|
-
else if (m) {
|
|
176
|
-
const { useBothAxis: g } = h, x = this.getCurMouseLocation(s);
|
|
177
|
-
if ((x === "yAxis" || x === "xAxis") && !g && x !== (f ? "yAxis" : "xAxis"))
|
|
178
|
-
return;
|
|
179
|
-
x !== "canvas" && d(g ? x : null);
|
|
180
|
-
}
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
case "pie": {
|
|
184
|
-
b && u();
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
case "scatter": {
|
|
188
|
-
if (b && u(), (y = this.options.dragSelection) != null && y.use && this.isMobile) {
|
|
189
|
-
let f = this.setTouchInfo(t);
|
|
190
|
-
this.overlayClear(), this.options.dragSelection.keepDisplay && (t.layerX < f.range.x1 || t.layerY < f.range.y1 || t.layerX > f.range.x2 || t.layerY > f.range.y2) ? this.isTouchOverlay = !1 : (f = this.setTouchBoxDimensions(f), this.isTouchOverlay = !0, this.drawSelectionArea(f)), this.options.dragSelection.keepDisplay || setTimeout(() => {
|
|
191
|
-
this.isTouchOverlay = !1, this.overlayClear();
|
|
192
|
-
}, 100), e.e = t, e.touchInfo = f, e.data = this.findSelectedItems(f), e.range = this.getSelectionRange(f), typeof this.listeners["drag-select"] == "function" && this.listeners["drag-select"](e);
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
typeof this.listeners.click == "function" && (this.dragInfoBackup || this.listeners.click(e));
|
|
198
|
-
}, this.onMouseDown = (t) => {
|
|
199
|
-
const { dragSelection: e, type: s } = this.options;
|
|
200
|
-
e.use && (s === "scatter" || s === "line" || s === "heatMap") && (this.removeSelectionArea(), this.dragStart(t, s));
|
|
201
|
-
}, this.onWheel = (t) => {
|
|
202
|
-
var r, c, h;
|
|
203
|
-
const e = ((c = (r = this.tooltipDOM) == null ? void 0 : r.style) == null ? void 0 : c.display) === "block", s = (h = this.tooltipDOM) == null ? void 0 : h.querySelector(this.options.tooltip.htmlScrollTarget);
|
|
204
|
-
(e || s && s.scrollHeight > s.clientHeight) && (t.preventDefault(), e && (this.tooltipBodyDOM.scrollTop += t.deltaY), s && (s.scrollTop += t.deltaY));
|
|
205
|
-
}, (l = (o = this.options) == null ? void 0 : o.tooltip) != null && l.useScrollbar && this.overlayCanvas.addEventListener("wheel", this.onWheel, { passive: !1 }), (n = (i = this.options) == null ? void 0 : i.tooltip) != null && n.throttledMove && (this.onMouseMove = P(this.onMouseMove, 30)), this.overlayCanvas.addEventListener("mousemove", this.onMouseMove), this.overlayCanvas.addEventListener("mouseleave", this.onMouseLeave), this.overlayCanvas.addEventListener("dblclick", this.onDblClick), this.overlayCanvas.addEventListener("click", this.onClick), this.overlayCanvas.addEventListener("mousedown", this.onMouseDown), this.dragTouchSelectionEvent = (t) => this.dragTouchSelectionDestroy(t), window.addEventListener("click", this.dragTouchSelectionEvent);
|
|
206
|
-
},
|
|
207
|
-
/**
|
|
208
|
-
* Start drag-move when the mouse pointer is in the graph
|
|
209
|
-
*
|
|
210
|
-
* @returns {undefined}
|
|
211
|
-
*/
|
|
212
|
-
dragStart(o, l) {
|
|
213
|
-
let [i, n] = this.getMousePosition(o);
|
|
214
|
-
const t = this.chartRect, e = this.labelOffset, s = {
|
|
215
|
-
x1: t.x1 + e.left,
|
|
216
|
-
x2: t.x2 - e.right,
|
|
217
|
-
y1: t.y1 + e.top,
|
|
218
|
-
y2: t.y2 - e.bottom
|
|
219
|
-
};
|
|
220
|
-
i < s.x1 && (i = s.x1), i > s.x2 && (i = s.x2), n < s.y1 && (n = s.y1), n > s.y2 && (n = s.y2), this.dragInfo = {
|
|
221
|
-
xcp: i,
|
|
222
|
-
ycp: n,
|
|
223
|
-
range: s
|
|
224
|
-
};
|
|
225
|
-
const r = (h) => {
|
|
226
|
-
h.preventDefault();
|
|
227
|
-
const [a, b] = this.getMousePosition(h), m = this.dragInfo, { xcp: I, ycp: u, range: d } = m;
|
|
228
|
-
let p, y;
|
|
229
|
-
if (m.isMove = !0, this.isMouseMove = !0, a < d.x1 ? p = d.x1 : a > d.x2 ? p = d.x2 : p = a, b < d.y1 ? y = s.y1 : b > d.y2 ? y = d.y2 : y = b, l === "heatMap") {
|
|
230
|
-
const f = { xcp: I, xep: p, ycp: u, yep: y, range: d }, { xsp: g, ysp: x, width: M, height: S } = this.getDragInfoForHeatMap(f);
|
|
231
|
-
m.xsp = g, m.ysp = x, m.width = M, m.height = S;
|
|
232
|
-
} else
|
|
233
|
-
m.xsp = Math.min(I, p), m.ysp = l === "scatter" ? Math.min(u, y) : d.y1, m.width = Math.ceil(Math.abs(p - I)), m.height = l === "scatter" ? Math.ceil(Math.abs(y - u)) : d.y2 - d.y1;
|
|
234
|
-
this.overlayClear(), this.drawSelectionArea(m);
|
|
235
|
-
}, c = (h) => {
|
|
236
|
-
var b, m;
|
|
237
|
-
const a = this.dragInfo;
|
|
238
|
-
if (a != null && a.isMove && (a == null ? void 0 : a.width) > 1 && (a == null ? void 0 : a.height) > 1) {
|
|
239
|
-
const I = {
|
|
240
|
-
e: h,
|
|
241
|
-
data: this.findSelectedItems(a),
|
|
242
|
-
range: l === "heatMap" ? this.getSelectionRangeForHeatMap(a) : this.getSelectionRange(a)
|
|
243
|
-
};
|
|
244
|
-
if (this.dragInfoBackup = O({}, a), typeof this.listeners["drag-select"] == "function" && !((m = (b = this.options) == null ? void 0 : b.zoom) != null && m.use))
|
|
245
|
-
this.listeners["drag-select"](I);
|
|
246
|
-
else {
|
|
247
|
-
const { xsp: u, range: d, width: p } = a, y = u - d.x1;
|
|
248
|
-
I.range.dragSelectionInfo = {
|
|
249
|
-
dragXsp: y,
|
|
250
|
-
dragXep: y + p,
|
|
251
|
-
exceptAxesYChartWidth: d.x2 - d.x1,
|
|
252
|
-
exceptAxesXChartHeight: d.y2 - d.y1,
|
|
253
|
-
chartRange: d,
|
|
254
|
-
chartTitle: this.options.title.text
|
|
255
|
-
}, this.options.zoom.getRangeInfo(I);
|
|
256
|
-
}
|
|
257
|
-
this.options.dragSelection.keepDisplay || this.removeSelectionArea();
|
|
258
|
-
}
|
|
259
|
-
this.dragInfo = null, window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", c);
|
|
260
|
-
};
|
|
261
|
-
window.addEventListener("mousemove", r), window.addEventListener("mouseup", c);
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* Draw selection-area
|
|
265
|
-
*
|
|
266
|
-
* @returns {undefined}
|
|
267
|
-
*/
|
|
268
|
-
drawSelectionArea({ xsp: o, ysp: l, width: i, height: n, range: t }) {
|
|
269
|
-
const e = this.overlayCtx, { fillColor: s, opacity: r } = this.options.dragSelection, c = this.chartRect, h = this.labelOffset, a = {
|
|
270
|
-
x1: c.x1 + h.left,
|
|
271
|
-
x2: c.x2 - h.right,
|
|
272
|
-
y1: c.y1 + h.top,
|
|
273
|
-
y2: c.y2 - h.bottom
|
|
274
|
-
};
|
|
275
|
-
if (e.fillStyle = s, e.globalAlpha = r, A(a, t))
|
|
276
|
-
e.fillRect(o, l, i, n);
|
|
277
|
-
else {
|
|
278
|
-
const b = t.x2 - t.x1, m = t.y2 - t.y1, I = a.x2 - a.x1, u = a.y2 - a.y1, d = (o - t.x1) / b, p = (l - t.y1) / m, y = a.x1 + I * d, f = a.y1 + u * p, g = i / b, x = n / m, M = I * g, S = u * x;
|
|
279
|
-
e.fillRect(y, f, M, S);
|
|
280
|
-
}
|
|
281
|
-
e.globalAlpha = 1;
|
|
282
|
-
},
|
|
283
|
-
/** Remove drag selection area
|
|
284
|
-
*
|
|
285
|
-
*/
|
|
286
|
-
removeSelectionArea() {
|
|
287
|
-
this.dragInfoBackup = null, this.overlayClear();
|
|
288
|
-
},
|
|
289
|
-
/**
|
|
290
|
-
* Computing mouse position on canvas
|
|
291
|
-
*
|
|
292
|
-
* @returns {array} mouse pointer position
|
|
293
|
-
*/
|
|
294
|
-
getMousePosition(o) {
|
|
295
|
-
const l = o.originalEvent || o, i = this.overlayCanvas.getBoundingClientRect();
|
|
296
|
-
return [l.clientX - i.left, l.clientY - i.top, i.width, i.height];
|
|
297
|
-
},
|
|
298
|
-
/**
|
|
299
|
-
* Get current mouse target value on canvas
|
|
300
|
-
* @param {array} offset return value from getMousePosition()
|
|
301
|
-
* @param {object} hitInfo return value from findHitItem()
|
|
302
|
-
*
|
|
303
|
-
* @returns {object} current mouse target value
|
|
304
|
-
*/
|
|
305
|
-
getCurMouseTargetVal(o, l) {
|
|
306
|
-
const i = this.getCurMouseLocation(o), n = {
|
|
307
|
-
location: i,
|
|
308
|
-
labelIdx: -1,
|
|
309
|
-
labelVal: "",
|
|
310
|
-
dataIdx: -1,
|
|
311
|
-
maxDataVal: "",
|
|
312
|
-
originVal: ""
|
|
313
|
-
};
|
|
314
|
-
if (i === "chartBackground") {
|
|
315
|
-
const { maxHighlight: t, items: e } = l;
|
|
316
|
-
if (t != null && t.length) {
|
|
317
|
-
const [s, r] = t;
|
|
318
|
-
e[s] && (n.dataIdx = e[s].index, n.maxDataVal = r, n.originVal = l);
|
|
319
|
-
}
|
|
320
|
-
} else if (i === "xAxis" || i === "yAxis") {
|
|
321
|
-
const { axesX: t, axesY: e } = this.options, s = (c, h, a) => {
|
|
322
|
-
n.labelIdx = h, n.labelVal = c[0].type === "time" ? R(a).format(c[0].timeFormat) : a, n.originVal = c[0].type === "time" ? R(a) : a;
|
|
323
|
-
};
|
|
324
|
-
((c) => {
|
|
325
|
-
const { labelIndex: h } = this.getLabelInfoByPosition(o, i), { labelVal: a, labelIdx: b } = this.getCurMouseLabelVal(c, o, h);
|
|
326
|
-
s(c === "xAxis" ? t : e, b, a);
|
|
327
|
-
})(i);
|
|
328
|
-
}
|
|
329
|
-
return n;
|
|
330
|
-
},
|
|
331
|
-
/**
|
|
332
|
-
* Processes touch event to determine touch position within the chart.
|
|
333
|
-
*
|
|
334
|
-
* @param {TouchEvent} event - the touch event to process
|
|
335
|
-
* @returns {object} - the processed touch information
|
|
336
|
-
*/
|
|
337
|
-
setTouchInfo(o) {
|
|
338
|
-
let [l, i] = this.getMousePosition(o);
|
|
339
|
-
const n = this.chartRect, t = this.labelOffset, e = {
|
|
340
|
-
x1: n.x1 + t.left,
|
|
341
|
-
x2: n.x2 - t.right,
|
|
342
|
-
y1: n.y1 + t.top,
|
|
343
|
-
y2: n.y2 - t.bottom
|
|
344
|
-
};
|
|
345
|
-
return l = Math.max(e.x1, Math.min(l, e.x2)), i = Math.max(e.y1, Math.min(i, e.y2)), {
|
|
346
|
-
xcp: l,
|
|
347
|
-
ycp: i,
|
|
348
|
-
range: e
|
|
349
|
-
};
|
|
350
|
-
},
|
|
351
|
-
/**
|
|
352
|
-
* Adjusts the touch box dimensions based on the provided touch information.
|
|
353
|
-
*
|
|
354
|
-
* @param {object} touchInfo - The touch information including touch position and plotting range
|
|
355
|
-
* @returns {object} - The adjusted touch information
|
|
356
|
-
*/
|
|
357
|
-
setTouchBoxDimensions(o) {
|
|
358
|
-
var a;
|
|
359
|
-
const l = ((a = this.options.dragSelection) == null ? void 0 : a.size) || 50, i = l / 2, { xcp: n, ycp: t, range: e } = o;
|
|
360
|
-
let s = n - i, r = t - i, c = l, h = l;
|
|
361
|
-
return this.boxOverflow = {
|
|
362
|
-
x1: !1,
|
|
363
|
-
x2: !1,
|
|
364
|
-
y1: !1,
|
|
365
|
-
y2: !1
|
|
366
|
-
}, n < e.x1 + i && (s = e.x1, c = i - (e.x1 - n), this.boxOverflow.x1 = !0), n > e.x2 - i && (c = i - (n - e.x2), this.boxOverflow.x2 = !0), t < e.y1 + i && (r = e.y1, h = i - (e.y1 - t), this.boxOverflow.y1 = !0), t > e.y2 - i && (h = i - (t - e.y2), this.boxOverflow.y2 = !0), o.xsp = s, o.ysp = r, o.width = c, o.height = h, o;
|
|
367
|
-
},
|
|
368
|
-
/**
|
|
369
|
-
* Remove a touch selection.
|
|
370
|
-
*
|
|
371
|
-
* @param {TouchEvent} e - the touch event to process
|
|
372
|
-
* @returns {undefined}
|
|
373
|
-
*/
|
|
374
|
-
dragTouchSelectionDestroy(o) {
|
|
375
|
-
var l;
|
|
376
|
-
(l = this.options.dragSelection) != null && l.use && o.target !== this.overlayCanvas && this.isTouchOverlay && (this.isTouchOverlay = !1, this.overlayClear());
|
|
377
|
-
},
|
|
378
|
-
/**
|
|
379
|
-
* Find graph item on mouse position
|
|
380
|
-
* @param {number[]} offset return value from getMousePosition()
|
|
381
|
-
*
|
|
382
|
-
* @returns {{
|
|
383
|
-
* items: Record<string, {
|
|
384
|
-
* data: any,
|
|
385
|
-
* hit: boolean,
|
|
386
|
-
* color: string,
|
|
387
|
-
* name: string,
|
|
388
|
-
* id: string,
|
|
389
|
-
* index: number,
|
|
390
|
-
* label: string | import('dayjs').Dayjs,
|
|
391
|
-
* axis: { x: number, y: number },
|
|
392
|
-
* }>,
|
|
393
|
-
* hitId: string | null,
|
|
394
|
-
* maxTip: [string, string],
|
|
395
|
-
* maxHighlight: [string, number] | null,
|
|
396
|
-
* }} hit item information
|
|
397
|
-
*/
|
|
398
|
-
findHitItem(o) {
|
|
399
|
-
var d, p;
|
|
400
|
-
const l = Object.keys(this.seriesList), i = {}, n = !!this.options.horizontal, t = this.tooltipCtx;
|
|
401
|
-
let e = null, s = "", r = 0, c = "", h = null, a = null, b = 1 / 0;
|
|
402
|
-
const m = this.findClosestDataIndex(o, l);
|
|
403
|
-
if (m === -1 && !this.isNotUseIndicator())
|
|
404
|
-
return { items: i, hitId: e, maxTip: [s, c], maxHighlight: null };
|
|
405
|
-
const I = l.every((y) => this.seriesList[y].type === "bar");
|
|
406
|
-
for (let y = 0; y < l.length; y++) {
|
|
407
|
-
const f = l[y], g = this.seriesList[f];
|
|
408
|
-
if (g.findGraphData && g.show) {
|
|
409
|
-
const x = g.findGraphData(o, n, m, !I);
|
|
410
|
-
if (x != null && x.data) {
|
|
411
|
-
let M;
|
|
412
|
-
if (x.data.o === null && g.interpolation !== "zero" ? g.isExistGrp || (M = n ? x.data.x : x.data.y) : isNaN(x.data.o) || (M = x.data.o), M != null) {
|
|
413
|
-
const S = this.getFormattedTooltipLabel({
|
|
414
|
-
dataId: g.id,
|
|
415
|
-
seriesId: f,
|
|
416
|
-
seriesName: g.name,
|
|
417
|
-
itemData: x.data
|
|
418
|
-
}), L = t ? t.measureText(S).width : 1;
|
|
419
|
-
x.id = g.id, x.name = S, x.axis = { x: g.xAxisIndex, y: g.yAxisIndex }, x.label = n ? (d = x.data) == null ? void 0 : d.y : (p = x.data) == null ? void 0 : p.x, i[f] = x;
|
|
420
|
-
const v = this.getFormattedTooltipValue({
|
|
421
|
-
dataId: g.id,
|
|
422
|
-
seriesId: f,
|
|
423
|
-
seriesName: S,
|
|
424
|
-
value: M,
|
|
425
|
-
itemData: x.data
|
|
426
|
-
});
|
|
427
|
-
if (x.data.formatted = v, r < L && (s = S, r = L), c.length <= `${v}`.length && (c = `${v}`), (h === null || h <= M) && (h = M, a = f), x.hit && x.data.xp !== void 0 && x.data.yp !== void 0) {
|
|
428
|
-
const k = (x.data.xp - o[0]) ** 2 + (x.data.yp - o[1]) ** 2;
|
|
429
|
-
k < b && (b = k, e = f);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
return e = e === null ? Object.keys(i)[0] : e, { items: i, hitId: e, maxTip: [s, c], maxHighlight: h !== null ? [a, h] : null };
|
|
436
|
-
},
|
|
437
|
-
/**
|
|
438
|
-
* Find the closest data index (label) based on mouse position
|
|
439
|
-
* @param {array} offset mouse position
|
|
440
|
-
* @param {array} sIds series IDs
|
|
441
|
-
* @returns {number} closest data index
|
|
442
|
-
*/
|
|
443
|
-
findClosestDataIndex(o, l) {
|
|
444
|
-
var b;
|
|
445
|
-
const [i, n] = o, t = !!this.options.horizontal, e = t ? n : i, s = l.find((m) => {
|
|
446
|
-
var I;
|
|
447
|
-
return (I = this.seriesList[m]) == null ? void 0 : I.show;
|
|
448
|
-
});
|
|
449
|
-
if (!s || !((b = this.seriesList[s]) != null && b.data))
|
|
450
|
-
return -1;
|
|
451
|
-
const r = this.seriesList[s].data;
|
|
452
|
-
let c = 50;
|
|
453
|
-
if (r.length > 1) {
|
|
454
|
-
const m = [];
|
|
455
|
-
for (let I = 1; I < r.length; I++) {
|
|
456
|
-
const u = r[I - 1], d = r[I];
|
|
457
|
-
if (u && d) {
|
|
458
|
-
let p, y;
|
|
459
|
-
t ? (p = u.h ? u.yp + u.h / 2 : u.yp, y = d.h ? d.yp + d.h / 2 : d.yp) : (p = u.w ? u.xp + u.w / 2 : u.xp, y = d.w ? d.xp + d.w / 2 : d.xp), p !== null && y !== null && m.push(Math.abs(y - p));
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
m.length > 0 && (c = m.reduce((I, u) => I + u, 0) / m.length);
|
|
463
|
-
}
|
|
464
|
-
let h = 1 / 0, a = -1;
|
|
465
|
-
for (let m = 0; m < r.length; m++)
|
|
466
|
-
if (l.some((u) => {
|
|
467
|
-
var p, y, f, g;
|
|
468
|
-
const d = this.seriesList[u];
|
|
469
|
-
return (d == null ? void 0 : d.show) && ((y = (p = d.data) == null ? void 0 : p[m]) == null ? void 0 : y.o) !== null && ((g = (f = d.data) == null ? void 0 : f[m]) == null ? void 0 : g.o) !== void 0;
|
|
470
|
-
})) {
|
|
471
|
-
const u = r[m];
|
|
472
|
-
if (u) {
|
|
473
|
-
let d;
|
|
474
|
-
if (t ? d = u.h ? u.yp + u.h / 2 : u.yp : d = u.w ? u.xp + u.w / 2 : u.xp, d !== null) {
|
|
475
|
-
const p = Math.abs(e - d);
|
|
476
|
-
p < h && (h = p, a = m);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return h >= c ? l.some((I) => {
|
|
481
|
-
const u = this.seriesList[I];
|
|
482
|
-
if (u != null && u.show) {
|
|
483
|
-
const d = u.passingValue, p = u.interpolation, y = u.hasPassingValueInData;
|
|
484
|
-
return p === "linear" || p === "none" && !!d && y;
|
|
485
|
-
}
|
|
486
|
-
return !1;
|
|
487
|
-
}) ? a : -1 : a;
|
|
488
|
-
},
|
|
489
|
-
/**
|
|
490
|
-
* get formatted label for tooltip
|
|
491
|
-
* @param dataId
|
|
492
|
-
* @param seriesId
|
|
493
|
-
* @param seriesName
|
|
494
|
-
* @param itemData
|
|
495
|
-
* @returns {string}
|
|
496
|
-
*/
|
|
497
|
-
getFormattedTooltipLabel({ dataId: o, seriesId: l, seriesName: i, itemData: n }) {
|
|
498
|
-
var c;
|
|
499
|
-
const e = this.options.tooltip, s = (c = e == null ? void 0 : e.formatter) == null ? void 0 : c.label;
|
|
500
|
-
let r = i;
|
|
501
|
-
return s && (r = s({
|
|
502
|
-
dataId: o,
|
|
503
|
-
seriesId: l,
|
|
504
|
-
seriesName: i,
|
|
505
|
-
itemData: n
|
|
506
|
-
})), r;
|
|
507
|
-
},
|
|
508
|
-
/**
|
|
509
|
-
* get formatted value for tooltip
|
|
510
|
-
* @param dataId
|
|
511
|
-
* @param seriesId
|
|
512
|
-
* @param seriesName
|
|
513
|
-
* @param value
|
|
514
|
-
* @param itemData
|
|
515
|
-
* @returns {string}
|
|
516
|
-
*/
|
|
517
|
-
getFormattedTooltipValue({ dataId: o, seriesId: l, seriesName: i, value: n, itemData: t }) {
|
|
518
|
-
var a;
|
|
519
|
-
const e = this.options, s = !!e.horizontal, r = e.tooltip, c = typeof (r == null ? void 0 : r.formatter) == "function" ? r == null ? void 0 : r.formatter : (a = r == null ? void 0 : r.formatter) == null ? void 0 : a.value;
|
|
520
|
-
let h = n;
|
|
521
|
-
return c && (e.type === "pie" ? h = c({
|
|
522
|
-
value: n,
|
|
523
|
-
name: i,
|
|
524
|
-
percentage: t == null ? void 0 : t.percentage,
|
|
525
|
-
seriesId: l,
|
|
526
|
-
dataId: o
|
|
527
|
-
}) : e.type === "heatMap" ? h = c({
|
|
528
|
-
x: t == null ? void 0 : t.x,
|
|
529
|
-
y: t == null ? void 0 : t.y,
|
|
530
|
-
value: n > -1 ? n : "error",
|
|
531
|
-
seriesId: l,
|
|
532
|
-
dataId: o
|
|
533
|
-
}) : h = c({
|
|
534
|
-
x: s ? n : t == null ? void 0 : t.x,
|
|
535
|
-
y: s ? t == null ? void 0 : t.y : n,
|
|
536
|
-
o: t == null ? void 0 : t.o,
|
|
537
|
-
name: i,
|
|
538
|
-
seriesId: l,
|
|
539
|
-
dataId: o
|
|
540
|
-
})), n && (!c || typeof h != "string") && (e.type === "heatMap" ? h = n < 0 ? "error" : C(n) : h = C(n)), h;
|
|
541
|
-
},
|
|
542
|
-
/**
|
|
543
|
-
* add not hit info
|
|
544
|
-
* @param hitInfo
|
|
545
|
-
*/
|
|
546
|
-
addNotHitInfo(o) {
|
|
547
|
-
var c, h, a, b, m, I;
|
|
548
|
-
const l = this.tooltipCtx, i = !!this.options.horizontal, n = Object.keys(o.items)[0], t = i ? (a = (h = (c = o.items) == null ? void 0 : c[n]) == null ? void 0 : h.data) == null ? void 0 : a.y : (I = (m = (b = o.items) == null ? void 0 : b[n]) == null ? void 0 : m.data) == null ? void 0 : I.x;
|
|
549
|
-
let e = "", s = "";
|
|
550
|
-
const r = Object.keys(this.seriesList);
|
|
551
|
-
for (let u = 0; u < r.length; u++) {
|
|
552
|
-
const d = r[u], p = this.seriesList[d];
|
|
553
|
-
if (p != null && p.show) {
|
|
554
|
-
const y = p.data.find(
|
|
555
|
-
(v) => i ? (v == null ? void 0 : v.y) === t : (v == null ? void 0 : v.x) === t
|
|
556
|
-
), f = this.getFormattedTooltipLabel({
|
|
557
|
-
dataId: p.id,
|
|
558
|
-
seriesId: d,
|
|
559
|
-
seriesName: p.name,
|
|
560
|
-
itemData: y
|
|
561
|
-
}), g = this.getFormattedTooltipValue({
|
|
562
|
-
dataId: p.id,
|
|
563
|
-
seriesId: d,
|
|
564
|
-
seriesName: f,
|
|
565
|
-
value: y == null ? void 0 : y.o,
|
|
566
|
-
itemData: y
|
|
567
|
-
});
|
|
568
|
-
if (y && y.o !== null && y.o !== void 0 && !o.items[d]) {
|
|
569
|
-
const v = {};
|
|
570
|
-
v.color = p.color, v.hit = !1, v.name = f, v.axis = { x: p.xAxisIndex, y: p.yAxisIndex }, v.index = i ? p.yAxisIndex : p.xAxisIndex, v.data = y, v.data.formatted = g, o.items[d] = v;
|
|
571
|
-
}
|
|
572
|
-
const x = l ? l.measureText(e).width : 1, M = l ? l.measureText(f).width : 1;
|
|
573
|
-
x < M && (e = f);
|
|
574
|
-
const S = l ? l.measureText(s).width : 1, L = l ? l.measureText(`${g}`).width : 1;
|
|
575
|
-
S < L && (s = `${g}`);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
o.maxTip = [e, s];
|
|
579
|
-
},
|
|
580
|
-
/**
|
|
581
|
-
* Select Item
|
|
582
|
-
* Set backup data that selected item information
|
|
583
|
-
* render chart
|
|
584
|
-
* @param targetInfo {object} '{ dataIndex: number, seriesID: string }'
|
|
585
|
-
* @param chartType {string} 'bar', 'line', 'pie', 'scatter', 'heatMap'
|
|
586
|
-
*
|
|
587
|
-
*/
|
|
588
|
-
selectItemByData(o, l) {
|
|
589
|
-
this.defaultSelectItemInfo = o;
|
|
590
|
-
let i;
|
|
591
|
-
l === "pie" ? i = {
|
|
592
|
-
type: "pie",
|
|
593
|
-
sId: o.seriesID
|
|
594
|
-
} : i = isNaN(o == null ? void 0 : o.dataIndex) ? null : this.getItem(o, !1), this.render(i);
|
|
595
|
-
},
|
|
596
|
-
/**
|
|
597
|
-
* Select Label
|
|
598
|
-
* set backup data that selected label information list
|
|
599
|
-
* render chart
|
|
600
|
-
* @param labelIndexList {number[]}
|
|
601
|
-
* @param targetAxis {string | null}
|
|
602
|
-
* @returns {boolean}
|
|
603
|
-
*/
|
|
604
|
-
selectLabelByData(o, l) {
|
|
605
|
-
this.defaultSelectInfo = this.getSelectedLabelInfoWithLabelData(o, l), this.render();
|
|
606
|
-
},
|
|
607
|
-
/**
|
|
608
|
-
* Select Series
|
|
609
|
-
* set backup data that selected series information list
|
|
610
|
-
* render chart
|
|
611
|
-
* @param seriesIdList {number[]}
|
|
612
|
-
* @returns {boolean}
|
|
613
|
-
*/
|
|
614
|
-
selectSeriesByData(o) {
|
|
615
|
-
this.defaultSelectInfo.seriesId = o, this.render();
|
|
616
|
-
},
|
|
617
|
-
/**
|
|
618
|
-
* Get each series data and label text
|
|
619
|
-
* @param labelIndexList{number[]}
|
|
620
|
-
* @param targetAxis{string | null}
|
|
621
|
-
* @returns {object[]}
|
|
622
|
-
*/
|
|
623
|
-
getSelectedLabelInfoWithLabelData(o, l) {
|
|
624
|
-
const { selectLabel: i, type: n, horizontal: t } = this.options, e = T(this.defaultSelectInfo);
|
|
625
|
-
switch (e.dataIndex = o, n) {
|
|
626
|
-
default:
|
|
627
|
-
case "bar":
|
|
628
|
-
case "line": {
|
|
629
|
-
e.dataIndex.splice(i.limit), e.label = e.dataIndex.map((r) => this.data.labels[r]);
|
|
630
|
-
const s = Object.entries(this.data.data);
|
|
631
|
-
e.data = e.dataIndex.map(
|
|
632
|
-
(r) => Object.fromEntries(s.map(([c, h]) => [c, h[r]]))
|
|
633
|
-
);
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
case "heatMap": {
|
|
637
|
-
const { limit: s, useBothAxis: r } = this.options.selectLabel;
|
|
638
|
-
e.dataIndex.splice(s);
|
|
639
|
-
let c;
|
|
640
|
-
r ? c = l === "yAxis" ? "y" : "x" : c = t ? "y" : "x", e.label = e.dataIndex.map((a) => this.data.labels[c][a]);
|
|
641
|
-
const h = Object.values(this.data.data)[0];
|
|
642
|
-
e.data = h.filter(
|
|
643
|
-
({ x: a, y: b }) => e.label.includes(c === "y" ? b : a)
|
|
644
|
-
);
|
|
645
|
-
break;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
return e;
|
|
649
|
-
},
|
|
650
|
-
/**
|
|
651
|
-
* Add or delete selected label index, according to policy and option
|
|
652
|
-
* @param labelIndex {number}
|
|
653
|
-
* @param targetAxis {string | null}
|
|
654
|
-
* @returns after {number[]} '[0, 1 ...]' result Label index List
|
|
655
|
-
*/
|
|
656
|
-
regulateSelectedLabelInfo(o, l) {
|
|
657
|
-
var e, s;
|
|
658
|
-
const i = ((e = this.options) == null ? void 0 : e.selectLabel) ?? {}, n = l === null || ((s = this.defaultSelectInfo) == null ? void 0 : s.targetAxis) === l ? { ...this.defaultSelectInfo, targetAxis: l } : { dataIndex: [], targetAxis: l }, t = T(n);
|
|
659
|
-
if (n.dataIndex.includes(o)) {
|
|
660
|
-
const r = n.dataIndex.indexOf(o);
|
|
661
|
-
t.dataIndex.splice(r, 1);
|
|
662
|
-
} else o > -1 && (t.dataIndex.push(o), i.limit > 0 && i.limit < t.dataIndex.length && (i.useDeselectOverflow ? t.dataIndex.splice(0, 1) : t.dataIndex.pop()));
|
|
663
|
-
return t;
|
|
664
|
-
},
|
|
665
|
-
/**
|
|
666
|
-
* Add or delete selected series Index,according to policy and option
|
|
667
|
-
* @param seriesId {number}
|
|
668
|
-
* @param keepSelection {boolean}
|
|
669
|
-
* @returns after {number[]} '[0, 1 ...]' result series Id List
|
|
670
|
-
*/
|
|
671
|
-
updateSelectedSeriesInfo(o, l) {
|
|
672
|
-
var e;
|
|
673
|
-
const i = ((e = this.options) == null ? void 0 : e.selectSeries) ?? {}, n = this.defaultSelectInfo ?? { seriesId: [] };
|
|
674
|
-
typeof n.seriesId == "string" && (n.seriesId = [n.seriesId]);
|
|
675
|
-
const t = T(n);
|
|
676
|
-
if (n.seriesId.includes(o)) {
|
|
677
|
-
if (!l) {
|
|
678
|
-
const s = n.seriesId.indexOf(o);
|
|
679
|
-
t.seriesId.splice(s, 1);
|
|
680
|
-
}
|
|
681
|
-
} else o && (t.seriesId.push(o), i.limit > 0 && i.limit < t.seriesId.length && (i.useDeselectOverflow ? t.seriesId.splice(0, 1) : t.seriesId.pop()));
|
|
682
|
-
return t;
|
|
683
|
-
},
|
|
684
|
-
/**
|
|
685
|
-
* Draw indicator at the label position when tooltip is displayed
|
|
686
|
-
* @param {object} hitInfo hit item information from findHitItem
|
|
687
|
-
* @param {string} color indicator color
|
|
688
|
-
* @returns {object|null} indicator position info with actual label value
|
|
689
|
-
*/
|
|
690
|
-
drawIndicatorForTooltip(o, l) {
|
|
691
|
-
var h;
|
|
692
|
-
if (!(o != null && o.items) || !Object.keys(o.items).length)
|
|
693
|
-
return null;
|
|
694
|
-
const i = this.overlayCtx, { horizontal: n } = this.options, t = {
|
|
695
|
-
x1: this.chartRect.x1 + this.labelOffset.left,
|
|
696
|
-
x2: this.chartRect.x2 - this.labelOffset.right,
|
|
697
|
-
y1: this.chartRect.y1 + this.labelOffset.top,
|
|
698
|
-
y2: this.chartRect.y2 - this.labelOffset.bottom
|
|
699
|
-
}, e = Object.keys(o.items)[0], s = o.items[e];
|
|
700
|
-
if (!(s != null && s.data))
|
|
701
|
-
return null;
|
|
702
|
-
const r = n ? s.data.y : s.data.x;
|
|
703
|
-
let c;
|
|
704
|
-
if (n) {
|
|
705
|
-
const a = s.data.yp + (s.data.h ? s.data.h / 2 : 0);
|
|
706
|
-
c = [t.x1, a];
|
|
707
|
-
} else
|
|
708
|
-
c = [s.data.xp + (s.data.w ? s.data.w / 2 : 0), t.y1];
|
|
709
|
-
return i.beginPath(), i.save(), i.strokeStyle = l, i.lineWidth = 1, (h = this.options.indicator) != null && h.segments && i.setLineDash(this.options.indicator.segments), n ? (i.moveTo(t.x1, c[1] + 0.5), i.lineTo(t.x2, c[1] + 0.5)) : (i.moveTo(c[0] + 0.5, t.y1), i.lineTo(c[0] + 0.5, t.y2)), i.stroke(), i.restore(), i.closePath(), {
|
|
710
|
-
labelValue: r,
|
|
711
|
-
position: c
|
|
712
|
-
};
|
|
713
|
-
},
|
|
714
|
-
/**
|
|
715
|
-
* Find items by series within a range
|
|
716
|
-
* @param {object} range object for find series items
|
|
717
|
-
*
|
|
718
|
-
* @returns {object}
|
|
719
|
-
*/
|
|
720
|
-
findSelectedItems(o) {
|
|
721
|
-
const l = [], i = Object.keys(this.seriesList);
|
|
722
|
-
for (let n = 0; n < i.length; n++) {
|
|
723
|
-
const t = i[n], e = this.seriesList[t], s = e.findItems;
|
|
724
|
-
if (s) {
|
|
725
|
-
const r = s.call(e, o);
|
|
726
|
-
r && r.length && l.push({
|
|
727
|
-
seriesName: e.name,
|
|
728
|
-
seriesId: t,
|
|
729
|
-
items: r
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
return l;
|
|
734
|
-
},
|
|
735
|
-
/**
|
|
736
|
-
* Returns the data-based range value for a selection
|
|
737
|
-
* @param {object} object for calculating data-based range
|
|
738
|
-
* object.range: coordinate-based range in graph
|
|
739
|
-
* @returns {object}
|
|
740
|
-
*/
|
|
741
|
-
getSelectionRange({ xsp: o, ysp: l, width: i, height: n, range: t }) {
|
|
742
|
-
var g, x, M, S;
|
|
743
|
-
const e = this.axesSteps.x.length ? this.axesSteps.x[0] : null, s = this.axesSteps.y.length ? this.axesSteps.y[0] : null;
|
|
744
|
-
if (!e || !s)
|
|
745
|
-
return null;
|
|
746
|
-
const r = o + i, c = l + n, h = e.graphMax - e.graphMin, a = s.graphMax - s.graphMin, b = this.getRatioInRange(t.x1, t.x2, o), m = this.getRatioInRange(t.x1, t.x2, r), I = this.getRatioInRange(t.y1, t.y2, c), u = this.getRatioInRange(t.y1, t.y2, l), d = this.isMobile && ((g = this.boxOverflow) != null && g.x1) ? Math.min(this.minMax.x[0].min, e.graphMin) : Math.max(e.graphMin + h * b, e.graphMin), p = this.isMobile && ((x = this.boxOverflow) != null && x.x2) ? Math.max(this.minMax.x[0].max, e.graphMax) : Math.min(e.graphMin + h * m, e.graphMax), y = this.isMobile && ((M = this.boxOverflow) != null && M.y2) ? Math.min(this.minMax.y[0].min, s.graphMin) : Math.max(s.graphMin + a * (1 - I), s.graphMin), f = this.isMobile && ((S = this.boxOverflow) != null && S.y1) ? Math.max(this.minMax.y[0].max, s.graphMax) : Math.min(s.graphMin + a * (1 - u), s.graphMax);
|
|
747
|
-
return {
|
|
748
|
-
xMin: +d.toFixed(3),
|
|
749
|
-
xMax: +p.toFixed(3),
|
|
750
|
-
yMin: +y.toFixed(3),
|
|
751
|
-
yMax: +f.toFixed(3)
|
|
752
|
-
};
|
|
753
|
-
},
|
|
754
|
-
/**
|
|
755
|
-
* Returns the position ratio of 'value' between 'min' and 'max'
|
|
756
|
-
* @param {number} min min value
|
|
757
|
-
* @param {number} max max value
|
|
758
|
-
* @param {number} value value is between min and max
|
|
759
|
-
*
|
|
760
|
-
* @returns {number}
|
|
761
|
-
*/
|
|
762
|
-
getRatioInRange(o, l, i) {
|
|
763
|
-
const n = l - o;
|
|
764
|
-
return (i - o) / n;
|
|
765
|
-
},
|
|
766
|
-
getDragInfoForHeatMap(o) {
|
|
767
|
-
const l = Object.keys(this.seriesList)[0];
|
|
768
|
-
return this.seriesList[l].findBlockRange(o);
|
|
769
|
-
},
|
|
770
|
-
getSelectionRangeForHeatMap(o) {
|
|
771
|
-
const l = this.axesSteps.x.length ? this.axesSteps.x[0] : null, i = this.axesSteps.y.length ? this.axesSteps.y[0] : null;
|
|
772
|
-
if (!l || !i)
|
|
773
|
-
return null;
|
|
774
|
-
const n = Object.keys(this.seriesList)[0], { xMin: t, xMax: e, yMin: s, yMax: r } = this.seriesList[n].findSelectionRange(o) ?? {};
|
|
775
|
-
return {
|
|
776
|
-
xMin: t ?? l.graphMin,
|
|
777
|
-
xMax: e ?? l.graphMax,
|
|
778
|
-
yMin: s ?? i.graphMin,
|
|
779
|
-
yMax: r ?? i.graphMax
|
|
780
|
-
};
|
|
781
|
-
},
|
|
782
|
-
/**
|
|
783
|
-
* Check hitInfo is deselected Item through re-click
|
|
784
|
-
* @param hitInfo
|
|
785
|
-
* @returns {boolean}
|
|
786
|
-
*/
|
|
787
|
-
isDeselectItem(o) {
|
|
788
|
-
var l, i;
|
|
789
|
-
return this.options.selectItem.useDeselectItem && (o == null ? void 0 : o.maxIndex) === ((l = this.defaultSelectItemInfo) == null ? void 0 : l.dataIndex) && (o == null ? void 0 : o.sId) === ((i = this.defaultSelectItemInfo) == null ? void 0 : i.seriesID) && !isNaN(o == null ? void 0 : o.maxIndex);
|
|
790
|
-
},
|
|
791
|
-
/**
|
|
792
|
-
* Get current mouse location (xAxis, yAxis, chartBackground, canvas)
|
|
793
|
-
* @param offset
|
|
794
|
-
* @returns {string}
|
|
795
|
-
*/
|
|
796
|
-
getCurMouseLocation(o) {
|
|
797
|
-
const [l, i] = o, n = {
|
|
798
|
-
x1: this.chartRect.x1 + this.labelOffset.left,
|
|
799
|
-
x2: this.chartRect.x2 - this.labelOffset.right,
|
|
800
|
-
y1: this.chartRect.y1 + this.labelOffset.top,
|
|
801
|
-
y2: this.chartRect.y2 - this.labelOffset.bottom
|
|
802
|
-
}, t = n[this.axesX[0].units.rectStart], e = n[this.axesX[0].units.rectEnd], s = n[this.axesY[0].units.rectStart], r = n[this.axesY[0].units.rectEnd];
|
|
803
|
-
return w(l, this.chartRect.x1, n.x1) && w(i, s, r) ? "yAxis" : w(l, t, e) && w(i, n.y2, this.chartRect.y2) ? "xAxis" : w(l, n.x1, n.x2) && w(i, n.y1, n.y2) ? "chartBackground" : "canvas";
|
|
804
|
-
},
|
|
805
|
-
isNotUseIndicator() {
|
|
806
|
-
return this.options.type === "pie" || this.options.type === "scatter" || this.options.type === "heatMap";
|
|
807
|
-
},
|
|
808
|
-
/**
|
|
809
|
-
* Clear 'defaultSelectInfo'
|
|
810
|
-
*/
|
|
811
|
-
clearSelectedLabelInfo() {
|
|
812
|
-
this.defaultSelectInfo = { dataIndex: [] };
|
|
813
|
-
},
|
|
814
|
-
/**
|
|
815
|
-
* Clear 'defaultSelectItemInfo'
|
|
816
|
-
*/
|
|
817
|
-
clearSelectedItemInfo() {
|
|
818
|
-
this.defaultSelectItemInfo = null;
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
export {
|
|
822
|
-
z as default
|
|
823
|
-
};
|