evui 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -27
- package/{src/webfonts/fa-regular-400.svg → dist/82f60bd0b94a1ed68b1e6e309ce2e8c3.svg} +366 -366
- package/{src/webfonts/EVUI.svg → dist/91c6092c0a9164541a69045d746b9e78.svg} +183 -183
- package/{src/webfonts/fa-solid-900.svg → dist/962a1bf31c081691065fe333d9fa8105.svg} +1518 -1518
- package/{src/webfonts/fa-brands-400.svg → dist/a1a749e89f578a49306ec2b055c073da.svg} +1008 -1008
- package/dist/evui.min.js +304 -0
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -0
- package/dist/main.css +5161 -0
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -0
- package/package.json +125 -125
- package/src/code/checkbox.js +0 -12
- package/src/common/utils.js +0 -95
- package/src/common/utils.table.js +0 -78
- package/src/components/button/button.vue +0 -318
- package/src/components/button/index.js +0 -3
- package/src/components/chart/chart.core.js +0 -406
- package/src/components/chart/chart.vue +0 -332
- 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 -116
- 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/chart/element/element.bar.js +0 -117
- package/src/components/chart/element/element.line.js +0 -137
- package/src/components/chart/element/element.scatter.js +0 -76
- package/src/components/chart/helpers/helpers.canvas.js +0 -143
- package/src/components/chart/helpers/helpers.constant.js +0 -119
- package/src/components/chart/helpers/helpers.util.js +0 -109
- package/src/components/chart/index.js +0 -4
- package/src/components/chart/model/index.js +0 -4
- package/src/components/chart/model/model.series.js +0 -57
- package/src/components/chart/model/model.store.js +0 -165
- package/src/components/chart/plugins/plugins.legend.js +0 -447
- package/src/components/chart/plugins/plugins.title.js +0 -33
- package/src/components/chart/scale/scale.js +0 -210
- package/src/components/chart/scale/scale.linear.js +0 -18
- package/src/components/chart/scale/scale.logarithmic.js +0 -95
- package/src/components/chart/scale/scale.step.js +0 -160
- package/src/components/chart/scale/scale.time.js +0 -22
- package/src/components/checkbox/checkbox-group.vue +0 -72
- package/src/components/checkbox/checkbox.vue +0 -276
- package/src/components/checkbox/index.js +0 -3
- package/src/components/checkbox-group/index.js +0 -3
- package/src/components/codeview/code.vue +0 -242
- package/src/components/datepicker/calendar.core.js +0 -1827
- package/src/components/datepicker/calendar.vue +0 -86
- package/src/components/datepicker/datepicker.vue +0 -630
- package/src/components/datepicker/index.js +0 -3
- package/src/components/icon/icon.vue +0 -31
- package/src/components/icon/index.js +0 -3
- package/src/components/input/index.js +0 -3
- package/src/components/input/input.number.vue +0 -440
- package/src/components/label/index.js +0 -3
- package/src/components/label/label.vue +0 -86
- package/src/components/loadingmask/index.js +0 -3
- package/src/components/loadingmask/loadingmask.vue +0 -138
- package/src/components/loginfield/index.js +0 -3
- package/src/components/loginfield/loginfield.vue +0 -330
- package/src/components/menu/index.js +0 -5
- package/src/components/menu/menu.context.children.vue +0 -201
- package/src/components/menu/menu.context.vue +0 -144
- package/src/components/menu/menu.nav.vue +0 -123
- package/src/components/radio/index.js +0 -3
- package/src/components/radio/radio-group.vue +0 -54
- package/src/components/radio/radio.vue +0 -176
- package/src/components/radio-group/index.js +0 -3
- package/src/components/selectbox/dropdown.vue +0 -185
- package/src/components/selectbox/index.js +0 -3
- package/src/components/selectbox/listbox.vue +0 -116
- package/src/components/selectbox/option.vue +0 -11
- package/src/components/selectbox/selectbox.vue +0 -677
- package/src/components/slider/index.js +0 -3
- package/src/components/slider/slider-tooltip.vue +0 -119
- package/src/components/slider/slider.vue +0 -483
- package/src/components/splitter/index.js +0 -3
- package/src/components/splitter/splitter.vue +0 -284
- package/src/components/summary/index.js +0 -3
- package/src/components/summary/summary.vue +0 -138
- package/src/components/table/data.json +0 -1000
- package/src/components/table/data2.json +0 -1000
- package/src/components/table/index.js +0 -3
- package/src/components/table/table.black.css +0 -547
- package/src/components/table/table.filter.lite.vue +0 -170
- package/src/components/table/table.filter.vue +0 -112
- package/src/components/table/table.grey.css +0 -539
- package/src/components/table/table.navy.css +0 -536
- package/src/components/table/table.vue +0 -1380
- package/src/components/tabs/index.js +0 -14
- package/src/components/tabs/jun/tab.vue +0 -123
- package/src/components/tabs/jun/tabs.vue +0 -484
- package/src/components/tabs/tab-panel.vue +0 -39
- package/src/components/tabs/tabs.vue +0 -446
- package/src/components/textfield/index.js +0 -3
- package/src/components/textfield/textfield.vue +0 -418
- package/src/components/timepicker/index.js +0 -3
- package/src/components/timepicker/spinner.vue +0 -205
- package/src/components/timepicker/timepicker.vue +0 -492
- package/src/components/toggle/index.js +0 -3
- package/src/components/toggle/toggle.vue +0 -364
- package/src/components/tree/index.js +0 -7
- package/src/components/tree/tree.table.black.css +0 -680
- package/src/components/tree/tree.table.grey.css +0 -675
- package/src/components/tree/tree.table.vue +0 -795
- package/src/components/tree/tree.util.js +0 -119
- package/src/components/window/index.js +0 -3
- package/src/components/window/window.vue +0 -614
- package/src/index.js +0 -82
- package/src/styles/all.css +0 -5
- package/src/styles/codemirror.css +0 -346
- package/src/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
- package/src/webfonts/NanumGothicBold.ttf +0 -0
- /package/{src/webfonts/fa-solid-900.woff2 → dist/0ab54153eeeca0ce03978cc463b257f7.woff2} +0 -0
- /package/{src/webfonts/fa-brands-400.eot → dist/13db00b7a34fee4d819ab7f9838cc428.eot} +0 -0
- /package/{src/webfonts/EVUI.ttf → dist/3c9453211570a4ede66a4b4954a32bbb.ttf} +0 -0
- /package/{src/webfonts/fa-regular-400.eot → dist/701ae6abd4719e9c2ada3535a497b341.eot} +0 -0
- /package/{src/webfonts/NanumGothic.ttf → dist/7583da5c07275cd5eb364507616f998f.ttf} +0 -0
- /package/{src/webfonts/fa-solid-900.eot → dist/8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot} +0 -0
- /package/{src/webfonts/fa-brands-400.woff → dist/a046592bac8f2fd96e994733faf3858c.woff} +0 -0
- /package/{src/webfonts/fa-regular-400.ttf → dist/ad97afd3337e8cda302d10ff5a4026b8.ttf} +0 -0
- /package/{src/images/evui_icon.png → dist/adac9fa4f723f9d2cb5b6640517114a9.png} +0 -0
- /package/{src/webfonts/fa-solid-900.ttf → dist/b87b9ba532ace76ae9f6edfe9f72ded2.ttf} +0 -0
- /package/{src/webfonts/EVUI.eot → dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot} +0 -0
- /package/{src/webfonts/fa-brands-400.ttf → dist/c5ebe0b32dc1b5cc449a76c4204d13bb.ttf} +0 -0
- /package/{src/webfonts/fa-regular-400.woff2 → dist/cd6c777f1945164224dee082abaea03a.woff2} +0 -0
- /package/{src/webfonts/fa-brands-400.woff2 → dist/e8c322de9658cbeb8a774b6624167c2c.woff2} +0 -0
- /package/{src/webfonts/fa-regular-400.woff → dist/ef60a4f6c25ef7f39f2d25a748dbecfe.woff} +0 -0
- /package/{src/webfonts/EVUI.woff → dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff} +0 -0
- /package/{src/webfonts/fa-solid-900.woff → dist/faff92145777a3cbaf8e7367b4807987.woff} +0 -0
|
@@ -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,116 +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 COLOR = [
|
|
31
|
-
'#2b99f0', '#8ac449', '#00C4C5', '#ffde00', '#ff7781', '#8470ff', '#75cd8e',
|
|
32
|
-
'#48d1cc', '#fec64f', '#fe984f', '#0052ff', '#00a48c', '#83cfde', '#dfe32d',
|
|
33
|
-
'#ff7d40', '#99c7ff', '#a5fee3', '#0379c9', '#eef093', '#ffa891', '#00c5cd',
|
|
34
|
-
'#009bc7', '#cacaff', '#ffc125', '#df6264',
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
export const LINE_OPTION = {
|
|
38
|
-
color: '#000', // this.chartOptions.colors[skey.length]
|
|
39
|
-
show: true,
|
|
40
|
-
highlight: {
|
|
41
|
-
pointSize: 5,
|
|
42
|
-
},
|
|
43
|
-
xAxisIndex: 0,
|
|
44
|
-
yAxisIndex: 0,
|
|
45
|
-
point: true,
|
|
46
|
-
pointSize: 4,
|
|
47
|
-
pointStyle: '',
|
|
48
|
-
pointFill: '#000',
|
|
49
|
-
lineWidth: 2,
|
|
50
|
-
fill: false,
|
|
51
|
-
fillColor: '#000',
|
|
52
|
-
fiillOpacity: 0.4,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const CHART_DATA_STRUCT = {
|
|
56
|
-
bar: 'array',
|
|
57
|
-
line: 'array',
|
|
58
|
-
scatter: 'array',
|
|
59
|
-
pie: 'array',
|
|
60
|
-
sunburst: 'tree',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const CHART_AXIS_TYPE = {
|
|
64
|
-
bar: 'axis',
|
|
65
|
-
line: 'axis',
|
|
66
|
-
scatter: 'axis',
|
|
67
|
-
pie: 'axisless',
|
|
68
|
-
sunburst: 'axisless',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const TIME_INTERVALS = {
|
|
72
|
-
millisecond: {
|
|
73
|
-
common: true,
|
|
74
|
-
size: 1,
|
|
75
|
-
steps: [1, 2, 5, 10, 20, 50, 100, 250, 500],
|
|
76
|
-
},
|
|
77
|
-
second: {
|
|
78
|
-
common: true,
|
|
79
|
-
size: 1000,
|
|
80
|
-
steps: [1, 2, 5, 10, 30],
|
|
81
|
-
},
|
|
82
|
-
minute: {
|
|
83
|
-
common: true,
|
|
84
|
-
size: 60000,
|
|
85
|
-
steps: [1, 2, 5, 10, 30],
|
|
86
|
-
},
|
|
87
|
-
hour: {
|
|
88
|
-
common: true,
|
|
89
|
-
size: 3600000,
|
|
90
|
-
steps: [1, 2, 3, 6, 12],
|
|
91
|
-
},
|
|
92
|
-
day: {
|
|
93
|
-
common: true,
|
|
94
|
-
size: 86400000,
|
|
95
|
-
steps: [1, 2, 5],
|
|
96
|
-
},
|
|
97
|
-
week: {
|
|
98
|
-
common: false,
|
|
99
|
-
size: 604800000,
|
|
100
|
-
steps: [1, 2, 3, 4],
|
|
101
|
-
},
|
|
102
|
-
month: {
|
|
103
|
-
common: true,
|
|
104
|
-
size: 2.628e9,
|
|
105
|
-
steps: [1, 2, 3],
|
|
106
|
-
},
|
|
107
|
-
quarter: {
|
|
108
|
-
common: false,
|
|
109
|
-
size: 7.884e9,
|
|
110
|
-
steps: [1, 2, 3, 4],
|
|
111
|
-
},
|
|
112
|
-
year: {
|
|
113
|
-
common: true,
|
|
114
|
-
size: 3.154e10,
|
|
115
|
-
},
|
|
116
|
-
};
|