evui 2.0.8 → 2.1.1
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/{adac9fa4f723f9d2cb5b6640517114a9.png → 0b8d1200e71cae8d747dce4e69c4efb6.png} +0 -0
- package/dist/1.css +4 -0
- package/dist/1.css.map +1 -0
- package/dist/1.evui.min.js +2 -0
- package/dist/1.evui.min.js.map +1 -0
- package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
- package/dist/2.css +4 -0
- package/dist/2.css.map +1 -0
- package/dist/2.evui.min.js +2 -0
- package/dist/2.evui.min.js.map +1 -0
- package/dist/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 278156e41e0ad908cf7f841b17130502.woff2} +0 -0
- package/dist/3.evui.min.js +2 -0
- package/dist/3.evui.min.js.map +1 -0
- package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
- package/dist/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 38c6d8bab26db77d8c806813e1497763.woff2} +0 -0
- package/dist/4.evui.min.js +2 -0
- package/dist/4.evui.min.js.map +1 -0
- package/dist/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
- package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
- package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
- package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
- package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
- package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
- package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
- package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
- package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
- package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
- package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
- package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
- package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
- package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
- package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
- package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
- package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
- package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
- package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
- package/dist/evui.min.js +12 -59485
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -1
- package/dist/main.css +85 -0
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -0
- package/package.json +58 -89
- package/src/common/emitter.js +20 -0
- package/src/common/utils.debounce.js +223 -0
- package/src/common/utils.js +51 -17
- package/src/common/utils.throttle.js +83 -0
- package/src/common/utils.tree.js +18 -0
- package/src/components/button/button.vue +316 -241
- package/src/components/chart/chart.core.js +699 -0
- package/src/components/chart/chart.vue +200 -204
- package/src/components/chart/element/element.bar.js +311 -0
- package/src/components/chart/element/element.bar.time.js +115 -0
- package/src/components/chart/element/element.line.js +288 -0
- package/src/components/chart/element/element.pie.js +86 -0
- package/src/components/chart/element/element.scatter.js +83 -0
- package/src/components/chart/element/element.tip.js +356 -0
- package/src/components/chart/helpers/helpers.canvas.js +237 -0
- package/src/components/chart/helpers/helpers.constant.js +138 -0
- package/src/components/chart/helpers/helpers.util.js +154 -0
- package/src/components/chart/index.js +0 -1
- package/src/components/chart/model/index.js +4 -0
- package/src/components/chart/model/model.series.js +86 -0
- package/src/components/chart/model/model.store.js +559 -0
- package/src/components/chart/plugins/plugins.interaction.js +324 -0
- package/src/components/chart/plugins/plugins.legend.js +589 -0
- package/src/components/chart/plugins/plugins.pie.js +179 -0
- package/src/components/chart/plugins/plugins.title.js +56 -0
- package/src/components/chart/plugins/plugins.tooltip.js +384 -0
- package/src/components/chart/scale/scale.js +272 -0
- package/src/components/chart/scale/scale.linear.js +30 -0
- package/src/components/chart/scale/scale.logarithmic.js +120 -0
- package/src/components/chart/scale/scale.step.js +197 -0
- package/src/components/chart/scale/scale.time.category.js +204 -0
- package/src/components/chart/scale/scale.time.js +40 -0
- package/src/components/checkbox/checkbox-group.vue +31 -12
- package/src/components/checkbox/checkbox.vue +269 -19
- package/src/components/codeview/code.vue +42 -29
- package/src/components/contextmenu/contextmenu.child.vue +79 -0
- package/src/components/contextmenu/contextmenu.vue +276 -0
- package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
- package/src/components/contextmenu/index.js +3 -0
- package/src/components/datepicker/calendar.core.js +604 -510
- package/src/components/datepicker/calendar.vue +0 -3
- package/src/components/datepicker/datepicker.vue +73 -14
- package/src/components/datepicker/index.js +5 -1
- package/src/components/grid/grid.filter.vue +290 -0
- package/src/components/grid/grid.filter.window.vue +411 -0
- package/src/components/grid/grid.render.vue +45 -0
- package/src/components/grid/grid.vue +1338 -0
- package/src/components/icon/icon.vue +22 -7
- package/src/components/input/input.number.vue +309 -277
- package/src/components/label/label.vue +2 -2
- package/src/components/loadingmask/loadingmask.vue +52 -63
- package/src/components/loginfield/index.js +3 -0
- package/src/components/loginfield/loginfield.vue +339 -0
- package/src/components/markdown/index.js +3 -0
- package/src/components/markdown/markdown.vue +1001 -0
- package/src/components/menu/index.js +1 -3
- package/src/components/menu/menu.nav.item.vue +115 -0
- package/src/components/menu/menu.nav.sub.vue +42 -0
- package/src/components/menu/menu.nav.vue +71 -98
- package/src/components/message/index.js +3 -0
- package/src/components/message/message.js +63 -0
- package/src/components/message/message.vue +191 -0
- package/src/components/message-box/index.js +3 -0
- package/src/components/message-box/message-box.js +31 -0
- package/src/components/message-box/message-box.vue +298 -0
- package/src/components/notification/index.js +3 -0
- package/src/components/notification/notification.js +75 -0
- package/src/components/notification/notification.vue +242 -0
- package/src/components/radio/radio-group.vue +12 -2
- package/src/components/radio/radio.vue +186 -25
- package/src/components/selectbox/dropdown.vue +96 -39
- package/src/components/selectbox/listbox.vue +68 -29
- package/src/components/selectbox/option.vue +1 -1
- package/src/components/selectbox/selectbox.vue +445 -245
- package/src/components/slider/slider-tooltip.vue +7 -7
- package/src/components/slider/slider.vue +20 -25
- package/src/components/splitter/index.js +3 -0
- package/src/components/splitter/splitter.vue +294 -0
- package/src/components/table/table.black.css +1 -1
- package/src/components/table/table.filter.lite.vue +8 -8
- package/src/components/table/table.filter.vue +1 -1
- package/src/components/table/table.grey.css +5 -6
- package/src/components/table/table.navy.css +1 -1
- package/src/components/table/table.vue +60 -55
- package/src/components/tabs/tab-panel.vue +19 -5
- package/src/components/tabs/tabs.vue +182 -87
- package/src/components/textfield/textfield.vue +140 -80
- package/src/components/timepicker/index.js +2 -2
- package/src/components/timepicker/spinner.vue +15 -17
- package/src/components/timepicker/timepicker.vue +98 -53
- package/src/components/toggle/toggle.vue +206 -158
- package/src/components/tree/index.js +2 -6
- package/src/components/tree/render.js +17 -0
- package/src/components/tree/tree-node.vue +214 -0
- package/src/components/tree/tree.vue +296 -0
- package/src/components/tree-table/index.js +7 -0
- package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
- package/src/components/{tree → tree-table}/tree.table.grey.css +12 -12
- package/src/components/{tree → tree-table}/tree.table.vue +151 -95
- package/src/components/tree-table/tree.util.js +119 -0
- package/src/components/window/window.vue +238 -183
- package/src/index.js +29 -12
- package/src/styles/base/base.scss +50 -0
- package/src/styles/base/index.scss +1 -0
- package/src/styles/default.scss +5 -0
- package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
- package/src/styles/{all.css → lib/fontawesome.css} +1 -1
- package/src/styles/lib/icon.css +792 -0
- package/src/styles/themes/index.scss +2 -0
- package/src/styles/themes/mixin.scss +33 -0
- package/src/styles/themes/variables.scss +206 -0
- package/src/styles/utils/colors.scss +222 -0
- package/src/styles/utils/index.scss +2 -0
- package/src/styles/utils/mixins.scss +34 -0
- package/src/styles/utils/variables.scss +27 -0
- package/src/webfonts/EVUI.eot +0 -0
- package/src/webfonts/EVUI.svg +251 -173
- package/src/webfonts/EVUI.ttf +0 -0
- package/src/webfonts/EVUI.woff +0 -0
- package/src/webfonts/Roboto-Bold.ttf +0 -0
- package/src/webfonts/Roboto-Medium.ttf +0 -0
- package/src/webfonts/Roboto-Regular.ttf +0 -0
- package/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
- package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
- package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
- package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
- package/src/components/chart/charts/chart.bar.js +0 -334
- package/src/components/chart/charts/chart.base.js +0 -1075
- package/src/components/chart/charts/chart.line.js +0 -262
- package/src/components/chart/charts/chart.pie.js +0 -383
- package/src/components/chart/charts/chart.scatter.js +0 -349
- package/src/components/chart/charts/chart.sunburst.js +0 -193
- package/src/components/chart/core/axis/axis.js +0 -217
- package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
- package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
- package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
- package/src/components/chart/core/core.constant.js +0 -91
- package/src/components/chart/core/core.legend.js +0 -473
- package/src/components/chart/core/core.util.js +0 -66
- package/src/components/chart/core/data/data.js +0 -412
- package/src/components/chart/core/data/data.pie.js +0 -70
- package/src/components/chart/core/data/data.stack.js +0 -222
- package/src/components/chart/core/data/data.sunburst.js +0 -172
- package/src/components/menu/menu.context.children.vue +0 -201
- package/src/components/menu/menu.context.vue +0 -144
- package/src/components/tabs/jun/tab.vue +0 -123
- package/src/components/tabs/jun/tabs.vue +0 -484
- package/src/components/tree/tree.util.js +0 -39
- package/src/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
import { AXIS_UNITS } from '../core.constant';
|
|
3
|
-
import Util from '../core.util';
|
|
4
|
-
|
|
5
|
-
class Axis {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
this.type = props.type;
|
|
8
|
-
this.options = props.options;
|
|
9
|
-
this.ctx = props.ctx;
|
|
10
|
-
|
|
11
|
-
this.chartRect = props.chartRect;
|
|
12
|
-
this.labelOffset = props.labelOffset;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
createAxis(axisMinMax) {
|
|
16
|
-
this.units = AXIS_UNITS[this.type];
|
|
17
|
-
this.skipFitting = false;
|
|
18
|
-
|
|
19
|
-
this.axisPosInfo = {
|
|
20
|
-
x1: this.chartRect.x1 + this.labelOffset.left,
|
|
21
|
-
x2: this.chartRect.x2 - this.labelOffset.right,
|
|
22
|
-
y1: this.chartRect.y1 + this.labelOffset.top,
|
|
23
|
-
y2: this.chartRect.y2 - this.labelOffset.bottom,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
this.calculateRange(axisMinMax);
|
|
27
|
-
this.drawAxis();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
calculateRange(axisMinMax) {
|
|
31
|
-
if (!axisMinMax) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// init variable
|
|
36
|
-
const options = this.options;
|
|
37
|
-
const chartRect = this.chartRect;
|
|
38
|
-
|
|
39
|
-
let maxValue;
|
|
40
|
-
let minValue;
|
|
41
|
-
|
|
42
|
-
if (options.range && options.range.length === 2) {
|
|
43
|
-
if (options.labelType === 'time') {
|
|
44
|
-
maxValue = +moment(options.range[1]);
|
|
45
|
-
minValue = +moment(options.range[0]);
|
|
46
|
-
} else {
|
|
47
|
-
maxValue = options.labelType === 'time' ? +moment(options.range[1]) : options.range[1];
|
|
48
|
-
minValue = options.labelType === 'time' ? +moment(options.range[0]) : options.range[0];
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
maxValue = axisMinMax ? (axisMinMax.max || 1) : 1;
|
|
52
|
-
minValue = axisMinMax ? (axisMinMax.min || 0) : 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (options.autoScaleRatio) {
|
|
56
|
-
maxValue = Math.round(maxValue * (options.autoScaleRatio + 1));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (options.isSetMinZero && options.labelType === 'linear') {
|
|
60
|
-
minValue = 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let currentLabelOffset;
|
|
64
|
-
let tickSize;
|
|
65
|
-
|
|
66
|
-
// 실제 Axis가 그려질 영역
|
|
67
|
-
const chartSize = this.units.pos === 'x' ? chartRect.chartWidth : chartRect.chartHeight;
|
|
68
|
-
|
|
69
|
-
if (this.units.pos === 'x') {
|
|
70
|
-
currentLabelOffset = [this.labelOffset.left, this.labelOffset.right];
|
|
71
|
-
} else {
|
|
72
|
-
currentLabelOffset = [this.labelOffset.top, this.labelOffset.bottom];
|
|
73
|
-
}
|
|
74
|
-
const drawRange = chartSize - (currentLabelOffset[0] + currentLabelOffset[1]);
|
|
75
|
-
|
|
76
|
-
if (this.units.pos === 'x') {
|
|
77
|
-
// tickSize는 실제 step을 구하기 위해 각 축의 Label중 가장 큰 값을 기준으로 Size를 구한다.
|
|
78
|
-
tickSize = this.ctx.measureText(this.labelFormat(maxValue)).width + 20;
|
|
79
|
-
} else {
|
|
80
|
-
// Y축의 경우 글자의 높이로 전체 영역을 나누기 위함.
|
|
81
|
-
tickSize = options.labelStyle.fontSize * 2;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const minSteps = 2;
|
|
85
|
-
const maxSteps = Math.floor(drawRange / tickSize);
|
|
86
|
-
|
|
87
|
-
this.skipFitting = minSteps >= maxSteps;
|
|
88
|
-
|
|
89
|
-
if (maxValue < 1) {
|
|
90
|
-
maxValue = 1;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (maxValue === minValue) {
|
|
94
|
-
maxValue += 0.5;
|
|
95
|
-
if (minValue >= 0.5 && !options.isSetMinZero) {
|
|
96
|
-
minValue -= 0.5;
|
|
97
|
-
} else {
|
|
98
|
-
maxValue += 0.5;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
this.calculateSteps({ maxValue, minValue, maxSteps, minSteps });
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
drawAxis() {
|
|
106
|
-
const options = this.options;
|
|
107
|
-
const startPoint = this.axisPosInfo[this.units.rectStart];
|
|
108
|
-
const endPoint = this.axisPosInfo[this.units.rectEnd];
|
|
109
|
-
const offsetPoint = this.axisPosInfo[this.units.rectOffset(options.position)];
|
|
110
|
-
const offsetCounterPoint = this.axisPosInfo[this.units.rectOffsetCounter(options.position)];
|
|
111
|
-
|
|
112
|
-
// label font 설정
|
|
113
|
-
this.ctx.font = Util.getLabelStyle(options);
|
|
114
|
-
|
|
115
|
-
if (this.units.pos === 'x') {
|
|
116
|
-
this.ctx.textAlign = 'center';
|
|
117
|
-
this.ctx.textBaseline = options.position === 'top' ? 'bottom' : 'top';
|
|
118
|
-
} else if (this.units.pos === 'y') {
|
|
119
|
-
this.ctx.textAlign = options.position === 'left' ? 'right' : 'left';
|
|
120
|
-
this.ctx.textBaseline = 'middle';
|
|
121
|
-
}
|
|
122
|
-
this.ctx.fillStyle = options.labelStyle.color;
|
|
123
|
-
|
|
124
|
-
if (this.steps === 0) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// 각 라벨간 간격
|
|
129
|
-
const labelGap = (endPoint - startPoint) / this.steps;
|
|
130
|
-
|
|
131
|
-
let labelCenter = null;
|
|
132
|
-
let linePosition = null;
|
|
133
|
-
|
|
134
|
-
if (options.ticks === null) {
|
|
135
|
-
options.ticks = [];
|
|
136
|
-
} else {
|
|
137
|
-
options.ticks.length = 0;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// grid 그리기
|
|
141
|
-
this.ctx.lineWidth = 1;
|
|
142
|
-
const aliasPixel = Util.aliasPixel(this.ctx.lineWidth);
|
|
143
|
-
|
|
144
|
-
// Axis Line
|
|
145
|
-
this.ctx.beginPath();
|
|
146
|
-
this.ctx.strokeStyle = options.axisLineColor;
|
|
147
|
-
if (this.units.pos === 'x') {
|
|
148
|
-
this.ctx.moveTo(startPoint, offsetPoint + aliasPixel);
|
|
149
|
-
this.ctx.lineTo(endPoint, offsetPoint + aliasPixel);
|
|
150
|
-
} else {
|
|
151
|
-
this.ctx.moveTo(offsetPoint + aliasPixel, startPoint);
|
|
152
|
-
this.ctx.lineTo(offsetPoint + aliasPixel, endPoint);
|
|
153
|
-
}
|
|
154
|
-
this.ctx.stroke();
|
|
155
|
-
|
|
156
|
-
// Grid
|
|
157
|
-
this.ctx.beginPath();
|
|
158
|
-
this.ctx.strokeStyle = options.gridLineColor;
|
|
159
|
-
|
|
160
|
-
const ticks = options.ticks;
|
|
161
|
-
const showGrid = options.showGrid;
|
|
162
|
-
let labelText;
|
|
163
|
-
|
|
164
|
-
for (let ix = 0; ix <= this.steps; ix++) {
|
|
165
|
-
if (this.isStepValueFloat) {
|
|
166
|
-
ticks[ix] = Math.round(this.axisMin + ((ix * this.stepValue) * 10)) / 10;
|
|
167
|
-
} else {
|
|
168
|
-
ticks[ix] = this.axisMin + (ix * this.stepValue);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
labelCenter = Math.round(startPoint + (labelGap * ix));
|
|
172
|
-
linePosition = labelCenter + aliasPixel;
|
|
173
|
-
labelText = this.labelFormat(ticks[ix]);
|
|
174
|
-
|
|
175
|
-
let labelPoint;
|
|
176
|
-
|
|
177
|
-
if (this.units.pos === 'x') {
|
|
178
|
-
labelPoint = options.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
|
|
179
|
-
this.ctx.fillText(labelText, labelCenter, labelPoint);
|
|
180
|
-
|
|
181
|
-
if (ix !== 0 && showGrid) {
|
|
182
|
-
this.ctx.moveTo(linePosition, offsetPoint);
|
|
183
|
-
this.ctx.lineTo(linePosition, offsetCounterPoint);
|
|
184
|
-
}
|
|
185
|
-
} else {
|
|
186
|
-
labelPoint = options.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
|
|
187
|
-
this.ctx.fillText(labelText, labelPoint, labelCenter);
|
|
188
|
-
|
|
189
|
-
if (ix !== 0 && showGrid) {
|
|
190
|
-
this.ctx.moveTo(offsetPoint, linePosition);
|
|
191
|
-
this.ctx.lineTo(offsetCounterPoint, linePosition);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
this.ctx.stroke();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
this.ctx.closePath();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
labelFormat(value) {
|
|
202
|
-
const options = this.options;
|
|
203
|
-
let label;
|
|
204
|
-
|
|
205
|
-
if (options.timeFormat !== null) {
|
|
206
|
-
label = moment(value).format(options.timeFormat);
|
|
207
|
-
} else if (options.labelType === 'linear') {
|
|
208
|
-
label = Util.labelFormat(value);
|
|
209
|
-
} else {
|
|
210
|
-
label = value;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return label;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export default Axis;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import Util from '../core.util';
|
|
2
|
-
import Axis from './axis';
|
|
3
|
-
|
|
4
|
-
class AxisAutoScale extends Axis {
|
|
5
|
-
calculateSteps(rangeInfo) {
|
|
6
|
-
const maxValue = rangeInfo.maxValue;
|
|
7
|
-
const minValue = rangeInfo.minValue;
|
|
8
|
-
const maxSteps = rangeInfo.maxSteps;
|
|
9
|
-
const minSteps = rangeInfo.minSteps;
|
|
10
|
-
|
|
11
|
-
const options = this.options;
|
|
12
|
-
const valueRange = Math.abs(maxValue - minValue);
|
|
13
|
-
const rangeMagnitude = Util.calculateMagnitude(valueRange);
|
|
14
|
-
const graphMin = minValue;
|
|
15
|
-
|
|
16
|
-
let graphMax;
|
|
17
|
-
let stepValue;
|
|
18
|
-
let numberOfSteps;
|
|
19
|
-
|
|
20
|
-
if (options.autoScaleRatio) {
|
|
21
|
-
graphMax = maxValue;
|
|
22
|
-
} else {
|
|
23
|
-
graphMax = Math.ceil(maxValue / (10 ** rangeMagnitude)) * (10 ** rangeMagnitude);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const graphRange = graphMax - graphMin;
|
|
27
|
-
stepValue = 10 ** rangeMagnitude;
|
|
28
|
-
numberOfSteps = Math.ceil(graphRange / stepValue);
|
|
29
|
-
|
|
30
|
-
if (maxValue === 1) {
|
|
31
|
-
stepValue = 0.2;
|
|
32
|
-
numberOfSteps = 5;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
while ((numberOfSteps > maxSteps || (numberOfSteps * 2) < maxSteps) && !this.skipFitting) {
|
|
36
|
-
if (numberOfSteps > maxSteps) {
|
|
37
|
-
stepValue *= 2;
|
|
38
|
-
numberOfSteps = Math.ceil(graphRange / stepValue);
|
|
39
|
-
|
|
40
|
-
if (numberOfSteps % 1 !== 0) {
|
|
41
|
-
this.skipFitting = true;
|
|
42
|
-
}
|
|
43
|
-
} else if (rangeMagnitude >= 0) {
|
|
44
|
-
if ((stepValue / 2) % 1 === 0) {
|
|
45
|
-
stepValue /= 2;
|
|
46
|
-
numberOfSteps = Math.ceil(graphRange / stepValue);
|
|
47
|
-
} else {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
stepValue /= 2;
|
|
52
|
-
numberOfSteps = Math.ceil(graphRange / stepValue);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (this.skipFitting) {
|
|
57
|
-
numberOfSteps = minSteps;
|
|
58
|
-
stepValue = graphRange / numberOfSteps;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.steps = numberOfSteps;
|
|
62
|
-
this.stepValue = stepValue;
|
|
63
|
-
this.isStepValueFloat = (`${stepValue}`).indexOf('.') > -1;
|
|
64
|
-
this.axisMin = graphMin;
|
|
65
|
-
this.axisMax = Math.ceil((graphMin + (numberOfSteps * stepValue)) * 1000) / 1000;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default AxisAutoScale;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { TIME_INTERVALS } from '../core.constant';
|
|
2
|
-
import Axis from './axis';
|
|
3
|
-
|
|
4
|
-
class AxisFixedScale extends Axis {
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super(props);
|
|
7
|
-
|
|
8
|
-
if (this.options.labelType === 'time') {
|
|
9
|
-
this.interval = TIME_INTERVALS[this.options.interval].size;
|
|
10
|
-
} else {
|
|
11
|
-
this.interval = +this.options.interval;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
calculateSteps(rangeInfo) {
|
|
16
|
-
const maxValue = rangeInfo.maxValue;
|
|
17
|
-
const minValue = rangeInfo.minValue;
|
|
18
|
-
const maxSteps = rangeInfo.maxSteps;
|
|
19
|
-
const minSteps = rangeInfo.minSteps;
|
|
20
|
-
|
|
21
|
-
const options = this.options;
|
|
22
|
-
|
|
23
|
-
let incValue = minValue;
|
|
24
|
-
let stepValue;
|
|
25
|
-
let numberOfSteps;
|
|
26
|
-
|
|
27
|
-
while (incValue < maxValue) {
|
|
28
|
-
incValue += this.interval;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const graphMax = (options.autoScaleRatio && incValue <= maxValue) ? maxValue : incValue;
|
|
32
|
-
const graphMin = minValue;
|
|
33
|
-
const graphRange = graphMax - graphMin;
|
|
34
|
-
|
|
35
|
-
stepValue = this.interval;
|
|
36
|
-
numberOfSteps = Math.round(graphRange / stepValue);
|
|
37
|
-
|
|
38
|
-
if (maxValue === 1) {
|
|
39
|
-
stepValue = 0.2;
|
|
40
|
-
numberOfSteps = 5;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
while (numberOfSteps > maxSteps && !this.skipFitting) {
|
|
44
|
-
stepValue *= 2;
|
|
45
|
-
numberOfSteps = Math.round(graphRange / stepValue);
|
|
46
|
-
|
|
47
|
-
if (numberOfSteps % 1 !== 0) {
|
|
48
|
-
this.skipFitting = true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (this.skipFitting) {
|
|
53
|
-
numberOfSteps = minSteps;
|
|
54
|
-
stepValue = graphRange / numberOfSteps;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.steps = numberOfSteps;
|
|
58
|
-
this.stepValue = stepValue;
|
|
59
|
-
this.isStepValueFloat = (`${stepValue}`).indexOf('.') > -1;
|
|
60
|
-
this.axisMin = graphMin;
|
|
61
|
-
this.axisMax = Math.ceil((graphMin + (numberOfSteps * stepValue)) * 1000) / 1000;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default AxisFixedScale;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import Axis from './axis';
|
|
2
|
-
import Util from '../core.util';
|
|
3
|
-
|
|
4
|
-
class AxisStepsScale extends Axis {
|
|
5
|
-
calculateSteps(rangeInfo) {
|
|
6
|
-
const maxSteps = rangeInfo.maxSteps;
|
|
7
|
-
const minSteps = rangeInfo.minSteps;
|
|
8
|
-
|
|
9
|
-
const graphMax = this.axisData[this.axisData.length - 1];
|
|
10
|
-
const graphMin = this.axisData[0];
|
|
11
|
-
const graphRange = this.axisData.length;
|
|
12
|
-
|
|
13
|
-
let stepValue = 1;
|
|
14
|
-
let numberOfSteps = Math.round(graphRange / stepValue);
|
|
15
|
-
|
|
16
|
-
if (graphMax === 1) {
|
|
17
|
-
stepValue = 1;
|
|
18
|
-
numberOfSteps = 1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
while (numberOfSteps > maxSteps && !this.skipFitting) {
|
|
22
|
-
stepValue *= 2;
|
|
23
|
-
numberOfSteps = Math.round(graphRange / stepValue);
|
|
24
|
-
|
|
25
|
-
if (numberOfSteps % 1 !== 0) {
|
|
26
|
-
this.skipFitting = true;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (this.skipFitting) {
|
|
31
|
-
numberOfSteps = minSteps;
|
|
32
|
-
stepValue = graphRange / numberOfSteps;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this.steps = numberOfSteps;
|
|
36
|
-
this.stepValue = stepValue;
|
|
37
|
-
this.isStepValueFloat = false;
|
|
38
|
-
this.axisMin = graphMin;
|
|
39
|
-
this.axisMax = graphMax;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
drawAxis() {
|
|
43
|
-
if (this.steps === 0) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const options = this.options;
|
|
48
|
-
const startPoint = this.axisPosInfo[this.units.rectStart];
|
|
49
|
-
const endPoint = this.axisPosInfo[this.units.rectEnd];
|
|
50
|
-
const offsetPoint = this.axisPosInfo[this.units.rectOffset(options.position)];
|
|
51
|
-
const offsetCounterPoint = this.axisPosInfo[this.units.rectOffsetCounter(options.position)];
|
|
52
|
-
|
|
53
|
-
const labelType = options.labelType;
|
|
54
|
-
|
|
55
|
-
if (this.units.pos === 'x') {
|
|
56
|
-
this.ctx.textAlign = this.stepValue > 1 ? 'start' : 'center';
|
|
57
|
-
this.ctx.textBaseline = options.position === 'top' ? 'bottom' : 'top';
|
|
58
|
-
} else if (this.units.pos === 'y') {
|
|
59
|
-
this.ctx.textAlign = options.position === 'left' ? 'right' : 'left';
|
|
60
|
-
this.ctx.textBaseline = 'middle';
|
|
61
|
-
}
|
|
62
|
-
this.ctx.fillStyle = options.labelStyle.color;
|
|
63
|
-
this.ctx.font = Util.getLabelStyle(options);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let labelPos;
|
|
67
|
-
|
|
68
|
-
const labelCount = labelType === 'category' ? this.axisData.length : this.axisData.length - 1;
|
|
69
|
-
const labelGap = (endPoint - startPoint) / labelCount;
|
|
70
|
-
|
|
71
|
-
if (labelType === 'category') {
|
|
72
|
-
labelPos = this.stepValue > 1 ? 0 : labelGap / 2;
|
|
73
|
-
} else {
|
|
74
|
-
labelPos = 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let labelCenter = null;
|
|
78
|
-
let linePosition = null;
|
|
79
|
-
|
|
80
|
-
this.ticks = [];
|
|
81
|
-
|
|
82
|
-
if (options.ticks === null) {
|
|
83
|
-
options.ticks = [];
|
|
84
|
-
} else {
|
|
85
|
-
options.ticks.length = 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// grid 그리기
|
|
89
|
-
this.ctx.lineWidth = 1;
|
|
90
|
-
const aliasPixel = Util.aliasPixel(this.ctx.lineWidth);
|
|
91
|
-
|
|
92
|
-
// Axis Line
|
|
93
|
-
this.ctx.beginPath();
|
|
94
|
-
this.ctx.strokeStyle = options.axisLineColor;
|
|
95
|
-
if (this.units.pos === 'x') {
|
|
96
|
-
this.ctx.moveTo(startPoint, offsetPoint + aliasPixel);
|
|
97
|
-
this.ctx.lineTo(endPoint, offsetPoint + aliasPixel);
|
|
98
|
-
} else {
|
|
99
|
-
this.ctx.moveTo(offsetPoint + aliasPixel, startPoint);
|
|
100
|
-
this.ctx.lineTo(offsetPoint + aliasPixel, endPoint);
|
|
101
|
-
}
|
|
102
|
-
this.ctx.stroke();
|
|
103
|
-
|
|
104
|
-
// Grid
|
|
105
|
-
this.ctx.beginPath();
|
|
106
|
-
this.ctx.strokeStyle = options.gridLineColor;
|
|
107
|
-
|
|
108
|
-
let labelText;
|
|
109
|
-
|
|
110
|
-
for (let ix = 0, ixLen = labelType === 'category' ? labelCount - 1 : labelCount; ix <= ixLen; ix++) {
|
|
111
|
-
if (this.axisData[ix]) {
|
|
112
|
-
options.ticks[ix] = this.axisData[ix];
|
|
113
|
-
} else {
|
|
114
|
-
options.ticks[ix] = '';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
labelCenter = Math.round(startPoint + (labelGap * ix));
|
|
118
|
-
linePosition = labelCenter + aliasPixel;
|
|
119
|
-
labelText = this.labelFormat(options.ticks[ix]);
|
|
120
|
-
|
|
121
|
-
let labelPoint;
|
|
122
|
-
if (this.units.pos === 'x') {
|
|
123
|
-
if (ix % this.stepValue === 0 || ix === ixLen) {
|
|
124
|
-
labelPoint = options.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
|
|
125
|
-
this.ctx.fillText(labelText, labelCenter + labelPos, labelPoint);
|
|
126
|
-
|
|
127
|
-
if (this.options.showGrid) {
|
|
128
|
-
this.ctx.moveTo(linePosition, offsetPoint);
|
|
129
|
-
this.ctx.lineTo(linePosition, offsetCounterPoint);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
} else if (this.units.pos === 'y') {
|
|
133
|
-
if (ix % this.stepValue === 0 || ix === ixLen) {
|
|
134
|
-
labelPoint = options.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
|
|
135
|
-
this.ctx.fillText(labelText, labelPoint, labelCenter + labelPos);
|
|
136
|
-
|
|
137
|
-
if (ix !== 0 && this.options.showGrid) {
|
|
138
|
-
this.ctx.moveTo(offsetPoint, linePosition);
|
|
139
|
-
this.ctx.lineTo(offsetCounterPoint, linePosition);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
this.ctx.stroke();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export default AxisStepsScale;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
export const AXIS_UNITS = {
|
|
2
|
-
x: {
|
|
3
|
-
pos: 'x',
|
|
4
|
-
len: 'width',
|
|
5
|
-
dir: 'horizontal',
|
|
6
|
-
rectStart: 'x1',
|
|
7
|
-
rectEnd: 'x2',
|
|
8
|
-
rectOffsetCounter(position) {
|
|
9
|
-
return position === 'top' ? 'y2' : 'y1';
|
|
10
|
-
},
|
|
11
|
-
rectOffset(position) {
|
|
12
|
-
return position === 'top' ? 'y1' : 'y2';
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
y: {
|
|
16
|
-
pos: 'y',
|
|
17
|
-
len: 'height',
|
|
18
|
-
dir: 'vertical',
|
|
19
|
-
rectStart: 'y2',
|
|
20
|
-
rectEnd: 'y1',
|
|
21
|
-
rectOffsetCounter(position) {
|
|
22
|
-
return position === 'left' ? 'x2' : 'x1';
|
|
23
|
-
},
|
|
24
|
-
rectOffset(position) {
|
|
25
|
-
return position === 'left' ? 'x1' : 'x2';
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const CHART_DATA_STRUCT = {
|
|
31
|
-
bar: 'array',
|
|
32
|
-
line: 'array',
|
|
33
|
-
scatter: 'array',
|
|
34
|
-
pie: 'array',
|
|
35
|
-
sunburst: 'tree',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const CHART_AXIS_TYPE = {
|
|
39
|
-
bar: 'axis',
|
|
40
|
-
line: 'axis',
|
|
41
|
-
scatter: 'axis',
|
|
42
|
-
pie: 'axisless',
|
|
43
|
-
sunburst: 'axisless',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const TIME_INTERVALS = {
|
|
47
|
-
millisecond: {
|
|
48
|
-
common: true,
|
|
49
|
-
size: 1,
|
|
50
|
-
steps: [1, 2, 5, 10, 20, 50, 100, 250, 500],
|
|
51
|
-
},
|
|
52
|
-
second: {
|
|
53
|
-
common: true,
|
|
54
|
-
size: 1000,
|
|
55
|
-
steps: [1, 2, 5, 10, 30],
|
|
56
|
-
},
|
|
57
|
-
minute: {
|
|
58
|
-
common: true,
|
|
59
|
-
size: 60000,
|
|
60
|
-
steps: [1, 2, 5, 10, 30],
|
|
61
|
-
},
|
|
62
|
-
hour: {
|
|
63
|
-
common: true,
|
|
64
|
-
size: 3600000,
|
|
65
|
-
steps: [1, 2, 3, 6, 12],
|
|
66
|
-
},
|
|
67
|
-
day: {
|
|
68
|
-
common: true,
|
|
69
|
-
size: 86400000,
|
|
70
|
-
steps: [1, 2, 5],
|
|
71
|
-
},
|
|
72
|
-
week: {
|
|
73
|
-
common: false,
|
|
74
|
-
size: 604800000,
|
|
75
|
-
steps: [1, 2, 3, 4],
|
|
76
|
-
},
|
|
77
|
-
month: {
|
|
78
|
-
common: true,
|
|
79
|
-
size: 2.628e9,
|
|
80
|
-
steps: [1, 2, 3],
|
|
81
|
-
},
|
|
82
|
-
quarter: {
|
|
83
|
-
common: false,
|
|
84
|
-
size: 7.884e9,
|
|
85
|
-
steps: [1, 2, 3, 4],
|
|
86
|
-
},
|
|
87
|
-
year: {
|
|
88
|
-
common: true,
|
|
89
|
-
size: 3.154e10,
|
|
90
|
-
},
|
|
91
|
-
};
|