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,172 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash-es';
|
|
2
|
-
import DataStore from './data';
|
|
3
|
-
|
|
4
|
-
export default class SunburstDataStore extends DataStore {
|
|
5
|
-
init() {
|
|
6
|
-
this.initTreeData();
|
|
7
|
-
this.createTreeDummy();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getSeriesExtends(defaultSeries, param) { // eslint-disable-line class-methods-use-this
|
|
11
|
-
const extSeries = {
|
|
12
|
-
oData: param.data || null,
|
|
13
|
-
cData: null,
|
|
14
|
-
children: param.children === undefined ? [] : param.children,
|
|
15
|
-
parentIndex: null,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return _.merge(defaultSeries, extSeries);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
initTreeData() {
|
|
22
|
-
const series = this.chartData.series;
|
|
23
|
-
const lvl = 0;
|
|
24
|
-
|
|
25
|
-
for (let ix = 0, ixLen = series.length; ix < ixLen; ix++) {
|
|
26
|
-
this.addSeries(series[ix]);
|
|
27
|
-
|
|
28
|
-
const seriesNode = this.seriesList[this.seriesList.length - 1];
|
|
29
|
-
seriesNode.lvl = lvl;
|
|
30
|
-
seriesNode.parentIndex = -1;
|
|
31
|
-
seriesNode.data = seriesNode.oData;
|
|
32
|
-
|
|
33
|
-
const pIndex = seriesNode.parentIndex;
|
|
34
|
-
|
|
35
|
-
if (!this.seriesGroupList[lvl]) {
|
|
36
|
-
this.seriesGroupList[lvl] = {};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (!this.seriesGroupList[lvl][pIndex]) {
|
|
40
|
-
this.seriesGroupList[lvl][pIndex] = { totalValue: 0, node: [] };
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
this.seriesGroupList[lvl][pIndex].totalValue += seriesNode.data;
|
|
44
|
-
this.seriesGroupList[lvl][pIndex].node.push({
|
|
45
|
-
parentIndex: seriesNode.parentIndex,
|
|
46
|
-
seriesIndex: seriesNode.seriesIndex,
|
|
47
|
-
data: seriesNode.data,
|
|
48
|
-
hasChild: !!seriesNode.children.length,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
for (let jx = 0, jxLen = seriesNode.children.length; jx < jxLen; jx++) {
|
|
52
|
-
this.traversalDFS(seriesNode.children[jx], seriesNode.seriesIndex);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
traversalDFS(item, parentIndex) {
|
|
58
|
-
this.addSeries(item);
|
|
59
|
-
const seriesNode = this.seriesList[this.seriesList.length - 1];
|
|
60
|
-
const lvl = this.seriesList[parentIndex].lvl + 1;
|
|
61
|
-
|
|
62
|
-
seriesNode.lvl = lvl;
|
|
63
|
-
seriesNode.parentIndex = parentIndex;
|
|
64
|
-
seriesNode.data = item.data;
|
|
65
|
-
|
|
66
|
-
if (!this.seriesGroupList[lvl]) {
|
|
67
|
-
this.seriesGroupList[lvl] = {};
|
|
68
|
-
}
|
|
69
|
-
if (!this.seriesGroupList[lvl][parentIndex]) {
|
|
70
|
-
this.seriesGroupList[lvl][parentIndex] = { totalValue: 0, node: [] };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
this.seriesGroupList[lvl][parentIndex].totalValue += seriesNode.data;
|
|
74
|
-
this.seriesGroupList[lvl][parentIndex].node.push({
|
|
75
|
-
parentIndex: seriesNode.parentIndex,
|
|
76
|
-
seriesIndex: seriesNode.seriesIndex,
|
|
77
|
-
data: seriesNode.data,
|
|
78
|
-
hasChild: !!seriesNode.children.length,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
for (let ix = 0, ixLen = seriesNode.children.length; ix < ixLen; ix++) {
|
|
82
|
-
this.traversalDFS(seriesNode.children[ix], seriesNode.seriesIndex);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
createTreeDummy() {
|
|
87
|
-
let node;
|
|
88
|
-
let keys;
|
|
89
|
-
|
|
90
|
-
for (let ix = 0, ixLen = this.seriesGroupList.length - 1; ix < ixLen; ix++) {
|
|
91
|
-
keys = Object.keys(this.seriesGroupList[ix]);
|
|
92
|
-
for (let jx = 0, jxLen = keys.length; jx < jxLen; jx++) {
|
|
93
|
-
node = this.seriesGroupList[ix][keys[jx]].node;
|
|
94
|
-
|
|
95
|
-
for (let kx = 0, kxLen = node.length; kx < kxLen; kx++) {
|
|
96
|
-
if (!node[kx].hasChild) {
|
|
97
|
-
this.seriesGroupList[ix + 1][node[kx].seriesIndex] = {
|
|
98
|
-
totalValue: node[kx].data,
|
|
99
|
-
node: [{
|
|
100
|
-
parentIndex: node[kx].seriesIndex,
|
|
101
|
-
seriesIndex: this.seriesList.length,
|
|
102
|
-
data: node[kx].data,
|
|
103
|
-
hasChild: false,
|
|
104
|
-
isDummy: true,
|
|
105
|
-
}],
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
addValue(seriesIndex, value, dataIndex) {
|
|
114
|
-
if (this.seriesList === undefined) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
// category 형태의 데이터냐 아니냐에 따라 x,y 처리
|
|
118
|
-
const series = this.seriesList[seriesIndex];
|
|
119
|
-
const tempValue = {};
|
|
120
|
-
let dataIdx = dataIndex;
|
|
121
|
-
|
|
122
|
-
if (!series) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (dataIndex === null || dataIndex === undefined) {
|
|
127
|
-
dataIdx = series.data.length;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (!this.seriesGroupList[dataIdx]) {
|
|
131
|
-
this.seriesGroupList[dataIdx] = [];
|
|
132
|
-
}
|
|
133
|
-
this.seriesGroupList[dataIdx].push({ seriesIndex, data: value, show: series.show });
|
|
134
|
-
|
|
135
|
-
series.cData[dataIdx] = value;
|
|
136
|
-
series.oData[dataIdx] = value;
|
|
137
|
-
|
|
138
|
-
if (series.show) {
|
|
139
|
-
this.setMinMaxValue(series, tempValue, dataIdx);
|
|
140
|
-
this.setMaxLabelWidth(tempValue);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
getSeriesGroupList() {
|
|
145
|
-
return this.seriesGroupList;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
updateData() {
|
|
149
|
-
this.maxValueInfo = {
|
|
150
|
-
x: null,
|
|
151
|
-
y: null,
|
|
152
|
-
index: null,
|
|
153
|
-
seriesIndex: null,
|
|
154
|
-
};
|
|
155
|
-
this.minValueInfo = {
|
|
156
|
-
x: null,
|
|
157
|
-
y: null,
|
|
158
|
-
index: null,
|
|
159
|
-
seriesIndex: null,
|
|
160
|
-
};
|
|
161
|
-
this.labelTextMaxInfo = {
|
|
162
|
-
xLen: 0,
|
|
163
|
-
xText: '',
|
|
164
|
-
yLen: 0,
|
|
165
|
-
yText: '',
|
|
166
|
-
};
|
|
167
|
-
this.seriesGroupList.length = 0;
|
|
168
|
-
this.seriesList.length = 0;
|
|
169
|
-
this.initTreeData();
|
|
170
|
-
this.createTreeDummy();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _merge from 'lodash/merge';
|
|
2
|
-
import { COLOR, BAR_OPTION } from '../helpers/helpers.constant';
|
|
3
|
-
import Canvas from '../helpers/helpers.canvas';
|
|
4
|
-
|
|
5
|
-
class Bar {
|
|
6
|
-
constructor(sId, opt, sIdx) {
|
|
7
|
-
const merged = _merge({}, BAR_OPTION, opt);
|
|
8
|
-
Object.keys(merged).forEach((key) => {
|
|
9
|
-
this[key] = merged[key];
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
if (this.name === undefined) {
|
|
13
|
-
this.name = `series-${sIdx}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (this.color === undefined) {
|
|
17
|
-
this.color = COLOR[sIdx];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.sId = sId;
|
|
21
|
-
this.data = [];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
draw(param) {
|
|
25
|
-
if (!this.show) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const ctx = param.ctx;
|
|
30
|
-
const chartRect = param.chartRect;
|
|
31
|
-
const labelOffset = param.labelOffset;
|
|
32
|
-
const axesSteps = param.axesSteps;
|
|
33
|
-
const index = param.showIndex;
|
|
34
|
-
const isHorizontal = param.isHorizontal;
|
|
35
|
-
const labels = param.integLabels;
|
|
36
|
-
const thickness = param.thickness;
|
|
37
|
-
const showSeriesCount = param.showSeriesCount;
|
|
38
|
-
|
|
39
|
-
let x;
|
|
40
|
-
let y;
|
|
41
|
-
|
|
42
|
-
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
43
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
44
|
-
|
|
45
|
-
const xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
|
|
46
|
-
const yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
|
|
47
|
-
const xsp = chartRect.x1 + labelOffset.left;
|
|
48
|
-
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
49
|
-
|
|
50
|
-
const dArea = isHorizontal ? yArea : xArea;
|
|
51
|
-
const cArea = dArea / (labels.length || 1);
|
|
52
|
-
const cPad = 2;
|
|
53
|
-
|
|
54
|
-
let bArea;
|
|
55
|
-
if (this.isExistGrp) {
|
|
56
|
-
bArea = (cArea - (cPad * 2));
|
|
57
|
-
} else {
|
|
58
|
-
bArea = (cArea - (cPad * 2)) / showSeriesCount;
|
|
59
|
-
}
|
|
60
|
-
let w = isHorizontal ? null : Math.round(bArea * thickness);
|
|
61
|
-
let h = isHorizontal ? Math.round(bArea * thickness) : null;
|
|
62
|
-
|
|
63
|
-
// barArea내에서 barWidth로 빠진 부분을 계산.
|
|
64
|
-
const bPad = isHorizontal ? (bArea - h) / 2 : (bArea - w) / 2;
|
|
65
|
-
// series index에 따라 시작 X값 보정을 위한 변수.
|
|
66
|
-
const barSeriesX = this.isExistGrp ? 1 : index + 1;
|
|
67
|
-
|
|
68
|
-
let categoryPoint = null;
|
|
69
|
-
|
|
70
|
-
ctx.beginPath();
|
|
71
|
-
ctx.fillStyle = this.color;
|
|
72
|
-
|
|
73
|
-
this.data.forEach((item) => {
|
|
74
|
-
const posIdx = labels.indexOf(isHorizontal ? item.y : item.x);
|
|
75
|
-
if (posIdx < 0) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (isHorizontal) {
|
|
80
|
-
categoryPoint = ysp - (cArea * posIdx) - cPad;
|
|
81
|
-
} else {
|
|
82
|
-
categoryPoint = xsp + (cArea * posIdx) + cPad;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (isHorizontal) {
|
|
86
|
-
x = xsp;
|
|
87
|
-
y = Math.round(categoryPoint - ((bArea * barSeriesX) - (h + bPad)));
|
|
88
|
-
} else {
|
|
89
|
-
x = Math.round(categoryPoint + ((bArea * barSeriesX) - (w + bPad)));
|
|
90
|
-
y = ysp;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (isHorizontal) {
|
|
94
|
-
if (item.b) {
|
|
95
|
-
w = Canvas.calculateX(item.x - item.b, minmaxX.graphMin, minmaxX.graphMax, xArea);
|
|
96
|
-
x = Canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
97
|
-
} else {
|
|
98
|
-
w = Canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea);
|
|
99
|
-
}
|
|
100
|
-
} else if (item.b) { // vertical stack bar chart
|
|
101
|
-
h = Canvas.calculateY(item.y - item.b, minmaxY.graphMin, minmaxY.graphMax, yArea);
|
|
102
|
-
y = Canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
|
|
103
|
-
} else { // vertical bar chart
|
|
104
|
-
h = Canvas.calculateY(item.y, minmaxY.graphMin, minmaxY.graphMax, yArea);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
ctx.fillRect(x, y, w, isHorizontal ? -h : h);
|
|
108
|
-
|
|
109
|
-
item.xp = x; // eslint-disable-line
|
|
110
|
-
item.yp = y; // eslint-disable-line
|
|
111
|
-
item.w = w; // eslint-disable-line
|
|
112
|
-
item.h = isHorizontal ? -h : h; // eslint-disable-line
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default Bar;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import _merge from 'lodash/merge';
|
|
2
|
-
import { COLOR, LINE_OPTION } from '../helpers/helpers.constant';
|
|
3
|
-
import Util from '../helpers/helpers.util';
|
|
4
|
-
import Canvas from '../helpers/helpers.canvas';
|
|
5
|
-
|
|
6
|
-
class Line {
|
|
7
|
-
constructor(sId, opt, sIdx) {
|
|
8
|
-
const merged = _merge({}, LINE_OPTION, opt);
|
|
9
|
-
Object.keys(merged).forEach((key) => {
|
|
10
|
-
this[key] = merged[key];
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (this.name === undefined) {
|
|
14
|
-
this.name = `series-${sIdx}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
['color', 'pointFill', 'fillColor'].forEach((colorProp) => {
|
|
18
|
-
if (this[colorProp] === undefined) {
|
|
19
|
-
this[colorProp] = COLOR[sIdx];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
this.sId = sId;
|
|
24
|
-
this.data = [];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
draw(param) {
|
|
28
|
-
if (!this.show) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const ctx = param.ctx;
|
|
33
|
-
const chartRect = param.chartRect;
|
|
34
|
-
const labelOffset = param.labelOffset;
|
|
35
|
-
const axesSteps = param.axesSteps;
|
|
36
|
-
|
|
37
|
-
ctx.beginPath();
|
|
38
|
-
ctx.lineJoin = 'round';
|
|
39
|
-
ctx.lineWidth = this.lineWidth;
|
|
40
|
-
ctx.strokeStyle = this.color;
|
|
41
|
-
|
|
42
|
-
if (this.fill) {
|
|
43
|
-
ctx.fillStyle = `rgba(${Util.hexToRgb(this.color)},${this.fillOpacity})` || '';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let startFillIndex = 0;
|
|
47
|
-
const endPoint = chartRect.y2 - labelOffset.bottom;
|
|
48
|
-
|
|
49
|
-
let x;
|
|
50
|
-
let y;
|
|
51
|
-
let aliasPixel;
|
|
52
|
-
let barAreaByCombo = 0;
|
|
53
|
-
|
|
54
|
-
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
55
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
56
|
-
|
|
57
|
-
let xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
|
|
58
|
-
const yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
|
|
59
|
-
|
|
60
|
-
if (this.combo) {
|
|
61
|
-
barAreaByCombo = xArea / (this.data.length || 1);
|
|
62
|
-
xArea -= barAreaByCombo;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const xsp = chartRect.x1 + labelOffset.left + (barAreaByCombo / 2);
|
|
66
|
-
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
67
|
-
|
|
68
|
-
this.data.reduce((prev, curr, ix, item) => {
|
|
69
|
-
x = Canvas.calculateX(curr.x, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
70
|
-
y = Canvas.calculateY(curr.y, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
|
|
71
|
-
|
|
72
|
-
if (x !== null) {
|
|
73
|
-
aliasPixel = Util.aliasPixel(x);
|
|
74
|
-
x += aliasPixel;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (y === null) {
|
|
78
|
-
if (ix - 1 > -1) {
|
|
79
|
-
if (this.fill && prev.y !== null) {
|
|
80
|
-
ctx.stroke();
|
|
81
|
-
ctx.lineTo(prev.xp, endPoint);
|
|
82
|
-
ctx.lineTo(item[startFillIndex].xp, endPoint);
|
|
83
|
-
|
|
84
|
-
ctx.fill();
|
|
85
|
-
ctx.beginPath();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
startFillIndex = ix + 1;
|
|
90
|
-
} else if (ix === 0 || prev.y === null || curr.y === null ||
|
|
91
|
-
prev.x === null || curr.x === null) {
|
|
92
|
-
ctx.moveTo(x, y);
|
|
93
|
-
} else {
|
|
94
|
-
ctx.lineTo(x, y);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
curr.xp = x; // eslint-disable-line
|
|
98
|
-
curr.yp = y; // eslint-disable-line
|
|
99
|
-
|
|
100
|
-
return curr;
|
|
101
|
-
}, this.data[0]);
|
|
102
|
-
|
|
103
|
-
ctx.stroke();
|
|
104
|
-
|
|
105
|
-
const dataLen = this.data.length;
|
|
106
|
-
|
|
107
|
-
if (this.fill && dataLen) {
|
|
108
|
-
ctx.fillStyle = `rgba(${Util.hexToRgb(this.color)},${this.fillOpacity})` || '';
|
|
109
|
-
if (this.stackIndex) {
|
|
110
|
-
this.data.reverse().forEach((curr) => {
|
|
111
|
-
x = Canvas.calculateX(curr.x, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
112
|
-
y = Canvas.calculateY(curr.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
|
|
113
|
-
|
|
114
|
-
ctx.lineTo(x, y);
|
|
115
|
-
});
|
|
116
|
-
} else {
|
|
117
|
-
ctx.lineTo(this.data[dataLen - 1].xp, endPoint);
|
|
118
|
-
ctx.lineTo(this.data[startFillIndex].xp, endPoint);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
ctx.fill();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (this.point) {
|
|
125
|
-
ctx.strokeStyle = this.color;
|
|
126
|
-
ctx.fillStyle = this.pointFill;
|
|
127
|
-
|
|
128
|
-
this.data.forEach((curr) => {
|
|
129
|
-
if (curr.xp !== null && curr.yp !== null) {
|
|
130
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, curr.xp, curr.yp);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export default Line;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _merge from 'lodash/merge';
|
|
2
|
-
import { COLOR, LINE_OPTION } from '../helpers/helpers.constant';
|
|
3
|
-
import Util from '../helpers/helpers.util';
|
|
4
|
-
import Canvas from '../helpers/helpers.canvas';
|
|
5
|
-
|
|
6
|
-
class Scatter {
|
|
7
|
-
constructor(sId, opt, sIdx) {
|
|
8
|
-
const merged = _merge({}, LINE_OPTION, opt);
|
|
9
|
-
Object.keys(merged).forEach((key) => {
|
|
10
|
-
this[key] = merged[key];
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (this.name === undefined) {
|
|
14
|
-
this.name = `series-${sIdx}`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
['color', 'pointFill', 'fillColor'].forEach((colorProp) => {
|
|
18
|
-
if (this[colorProp] === undefined) {
|
|
19
|
-
this[colorProp] = COLOR[sIdx];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
this.sId = sId;
|
|
24
|
-
this.data = [];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
draw(param) {
|
|
28
|
-
if (!this.show) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const ctx = param.ctx;
|
|
33
|
-
const chartRect = param.chartRect;
|
|
34
|
-
const labelOffset = param.labelOffset;
|
|
35
|
-
const axesSteps = param.axesSteps;
|
|
36
|
-
|
|
37
|
-
let x;
|
|
38
|
-
let y;
|
|
39
|
-
let aliasPixel;
|
|
40
|
-
|
|
41
|
-
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
42
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
43
|
-
|
|
44
|
-
const xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
|
|
45
|
-
const yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
|
|
46
|
-
const xsp = chartRect.x1 + labelOffset.left;
|
|
47
|
-
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
48
|
-
|
|
49
|
-
this.data.forEach((item) => {
|
|
50
|
-
x = Canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
51
|
-
y = Canvas.calculateY(item.y, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
|
|
52
|
-
|
|
53
|
-
if (x !== null) {
|
|
54
|
-
aliasPixel = Util.aliasPixel(x);
|
|
55
|
-
x += aliasPixel;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
item.xp = x; // eslint-disable-line
|
|
60
|
-
item.yp = y; // eslint-disable-line
|
|
61
|
-
|
|
62
|
-
return item;
|
|
63
|
-
}, this.data[0]);
|
|
64
|
-
|
|
65
|
-
ctx.strokeStyle = this.color;
|
|
66
|
-
ctx.fillStyle = this.pointFill;
|
|
67
|
-
|
|
68
|
-
this.data.forEach((curr) => {
|
|
69
|
-
if (curr.xp !== null && curr.yp !== null) {
|
|
70
|
-
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, curr.xp, curr.yp);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default Scatter;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
calculateX(value, min, max, area, startPoint = 0) {
|
|
3
|
-
if (value === null) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (value > max || value < min) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const scalingFactor = area / (max - min);
|
|
12
|
-
return Math.ceil(startPoint + (scalingFactor * (value - min)));
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
calculateY(value, min, max, area, startPoint = 0) {
|
|
16
|
-
let calcY;
|
|
17
|
-
|
|
18
|
-
if (value === null) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (value > max || value < min) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
// Bar차트의 fillRect처리를 위해 invert값 추가 하여 Y값을 처리
|
|
26
|
-
const scalingFactor = area / (max - min);
|
|
27
|
-
if (startPoint) {
|
|
28
|
-
calcY = startPoint - (scalingFactor * (value - (min || 0)));
|
|
29
|
-
} else {
|
|
30
|
-
calcY = -(scalingFactor * (value - (min || 0)));
|
|
31
|
-
}
|
|
32
|
-
return Math.floor(calcY);
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
drawPoint(ctx, style, radius, x, y) {
|
|
36
|
-
let edgeLength;
|
|
37
|
-
let xOffset;
|
|
38
|
-
let yOffset;
|
|
39
|
-
let height;
|
|
40
|
-
let size;
|
|
41
|
-
|
|
42
|
-
if (isNaN(radius) || radius <= 0) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let offset;
|
|
47
|
-
let leftX;
|
|
48
|
-
let topY;
|
|
49
|
-
let sideSize;
|
|
50
|
-
|
|
51
|
-
switch (style) {
|
|
52
|
-
// Default includes circle
|
|
53
|
-
case 'triangle':
|
|
54
|
-
ctx.beginPath();
|
|
55
|
-
edgeLength = (3 * radius) / Math.sqrt(3);
|
|
56
|
-
height = (edgeLength * Math.sqrt(3)) / 2;
|
|
57
|
-
ctx.moveTo(x - (edgeLength / 2), y + (height / 3));
|
|
58
|
-
ctx.lineTo(x + (edgeLength / 2), y + (height / 3));
|
|
59
|
-
ctx.lineTo(x, y - ((2 * height) / 3));
|
|
60
|
-
ctx.closePath();
|
|
61
|
-
ctx.fill();
|
|
62
|
-
break;
|
|
63
|
-
case 'rect':
|
|
64
|
-
size = (1 / Math.SQRT2) * radius;
|
|
65
|
-
ctx.beginPath();
|
|
66
|
-
ctx.fillRect(x - size, y - size, 2 * size, 2 * size);
|
|
67
|
-
ctx.strokeRect(x - size, y - size, 2 * size, 2 * size);
|
|
68
|
-
break;
|
|
69
|
-
case 'rectRounded':
|
|
70
|
-
offset = radius / Math.SQRT2;
|
|
71
|
-
leftX = x - offset;
|
|
72
|
-
topY = y - offset;
|
|
73
|
-
sideSize = Math.SQRT2 * radius;
|
|
74
|
-
ctx.beginPath();
|
|
75
|
-
this.roundedRect(ctx, leftX, topY, sideSize, sideSize, radius / 2);
|
|
76
|
-
ctx.closePath();
|
|
77
|
-
ctx.fill();
|
|
78
|
-
break;
|
|
79
|
-
case 'rectRot':
|
|
80
|
-
size = (1 / Math.SQRT2) * radius;
|
|
81
|
-
ctx.beginPath();
|
|
82
|
-
ctx.moveTo(x - size, y);
|
|
83
|
-
ctx.lineTo(x, y + size);
|
|
84
|
-
ctx.lineTo(x + size, y);
|
|
85
|
-
ctx.lineTo(x, y - size);
|
|
86
|
-
ctx.closePath();
|
|
87
|
-
ctx.fill();
|
|
88
|
-
break;
|
|
89
|
-
case 'cross':
|
|
90
|
-
ctx.beginPath();
|
|
91
|
-
ctx.moveTo(x, y + radius);
|
|
92
|
-
ctx.lineTo(x, y - radius);
|
|
93
|
-
ctx.moveTo(x - radius, y);
|
|
94
|
-
ctx.lineTo(x + radius, y);
|
|
95
|
-
ctx.closePath();
|
|
96
|
-
break;
|
|
97
|
-
case 'crossRot':
|
|
98
|
-
ctx.beginPath();
|
|
99
|
-
xOffset = Math.cos(Math.PI / 4) * radius;
|
|
100
|
-
yOffset = Math.sin(Math.PI / 4) * radius;
|
|
101
|
-
ctx.moveTo(x - xOffset, y - yOffset);
|
|
102
|
-
ctx.lineTo(x + xOffset, y + yOffset);
|
|
103
|
-
ctx.moveTo(x - xOffset, y + yOffset);
|
|
104
|
-
ctx.lineTo(x + xOffset, y - yOffset);
|
|
105
|
-
ctx.closePath();
|
|
106
|
-
break;
|
|
107
|
-
case 'star':
|
|
108
|
-
ctx.beginPath();
|
|
109
|
-
ctx.moveTo(x, y + radius);
|
|
110
|
-
ctx.lineTo(x, y - radius);
|
|
111
|
-
ctx.moveTo(x - radius, y);
|
|
112
|
-
ctx.lineTo(x + radius, y);
|
|
113
|
-
xOffset = Math.cos(Math.PI / 4) * radius;
|
|
114
|
-
yOffset = Math.sin(Math.PI / 4) * radius;
|
|
115
|
-
ctx.moveTo(x - xOffset, y - yOffset);
|
|
116
|
-
ctx.lineTo(x + xOffset, y + yOffset);
|
|
117
|
-
ctx.moveTo(x - xOffset, y + yOffset);
|
|
118
|
-
ctx.lineTo(x + xOffset, y - yOffset);
|
|
119
|
-
ctx.closePath();
|
|
120
|
-
break;
|
|
121
|
-
case 'line':
|
|
122
|
-
ctx.beginPath();
|
|
123
|
-
ctx.moveTo(x - radius, y);
|
|
124
|
-
ctx.lineTo(x + radius, y);
|
|
125
|
-
ctx.closePath();
|
|
126
|
-
break;
|
|
127
|
-
case 'dash':
|
|
128
|
-
ctx.beginPath();
|
|
129
|
-
ctx.moveTo(x, y);
|
|
130
|
-
ctx.lineTo(x + radius, y);
|
|
131
|
-
ctx.closePath();
|
|
132
|
-
break;
|
|
133
|
-
default:
|
|
134
|
-
ctx.beginPath();
|
|
135
|
-
ctx.arc(x, y, radius, 0, Math.PI * 2);
|
|
136
|
-
ctx.closePath();
|
|
137
|
-
ctx.fill();
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
ctx.stroke();
|
|
142
|
-
},
|
|
143
|
-
};
|