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,248 +0,0 @@
|
|
|
1
|
-
import { truthyNumber as I } from "../../../common/utils.js";
|
|
2
|
-
import F from "./scale.js";
|
|
3
|
-
import P from "../helpers/helpers.util.js";
|
|
4
|
-
import { NICE_FRACTIONS as y } from "../helpers/helpers.constant.js";
|
|
5
|
-
class j extends F {
|
|
6
|
-
/**
|
|
7
|
-
* Transforming label by designated format
|
|
8
|
-
* @param {number} value label value
|
|
9
|
-
* @param {object} data data for formatting
|
|
10
|
-
*
|
|
11
|
-
* @returns {string} formatted label
|
|
12
|
-
*/
|
|
13
|
-
getTruthyValue(t) {
|
|
14
|
-
const e = this.adjustedDecimalPoint ?? this.decimalPoint;
|
|
15
|
-
return I(t) ? Number(t.toFixed(e)) : t;
|
|
16
|
-
}
|
|
17
|
-
getLabelFormat(t, e = {}) {
|
|
18
|
-
if (this.formatter) {
|
|
19
|
-
const s = this.getTruthyValue(t), a = this.formatter(s, {
|
|
20
|
-
...e,
|
|
21
|
-
prevOriginalValue: e == null ? void 0 : e.prev,
|
|
22
|
-
prevDecimalPointValue: this.getTruthyValue(e == null ? void 0 : e.prev),
|
|
23
|
-
currentOriginalValue: t,
|
|
24
|
-
currentDecimalPointValue: s
|
|
25
|
-
});
|
|
26
|
-
if (typeof a == "string")
|
|
27
|
-
return a;
|
|
28
|
-
}
|
|
29
|
-
const i = this.adjustedDecimalPoint ?? this.decimalPoint;
|
|
30
|
-
return P.labelSignFormat(t, i);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Calculate interval
|
|
34
|
-
* @param {object} range range information
|
|
35
|
-
*
|
|
36
|
-
* @returns {number} interval (한 칸에 표시할 값의 간격)
|
|
37
|
-
*/
|
|
38
|
-
getInterval(t) {
|
|
39
|
-
if (this.interval) return this.interval;
|
|
40
|
-
let e = 0;
|
|
41
|
-
const i = t.maxValue, s = t.minValue, a = t.maxSteps;
|
|
42
|
-
if (!a || a <= 0) return 0;
|
|
43
|
-
if (this.startToZero && s < 0) {
|
|
44
|
-
const n = Math.abs(s) + Math.abs(i), c = Math.abs(s) / n, b = Math.abs(i) / n;
|
|
45
|
-
let g = Math.max(1, Math.round(c * a)), p = Math.max(1, a - g);
|
|
46
|
-
g + p > a && (c > b ? g -= 1 : p -= 1), e = Math.max(
|
|
47
|
-
Math.abs(s) / (g || 1),
|
|
48
|
-
Math.abs(i) / (p || 1)
|
|
49
|
-
);
|
|
50
|
-
} else
|
|
51
|
-
e = (i - s) / a;
|
|
52
|
-
return this.decimalPoint ? e : Math.ceil(e);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 주어진 값에 대한 적절한 간격을 계산합니다.
|
|
56
|
-
* @param value - 계산할 값 (양수, 음수 모두 가능)
|
|
57
|
-
* @returns 계산된 간격 값 (유효하지 않은 경우 0 반환)
|
|
58
|
-
*/
|
|
59
|
-
getNiceInterval(t) {
|
|
60
|
-
if (!Number.isFinite(t) || t === 0) return 0;
|
|
61
|
-
const e = Math.abs(t), i = Math.floor(Math.log10(e)), s = e / 10 ** i;
|
|
62
|
-
let a = 10;
|
|
63
|
-
for (let c = 0; c < y.length; c++)
|
|
64
|
-
if (y[c] >= s) {
|
|
65
|
-
a = y[c];
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
const n = a * 10 ** i;
|
|
69
|
-
return t < 0 ? -n : n;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* user range를 사용하지 않을때 nice scale 계산
|
|
73
|
-
* graph MIN / MAX 를 조정할 수 있다.
|
|
74
|
-
* @param {number} max
|
|
75
|
-
* @param {number} min
|
|
76
|
-
* @param {number} maxSteps
|
|
77
|
-
* @returns {object}
|
|
78
|
-
*/
|
|
79
|
-
getStepsWithNiceScale({ max: t, min: e, maxSteps: i }) {
|
|
80
|
-
let s = t, a = e, n = 0, c = 0, b = 1 / 0;
|
|
81
|
-
const g = Math.max(1, i - 1), p = i + 1;
|
|
82
|
-
for (let u = g; u <= p; u++) {
|
|
83
|
-
const M = (t - e) / u, f = this.getNiceInterval(M);
|
|
84
|
-
if (f > 0) {
|
|
85
|
-
const v = Math.floor(e / f) * f, x = v + f * u;
|
|
86
|
-
if (x >= t) {
|
|
87
|
-
const S = e - v, d = x - t, o = S + d;
|
|
88
|
-
o < b && (s = x, a = v, n = f, c = u, b = o);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (!(n > 0) || c <= 0) {
|
|
93
|
-
const u = Math.max(1, i), M = (t - e) / u || 1;
|
|
94
|
-
return {
|
|
95
|
-
max: t,
|
|
96
|
-
min: e,
|
|
97
|
-
interval: M,
|
|
98
|
-
steps: u
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
max: s,
|
|
103
|
-
min: a,
|
|
104
|
-
interval: n,
|
|
105
|
-
steps: c
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* graphRange와 step 수를 기반으로 필요한 소수점 자릿수를 계산
|
|
110
|
-
* @param {object} params
|
|
111
|
-
* @param {number} params.graphRange
|
|
112
|
-
* @param {number} params.numberOfSteps
|
|
113
|
-
* @returns {number} decimal places (0 이상)
|
|
114
|
-
*/
|
|
115
|
-
getDecimalPointFromRange({ graphRange: t, numberOfSteps: e }) {
|
|
116
|
-
if (!Number.isFinite(t) || !Number.isFinite(e) || t <= 0 || e <= 0)
|
|
117
|
-
return 0;
|
|
118
|
-
const i = t / e;
|
|
119
|
-
if (!Number.isFinite(i) || i === 0)
|
|
120
|
-
return 0;
|
|
121
|
-
const s = Math.abs(i);
|
|
122
|
-
if (s >= 1)
|
|
123
|
-
return 0;
|
|
124
|
-
let a = 0, n = s;
|
|
125
|
-
for (; n < 1 && a < 10; )
|
|
126
|
-
n *= 10, a += 1;
|
|
127
|
-
return a;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* With range information, calculate how many labels in axis
|
|
131
|
-
* @param {object} range min/max information
|
|
132
|
-
*
|
|
133
|
-
* @returns {object} steps, interval, min/max graph value
|
|
134
|
-
*/
|
|
135
|
-
calculateSteps(t) {
|
|
136
|
-
const { minValue: e, maxValue: i } = t, s = Math.max(1, t.maxSteps ?? 1), a = Array.isArray(this.range) && this.range.length === 2, c = typeof this.interval == "number" || typeof this.interval == "object" && this.interval !== null ? this.getInterval(t) : null, b = c != null && c > 0 && Number.isFinite(c), g = a ? +this.range[0] : null, p = a ? +this.range[1] : null, u = 1e-10, M = (o, h, r) => {
|
|
137
|
-
var m;
|
|
138
|
-
if (this.decimalPoint === "auto") {
|
|
139
|
-
const l = (m = this.getDecimalPointFromRange) == null ? void 0 : m.call(this, {
|
|
140
|
-
graphRange: o,
|
|
141
|
-
numberOfSteps: h
|
|
142
|
-
});
|
|
143
|
-
l != null && !Number.isNaN(l) ? this.adjustedDecimalPoint = l : typeof this.getAutoDecimalPointFromInterval == "function" ? this.adjustedDecimalPoint = this.getAutoDecimalPointFromInterval(r) : this.adjustedDecimalPoint = 0;
|
|
144
|
-
} else
|
|
145
|
-
this.adjustedDecimalPoint = this.decimalPoint;
|
|
146
|
-
}, f = (o, h) => Math.max(1, Math.round(o / h + u)), v = ({ min: o, max: h, interval: r }) => {
|
|
147
|
-
let m = 0, l = 0;
|
|
148
|
-
return o >= 0 ? (m = +o, l = Math.ceil(h / r) * r) : h >= 0 ? (m = Math.floor(o / r) * r, l = Math.ceil(h / r) * r) : (l = +h, m = Math.floor(o / r) * r), { graphMin: m, graphMax: l };
|
|
149
|
-
};
|
|
150
|
-
if (a && b) {
|
|
151
|
-
const o = g, h = p, r = c, m = h - o, l = m / r;
|
|
152
|
-
if (Math.abs(l - Math.round(l)) < u || this.fixedSteps) {
|
|
153
|
-
const V = Math.round(l);
|
|
154
|
-
return M(m, V, r), {
|
|
155
|
-
steps: V,
|
|
156
|
-
interval: r,
|
|
157
|
-
graphMin: o,
|
|
158
|
-
graphMax: h
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (a) {
|
|
163
|
-
const o = g, h = p, r = h - o, m = s, l = r / m;
|
|
164
|
-
return M(r, m, l), {
|
|
165
|
-
steps: m,
|
|
166
|
-
interval: l,
|
|
167
|
-
graphMin: o,
|
|
168
|
-
graphMax: h
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
if (b) {
|
|
172
|
-
let o = c, h = 0, r = 0, m = 0, l = 0;
|
|
173
|
-
for ({ graphMin: h, graphMax: r } = v({
|
|
174
|
-
min: e,
|
|
175
|
-
max: i,
|
|
176
|
-
interval: o
|
|
177
|
-
}), m = r - h, l = f(m, o); l > s; )
|
|
178
|
-
o *= 2, { graphMin: h, graphMax: r } = v({
|
|
179
|
-
min: e,
|
|
180
|
-
max: i,
|
|
181
|
-
interval: o
|
|
182
|
-
}), m = r - h, l = f(m, o);
|
|
183
|
-
return M(m, l, o), {
|
|
184
|
-
steps: l,
|
|
185
|
-
interval: o,
|
|
186
|
-
graphMin: h,
|
|
187
|
-
graphMax: r
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const x = this.startToZero && e >= 0 ? 0 : e, S = this.startToZero && i <= 0 ? 0 : i, d = this.getStepsWithNiceScale({
|
|
191
|
-
min: x,
|
|
192
|
-
max: S,
|
|
193
|
-
maxSteps: s
|
|
194
|
-
});
|
|
195
|
-
return M(
|
|
196
|
-
d.max - d.min,
|
|
197
|
-
d.steps,
|
|
198
|
-
d.interval
|
|
199
|
-
), {
|
|
200
|
-
steps: d.steps,
|
|
201
|
-
interval: d.interval,
|
|
202
|
-
graphMin: d.min,
|
|
203
|
-
graphMax: d.max
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Calculate min/max value, label and size information for axis
|
|
208
|
-
* @param {object} minMax min/max information
|
|
209
|
-
* @param {object} scrollbarOpt scrollbar option
|
|
210
|
-
*
|
|
211
|
-
* @returns {object} min/max value and label
|
|
212
|
-
*/
|
|
213
|
-
calculateScaleRange(t, e) {
|
|
214
|
-
var p;
|
|
215
|
-
let i, s, a = !1;
|
|
216
|
-
const n = e != null && e.use ? e == null ? void 0 : e.range : this.range;
|
|
217
|
-
Array.isArray(n) && (n == null ? void 0 : n.length) === 2 ? this.options.type === "heatMap" ? (i = n[1] > +t.max ? +t.max : n[1], s = n[0] < +t.min ? +t.min : n[0]) : (i = n[1], s = n[0]) : typeof n == "function" ? [s, i] = n(t.min, t.max) : (i = t.max, s = t.min);
|
|
218
|
-
const c = Array.isArray(this.range) && this.range.length === 2;
|
|
219
|
-
if (this.autoScaleRatio && !c) {
|
|
220
|
-
const u = i, M = i * (this.autoScaleRatio + 1);
|
|
221
|
-
if (i = this.decimalPoint ? M : Math.ceil(M), i > 0 && s < 0) {
|
|
222
|
-
const f = u - i;
|
|
223
|
-
s += f;
|
|
224
|
-
} else if (i < 0 && s < 0) {
|
|
225
|
-
const f = s * (this.autoScaleRatio + 1);
|
|
226
|
-
s = this.decimalPoint ? f : Math.ceil(f);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
this.startToZero && !c && (s > 0 && (s = 0), i < 0 && (i = 0)), i === s && (i += 1, a = !0);
|
|
230
|
-
const b = this.getLabelFormat(s), g = this.getLabelFormat(i, {
|
|
231
|
-
isMaxValueSameAsMin: a
|
|
232
|
-
});
|
|
233
|
-
return {
|
|
234
|
-
min: s,
|
|
235
|
-
max: i,
|
|
236
|
-
minLabel: b,
|
|
237
|
-
maxLabel: g,
|
|
238
|
-
size: P.calcTextSizeCanvas(
|
|
239
|
-
g,
|
|
240
|
-
P.getLabelStyle(this.labelStyle),
|
|
241
|
-
(p = this.labelStyle) == null ? void 0 : p.padding
|
|
242
|
-
)
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
export {
|
|
247
|
-
j as default
|
|
248
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import h from "./scale.js";
|
|
2
|
-
import s from "../helpers/helpers.util.js";
|
|
3
|
-
class M extends h {
|
|
4
|
-
/**
|
|
5
|
-
* Calculate min/max value, label and size information for logarithmic scale
|
|
6
|
-
* @param {object} minMax min/max information
|
|
7
|
-
*
|
|
8
|
-
* @returns {object} min/max value and label
|
|
9
|
-
*/
|
|
10
|
-
calculateScaleRange(a) {
|
|
11
|
-
let t, e, r = !1;
|
|
12
|
-
Array.isArray(this.range) && this.range.length === 2 ? (t = this.range[1], e = this.range[0]) : typeof range == "function" ? [e, t] = this.range(a.min, a.max) : (t = a.max, e = a.min);
|
|
13
|
-
const n = s.calculateMagnitude(t - e);
|
|
14
|
-
t = Math.ceil(t / 10 ** n) * 10 ** n, this.startToZero && (e = 0), t === e && (t += 1, r = !0);
|
|
15
|
-
const m = this.getLabelFormat(e), l = this.getLabelFormat(t, {
|
|
16
|
-
isMaxValueSameAsMin: r
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
min: e,
|
|
20
|
-
max: t,
|
|
21
|
-
minLabel: m,
|
|
22
|
-
maxLabel: l,
|
|
23
|
-
size: s.calcTextSize(l, s.getLabelStyle(this.labelStyle))
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* With range information, calculate how many labels in axis
|
|
28
|
-
* @param {object} range min/max information
|
|
29
|
-
* @param {boolean} skipFitting determines if label skipping job.
|
|
30
|
-
*
|
|
31
|
-
* @returns {object} steps, interval, min/max graph value
|
|
32
|
-
*/
|
|
33
|
-
calculateSteps(a, t) {
|
|
34
|
-
const e = a.maxValue, r = a.minValue, n = a.maxSteps, m = s.calculateMagnitude(e - r);
|
|
35
|
-
let l = this.getInterval(a), i;
|
|
36
|
-
const u = e, o = r, c = u - o;
|
|
37
|
-
for (i = Math.round(c / l), e === 1 && (l = 0.2, i = 5); (i > n || i * 2 < n) && !t; )
|
|
38
|
-
if (i > n)
|
|
39
|
-
l *= 2, i = Math.ceil(c / l);
|
|
40
|
-
else if (m >= 0)
|
|
41
|
-
if (l / 2 % 1 === 0)
|
|
42
|
-
l /= 2, i = Math.ceil(c / l);
|
|
43
|
-
else
|
|
44
|
-
break;
|
|
45
|
-
else
|
|
46
|
-
l /= 2, i = Math.ceil(c / l);
|
|
47
|
-
return {
|
|
48
|
-
steps: i,
|
|
49
|
-
interval: l,
|
|
50
|
-
graphMin: o,
|
|
51
|
-
graphMax: Math.ceil(o + i * l)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Transforming label by designated format
|
|
56
|
-
* @param {number} value label value
|
|
57
|
-
* @param {object} data data for formatting
|
|
58
|
-
*
|
|
59
|
-
* @returns {string} formatted label
|
|
60
|
-
*/
|
|
61
|
-
getLabelFormat(a, t = {}) {
|
|
62
|
-
if (this.formatter) {
|
|
63
|
-
const e = this.formatter(a, t);
|
|
64
|
-
if (typeof e == "string")
|
|
65
|
-
return e;
|
|
66
|
-
}
|
|
67
|
-
return s.labelSignFormat(a, this.decimalPoint);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Calculate interval
|
|
71
|
-
* @param {object} range range information
|
|
72
|
-
*
|
|
73
|
-
* @returns {number} interval
|
|
74
|
-
*/
|
|
75
|
-
getInterval(a) {
|
|
76
|
-
const t = a.maxValue, e = a.minValue;
|
|
77
|
-
return 10 ** s.calculateMagnitude(t - e);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
M as default
|
|
82
|
-
};
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { defaultsDeep as Z } from "lodash-es";
|
|
2
|
-
import { PLOT_BAND_OPTION as I, PLOT_LINE_OPTION as tt } from "../helpers/helpers.constant.js";
|
|
3
|
-
import { bnMinus as O, bnPlus as it } from "../../../common/utils.bignumber.js";
|
|
4
|
-
import { truthyNumber as R } from "../../../common/utils.js";
|
|
5
|
-
import et from "./scale.js";
|
|
6
|
-
import u from "../helpers/helpers.util.js";
|
|
7
|
-
class xt extends et {
|
|
8
|
-
constructor(e, s, a, o, i) {
|
|
9
|
-
super(e, s, a, i), this.labels = o;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* get max width from labelStyle
|
|
13
|
-
* maxWidth : number | string
|
|
14
|
-
* @param {object} chartRect chart size information
|
|
15
|
-
* @returns {number} max width
|
|
16
|
-
*/
|
|
17
|
-
getMaxWidth(e) {
|
|
18
|
-
var a, o, i, t, l;
|
|
19
|
-
let s = ((a = this.labelStyle) == null ? void 0 : a.maxWidth) ?? e.chartWidth * 0.5;
|
|
20
|
-
return typeof ((o = this.labelStyle) == null ? void 0 : o.maxWidth) == "string" && ((i = this.labelStyle) != null && i.maxWidth.includes("%") ? s = e.chartWidth * (parseInt((t = this.labelStyle) == null ? void 0 : t.maxWidth.replace("%", "")) / 100) : s = parseInt((l = this.labelStyle) == null ? void 0 : l.maxWidth)), s;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Calculate min/max value, label and size information for step scale
|
|
24
|
-
* @param {object} minMax min/max information (unused on step scale)
|
|
25
|
-
* @param {object} scrollbarOpt scroll bar option
|
|
26
|
-
* @param {object} chartRect chart size information
|
|
27
|
-
*
|
|
28
|
-
* @returns {object} min/max value and label
|
|
29
|
-
*/
|
|
30
|
-
calculateScaleRange(e, s, a) {
|
|
31
|
-
const o = this.labelStyle.alignToGridLine ? e : u.getStringMinMax(this.labels);
|
|
32
|
-
let i = o.max, t = o.min, l = 0, n = this.labels.length - 1;
|
|
33
|
-
const r = s != null && s.use ? s == null ? void 0 : s.range : this.range;
|
|
34
|
-
if (Array.isArray(r) && (r != null && r.length)) {
|
|
35
|
-
const [w, x] = r;
|
|
36
|
-
R(w) && R(x) && (l = w < l ? l : w, n = x > n ? n : x, i = this.labels[n], t = this.labels[l]);
|
|
37
|
-
} else if (typeof r == "function") {
|
|
38
|
-
const [w, x] = r(t, i);
|
|
39
|
-
l = w < l ? l : w, n = x > n ? n : x, i = this.labels[n], t = this.labels[l];
|
|
40
|
-
}
|
|
41
|
-
const k = this.getMaxWidth(a);
|
|
42
|
-
return {
|
|
43
|
-
min: t,
|
|
44
|
-
max: i,
|
|
45
|
-
minIndex: l,
|
|
46
|
-
maxIndex: n,
|
|
47
|
-
minLabel: this.getLabelFormat(t, k),
|
|
48
|
-
maxLabel: this.getLabelFormat(i, k),
|
|
49
|
-
size: u.calcTextSizeCanvas(
|
|
50
|
-
this.getLabelFormat(i, k),
|
|
51
|
-
u.getLabelStyle(this.labelStyle)
|
|
52
|
-
)
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
getIndexInterval(e) {
|
|
56
|
-
const s = e.maxSteps;
|
|
57
|
-
return this.interval ? this.interval : Math.ceil(this.labels.length / s);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* With range information, calculate how many labels in axis
|
|
61
|
-
* @param {object} range min/max information
|
|
62
|
-
*
|
|
63
|
-
* @returns {object} steps, interval, min/max graph value
|
|
64
|
-
*/
|
|
65
|
-
calculateSteps(e) {
|
|
66
|
-
const { minValue: s, maxValue: a, minIndex: o, maxIndex: i } = e, t = i - o + 1;
|
|
67
|
-
let l = 1;
|
|
68
|
-
const n = this.labels.every((r) => !isNaN(r));
|
|
69
|
-
return this.labelStyle.alignToGridLine && n && (l = this.getIndexInterval(e)), {
|
|
70
|
-
oriSteps: t,
|
|
71
|
-
steps: t,
|
|
72
|
-
indexInterval: l,
|
|
73
|
-
graphMin: s,
|
|
74
|
-
graphMax: a,
|
|
75
|
-
minIndex: o,
|
|
76
|
-
maxIndex: i
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Draw axis
|
|
81
|
-
* @param {object} chartRect min/max information
|
|
82
|
-
* @param {object} labelOffset label offset information
|
|
83
|
-
* @param {object} stepInfo label steps information
|
|
84
|
-
* @param {object} hitInfo legend Hit Info
|
|
85
|
-
* @param {object} selectedLabelInfo Selected Label Info
|
|
86
|
-
*
|
|
87
|
-
* @returns {undefined}
|
|
88
|
-
*/
|
|
89
|
-
draw(e, s, a, o, i) {
|
|
90
|
-
var z, X, E, Y, _, V, D, H, K, U, $;
|
|
91
|
-
const t = this.ctx, l = this.labels, n = {
|
|
92
|
-
x1: e.x1 + s.left,
|
|
93
|
-
x2: e.x2 - s.right,
|
|
94
|
-
y1: e.y1 + s.top,
|
|
95
|
-
y2: e.y2 - s.bottom
|
|
96
|
-
}, r = a.steps, k = a.indexInterval, w = a.minIndex, x = n[this.units.rectStart], A = n[this.units.rectEnd], d = n[this.units.rectOffset(this.position)], N = n[this.units.rectOffsetCounter(this.position)], F = this.getMaxWidth(e), B = 5;
|
|
97
|
-
if (this.drawAxisTitle(e, s), (z = this.labelStyle) != null && z.show) {
|
|
98
|
-
t.font = u.getLabelStyle(this.labelStyle), this.type === "x" ? (t.textAlign = "center", t.textBaseline = this.position === "top" ? "bottom" : "top") : (t.textAlign = this.position === "left" ? "right" : "left", t.textBaseline = "middle"), t.fillStyle = this.labelStyle.color, t.lineWidth = this.axisLineWidth;
|
|
99
|
-
const L = u.aliasPixel(t.lineWidth);
|
|
100
|
-
if (t.beginPath(), t.strokeStyle = this.axisLineColor, this.type === "x" ? (t.moveTo(x, d + L), t.lineTo(A, d + L)) : (t.moveTo(d + L, x), t.lineTo(d + L, A)), t.stroke(), r === 0)
|
|
101
|
-
return;
|
|
102
|
-
const S = (A - x) / r, P = this.labelStyle.alignToGridLine;
|
|
103
|
-
let h = null, m = null;
|
|
104
|
-
t.beginPath(), t.strokeStyle = this.gridLineColor;
|
|
105
|
-
let f, y, b;
|
|
106
|
-
const W = [];
|
|
107
|
-
for (b = 0; b < r; b += k) {
|
|
108
|
-
const T = w + b, p = this.labels[T];
|
|
109
|
-
h = Math.round(x + S * b), m = h + L, f = this.getLabelFormat(p, F);
|
|
110
|
-
const { selectLabel: g, selectItem: c, horizontal: M } = this.options;
|
|
111
|
-
let v;
|
|
112
|
-
i != null && i.targetAxis ? v = (i == null ? void 0 : i.targetAxis) === "yAxis" ? "y" : "x" : v = M ? "y" : "x";
|
|
113
|
-
const j = (g == null ? void 0 : g.use) && (g == null ? void 0 : g.useLabelOpacity) && v === this.type && ((X = i == null ? void 0 : i.dataIndex) == null ? void 0 : X.length) && !((E = i == null ? void 0 : i.dataIndex) != null && E.includes(T)), G = this.labelStyle.color;
|
|
114
|
-
let q = 1;
|
|
115
|
-
if (u.getColorStringType(G) === "RGBA" && (q = u.getOpacity(G)), t.fillStyle = u.colorStringToRgba(
|
|
116
|
-
G,
|
|
117
|
-
j ? (Y = this.options) == null ? void 0 : Y.unSelectedOpacity : q
|
|
118
|
-
), this.type === "x") {
|
|
119
|
-
y = this.position === "top" ? d - 10 : d + 10;
|
|
120
|
-
const C = P ? h : h + S / 2;
|
|
121
|
-
if (t.fillText(this.checkFixWidth(f), C, y), !j && (c != null && c.showLabelTip) && (o != null && o.label) && !M) {
|
|
122
|
-
const J = o.label;
|
|
123
|
-
if (J === f) {
|
|
124
|
-
const Q = Math.round(t.measureText((_ = this.labelStyle) == null ? void 0 : _.fontSize).width);
|
|
125
|
-
u.showLabelTip({
|
|
126
|
-
ctx: this.ctx,
|
|
127
|
-
width: Math.round(t.measureText(J).width) + 10,
|
|
128
|
-
height: Q,
|
|
129
|
-
x: h + S / 2,
|
|
130
|
-
y: y + (Q - 2),
|
|
131
|
-
borderRadius: 2,
|
|
132
|
-
arrowSize: 3,
|
|
133
|
-
text: f,
|
|
134
|
-
backgroundColor: (V = c == null ? void 0 : c.labelTipStyle) == null ? void 0 : V.backgroundColor,
|
|
135
|
-
textColor: (D = c == null ? void 0 : c.labelTipStyle) == null ? void 0 : D.textColor
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
this.showAxisTick && (t.beginPath(), t.strokeStyle = this.axisLineColor, t.moveTo(h + S / 2, d), t.lineTo(h + S / 2, d + B), t.stroke(), t.closePath()), b > 0 && this.showGrid && (t.beginPath(), t.strokeStyle = this.gridLineColor, t.moveTo(m, d), t.lineTo(m, N), t.stroke(), t.closePath());
|
|
140
|
-
} else {
|
|
141
|
-
y = this.position === "left" ? d - 10 : d + 10;
|
|
142
|
-
const C = P ? h : h + S / 2;
|
|
143
|
-
t.fillText(this.checkFixWidth(f), y, C), W.push(f), this.showAxisTick && (t.beginPath(), t.strokeStyle = this.axisLineColor, t.moveTo(d + (this.axisLineWidth ?? 1), C), t.lineTo(d - B, C), t.stroke(), t.closePath()), b > 0 && this.showGrid && (t.beginPath(), t.strokeStyle = this.gridLineColor, t.moveTo(d, m), t.lineTo(N, m), t.stroke(), t.closePath());
|
|
144
|
-
}
|
|
145
|
-
t.stroke();
|
|
146
|
-
}
|
|
147
|
-
if (P && b >= this.labels.length) {
|
|
148
|
-
const T = O(+l[1], +l[0]), p = it(+l[l.length - 1], T);
|
|
149
|
-
if (isNaN(p) || k !== 1 && O(p, W[W.length - 1]) <= T)
|
|
150
|
-
return;
|
|
151
|
-
h = Math.round(x + S * l.length), m = h + L;
|
|
152
|
-
const g = this.getLabelFormat(`${p}`, F);
|
|
153
|
-
this.type === "x" ? (t.fillText(this.checkFixWidth(g), h, y), this.showGrid && (t.moveTo(m, d), t.lineTo(m, N))) : (t.fillText(this.checkFixWidth(g), y, h), this.showGrid && (t.moveTo(d, m), t.lineTo(N, m))), t.stroke();
|
|
154
|
-
}
|
|
155
|
-
t.closePath();
|
|
156
|
-
}
|
|
157
|
-
if ((H = this.plotBands) != null && H.length || (K = this.plotLines) != null && K.length) {
|
|
158
|
-
const L = u.aliasPixel(t.lineWidth) + 1, S = n.x1 + L, P = n.x2, h = n.y1 + L, m = n.y2, f = (A - x) / (this.labelStyle.show ? l.length : 1);
|
|
159
|
-
(U = this.plotBands) == null || U.forEach((y) => {
|
|
160
|
-
if (!y.from && !y.to)
|
|
161
|
-
return;
|
|
162
|
-
const b = Z({}, y, I), { from: W = 0, to: T = l.length, label: p } = b, g = Math.round(x + f * W), c = Math.round(x + f * T);
|
|
163
|
-
if (this.setPlotBandStyle(b), this.type === "x" ? this.drawXPlotBand(g, c, S, P, h, m) : this.drawYPlotBand(g, c, S, P, h, m), p.show) {
|
|
164
|
-
const M = this.getNormalizedLabelOptions(e, p), v = this.getPlotBandLabelPosition(g, c, M, P, h);
|
|
165
|
-
this.drawPlotLabel(M, v);
|
|
166
|
-
}
|
|
167
|
-
t.restore();
|
|
168
|
-
}), ($ = this.plotLines) == null || $.forEach((y) => {
|
|
169
|
-
if (!y.value)
|
|
170
|
-
return;
|
|
171
|
-
const b = Z({}, y, tt), { value: W, label: T } = b, p = Math.round(x + f * W) + f / 2;
|
|
172
|
-
if (this.setPlotLineStyle(b), this.type === "x" ? this.drawXPlotLine(p, S, P, h, m) : this.drawYPlotLine(p, S, P, h, m), T.show) {
|
|
173
|
-
const g = this.getNormalizedLabelOptions(e, T), c = this.getPlotLineLabelPosition(p, g, P, h);
|
|
174
|
-
this.drawPlotLabel(g, c);
|
|
175
|
-
}
|
|
176
|
-
t.restore();
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Transforming label by designated format
|
|
182
|
-
* @param {string} value label value
|
|
183
|
-
* @param {number} maxWidth max width for each label
|
|
184
|
-
* @param {object} data data for formatting
|
|
185
|
-
*
|
|
186
|
-
* @returns {string} formatted label
|
|
187
|
-
*/
|
|
188
|
-
getLabelFormat(e, s, a = {}) {
|
|
189
|
-
if (this.formatter) {
|
|
190
|
-
const o = this.formatter(e, a);
|
|
191
|
-
if (typeof o == "string")
|
|
192
|
-
return o;
|
|
193
|
-
}
|
|
194
|
-
return this.labelStyle.fitWidth ? this.fittingString(e, s) : e;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Transforming ellipsis label by designated format and specific width
|
|
198
|
-
* @param {string} value label value
|
|
199
|
-
* @param {number} maxWidth max width for each label
|
|
200
|
-
*
|
|
201
|
-
* @returns {string} formatted label
|
|
202
|
-
*/
|
|
203
|
-
fittingString(e, s) {
|
|
204
|
-
const a = this.ctx;
|
|
205
|
-
a.save(), a.font = u.getLabelStyle(this.labelStyle);
|
|
206
|
-
const o = this.labelStyle.fitDir, i = u.truncateLabelWithEllipsis(e, s, a, o);
|
|
207
|
-
return a.restore(), i;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* return width what has max length
|
|
211
|
-
* ellipsis가 적용된 label의 width를 계산 (fontSize 적용)
|
|
212
|
-
* @param {string[]} notFormattedLabels
|
|
213
|
-
* @param {object} chartRect
|
|
214
|
-
* @returns {number} maxWidth
|
|
215
|
-
*/
|
|
216
|
-
getLabelWidthHasMaxLength(e, s) {
|
|
217
|
-
const a = u.getLabelStyle(this.labelStyle), o = this.getMaxWidth(s);
|
|
218
|
-
return (e ?? []).reduce((i, t) => {
|
|
219
|
-
var r;
|
|
220
|
-
const l = this.getLabelFormat(t, o), n = ((r = u.calcTextSizeCanvas(l, a)) == null ? void 0 : r.width) ?? 0;
|
|
221
|
-
return Math.max(i, n);
|
|
222
|
-
}, 0);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export {
|
|
226
|
-
xt as default
|
|
227
|
-
};
|