evui 2.1.0 → 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.
Files changed (189) hide show
  1. package/dist/{adac9fa4f723f9d2cb5b6640517114a9.png → 0b8d1200e71cae8d747dce4e69c4efb6.png} +0 -0
  2. package/dist/1.css +4 -0
  3. package/dist/1.css.map +1 -0
  4. package/dist/1.evui.min.js +2 -0
  5. package/dist/1.evui.min.js.map +1 -0
  6. package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
  7. package/dist/2.css +4 -0
  8. package/dist/2.css.map +1 -0
  9. package/dist/2.evui.min.js +2 -0
  10. package/dist/2.evui.min.js.map +1 -0
  11. package/dist/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 278156e41e0ad908cf7f841b17130502.woff2} +0 -0
  12. package/dist/3.evui.min.js +2 -0
  13. package/dist/3.evui.min.js.map +1 -0
  14. package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
  15. package/dist/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 38c6d8bab26db77d8c806813e1497763.woff2} +0 -0
  16. package/dist/4.evui.min.js +2 -0
  17. package/dist/4.evui.min.js.map +1 -0
  18. package/dist/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
  19. package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
  20. package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
  21. package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
  22. package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
  23. package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
  24. package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
  25. package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
  26. package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
  27. package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
  28. package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
  29. package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
  30. package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
  31. package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
  32. package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
  33. package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
  34. package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
  35. package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
  36. package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
  37. package/dist/evui.min.js +6 -86054
  38. package/dist/evui.min.js.gz +0 -0
  39. package/dist/evui.min.js.map +1 -1
  40. package/dist/main.css +43 -5541
  41. package/dist/main.css.gz +0 -0
  42. package/dist/main.css.map +1 -1
  43. package/package.json +56 -76
  44. package/src/common/emitter.js +20 -0
  45. package/src/common/utils.debounce.js +223 -0
  46. package/src/common/utils.js +51 -17
  47. package/src/common/utils.throttle.js +83 -0
  48. package/src/common/utils.tree.js +18 -0
  49. package/src/components/button/button.vue +316 -241
  50. package/src/components/chart/chart.core.js +378 -85
  51. package/src/components/chart/chart.vue +133 -115
  52. package/src/components/chart/element/element.bar.js +219 -25
  53. package/src/components/chart/element/element.bar.time.js +115 -0
  54. package/src/components/chart/element/element.line.js +172 -21
  55. package/src/components/chart/element/element.pie.js +86 -0
  56. package/src/components/chart/element/element.scatter.js +9 -2
  57. package/src/components/chart/element/element.tip.js +356 -0
  58. package/src/components/chart/helpers/helpers.canvas.js +94 -0
  59. package/src/components/chart/helpers/helpers.constant.js +25 -6
  60. package/src/components/chart/helpers/helpers.util.js +83 -38
  61. package/src/components/chart/index.js +0 -1
  62. package/src/components/chart/model/model.series.js +43 -14
  63. package/src/components/chart/model/model.store.js +440 -46
  64. package/src/components/chart/plugins/plugins.interaction.js +324 -0
  65. package/src/components/chart/plugins/plugins.legend.js +233 -91
  66. package/src/components/chart/plugins/plugins.pie.js +179 -0
  67. package/src/components/chart/plugins/plugins.title.js +25 -2
  68. package/src/components/chart/plugins/plugins.tooltip.js +384 -0
  69. package/src/components/chart/scale/scale.js +91 -29
  70. package/src/components/chart/scale/scale.linear.js +12 -0
  71. package/src/components/chart/scale/scale.logarithmic.js +25 -0
  72. package/src/components/chart/scale/scale.step.js +89 -52
  73. package/src/components/chart/scale/scale.time.category.js +204 -0
  74. package/src/components/chart/scale/scale.time.js +19 -1
  75. package/src/components/checkbox/checkbox-group.vue +15 -11
  76. package/src/components/checkbox/checkbox.vue +210 -138
  77. package/src/components/codeview/code.vue +42 -29
  78. package/src/components/contextmenu/contextmenu.child.vue +79 -0
  79. package/src/components/contextmenu/contextmenu.vue +276 -0
  80. package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
  81. package/src/components/contextmenu/index.js +3 -0
  82. package/src/components/datepicker/calendar.core.js +588 -492
  83. package/src/components/datepicker/calendar.vue +0 -3
  84. package/src/components/datepicker/datepicker.vue +43 -15
  85. package/src/components/datepicker/index.js +5 -1
  86. package/src/components/grid/grid.filter.vue +290 -0
  87. package/src/components/grid/grid.filter.window.vue +411 -0
  88. package/src/components/grid/grid.render.vue +45 -0
  89. package/src/components/grid/grid.vue +1338 -0
  90. package/src/components/icon/icon.vue +22 -7
  91. package/src/components/input/input.number.vue +309 -277
  92. package/src/components/label/label.vue +2 -2
  93. package/src/components/loadingmask/loadingmask.vue +6 -13
  94. package/src/components/loginfield/loginfield.vue +46 -37
  95. package/src/components/markdown/index.js +3 -0
  96. package/src/components/markdown/markdown.vue +1001 -0
  97. package/src/components/menu/index.js +1 -3
  98. package/src/components/menu/menu.nav.item.vue +115 -0
  99. package/src/components/menu/menu.nav.sub.vue +42 -0
  100. package/src/components/menu/menu.nav.vue +71 -98
  101. package/src/components/message/index.js +3 -0
  102. package/src/components/message/message.js +63 -0
  103. package/src/components/message/message.vue +191 -0
  104. package/src/components/message-box/index.js +3 -0
  105. package/src/components/message-box/message-box.js +31 -0
  106. package/src/components/message-box/message-box.vue +298 -0
  107. package/src/components/notification/index.js +3 -0
  108. package/src/components/notification/notification.js +75 -0
  109. package/src/components/notification/notification.vue +242 -0
  110. package/src/components/radio/radio-group.vue +6 -2
  111. package/src/components/radio/radio.vue +156 -76
  112. package/src/components/selectbox/dropdown.vue +86 -40
  113. package/src/components/selectbox/listbox.vue +47 -18
  114. package/src/components/selectbox/option.vue +1 -1
  115. package/src/components/selectbox/selectbox.vue +304 -316
  116. package/src/components/slider/slider-tooltip.vue +7 -7
  117. package/src/components/slider/slider.vue +20 -25
  118. package/src/components/splitter/splitter.vue +104 -94
  119. package/src/components/table/table.black.css +1 -1
  120. package/src/components/table/table.filter.lite.vue +7 -7
  121. package/src/components/table/table.filter.vue +1 -1
  122. package/src/components/table/table.grey.css +5 -6
  123. package/src/components/table/table.navy.css +1 -1
  124. package/src/components/table/table.vue +55 -48
  125. package/src/components/tabs/tab-panel.vue +19 -5
  126. package/src/components/tabs/tabs.vue +182 -87
  127. package/src/components/textfield/textfield.vue +110 -87
  128. package/src/components/timepicker/index.js +2 -2
  129. package/src/components/timepicker/spinner.vue +15 -17
  130. package/src/components/timepicker/timepicker.vue +98 -53
  131. package/src/components/toggle/toggle.vue +148 -109
  132. package/src/components/tree/index.js +2 -6
  133. package/src/components/tree/render.js +17 -0
  134. package/src/components/tree/tree-node.vue +214 -0
  135. package/src/components/tree/tree.vue +296 -0
  136. package/src/components/tree-table/index.js +7 -0
  137. package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
  138. package/src/components/{tree → tree-table}/tree.table.grey.css +0 -0
  139. package/src/components/{tree → tree-table}/tree.table.vue +36 -41
  140. package/src/components/{tree → tree-table}/tree.util.js +0 -0
  141. package/src/components/window/window.vue +238 -191
  142. package/src/index.js +25 -12
  143. package/src/styles/base/base.scss +50 -0
  144. package/src/styles/base/index.scss +1 -0
  145. package/src/styles/default.scss +5 -0
  146. package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
  147. package/src/styles/{all.css → lib/fontawesome.css} +1 -1
  148. package/src/styles/lib/icon.css +792 -0
  149. package/src/styles/themes/index.scss +2 -0
  150. package/src/styles/themes/mixin.scss +33 -0
  151. package/src/styles/themes/variables.scss +206 -0
  152. package/src/styles/utils/colors.scss +222 -0
  153. package/src/styles/utils/index.scss +2 -0
  154. package/src/styles/utils/mixins.scss +34 -0
  155. package/src/styles/utils/variables.scss +27 -0
  156. package/src/webfonts/EVUI.eot +0 -0
  157. package/src/webfonts/EVUI.svg +251 -173
  158. package/src/webfonts/EVUI.ttf +0 -0
  159. package/src/webfonts/EVUI.woff +0 -0
  160. package/src/webfonts/Roboto-Bold.ttf +0 -0
  161. package/src/webfonts/Roboto-Medium.ttf +0 -0
  162. package/src/webfonts/Roboto-Regular.ttf +0 -0
  163. package/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
  164. package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
  165. package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
  166. package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
  167. package/src/components/chart/charts/chart.bar.js +0 -334
  168. package/src/components/chart/charts/chart.base.js +0 -1075
  169. package/src/components/chart/charts/chart.line.js +0 -262
  170. package/src/components/chart/charts/chart.pie.js +0 -383
  171. package/src/components/chart/charts/chart.scatter.js +0 -349
  172. package/src/components/chart/charts/chart.sunburst.js +0 -193
  173. package/src/components/chart/core/axis/axis.js +0 -217
  174. package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
  175. package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
  176. package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
  177. package/src/components/chart/core/core.constant.js +0 -116
  178. package/src/components/chart/core/core.legend.js +0 -473
  179. package/src/components/chart/core/core.util.js +0 -66
  180. package/src/components/chart/core/data/data.js +0 -412
  181. package/src/components/chart/core/data/data.pie.js +0 -70
  182. package/src/components/chart/core/data/data.stack.js +0 -222
  183. package/src/components/chart/core/data/data.sunburst.js +0 -172
  184. package/src/components/menu/menu.context.children.vue +0 -201
  185. package/src/components/menu/menu.context.vue +0 -144
  186. package/src/components/tabs/jun/tab.vue +0 -123
  187. package/src/components/tabs/jun/tabs.vue +0 -484
  188. package/src/styles/evui.css +0 -386
  189. package/src/styles/icon.css +0 -557
@@ -1,412 +0,0 @@
1
- import _ from 'lodash-es';
2
- import moment from 'moment';
3
-
4
- export default class DataStore {
5
- constructor(props) {
6
- this.chartOptions = props.chartOptions;
7
- this.chartData = props.chartData;
8
-
9
- this.seriesList = {};
10
- this.graphData = {};
11
-
12
- this.labelList = [];
13
- this.axisList = { x: [], y: [] };
14
- this.xMinMax = [];
15
- this.yMinMax = [];
16
- this.sIdx = 0;
17
- }
18
-
19
- /**
20
- * DataStore Initialize
21
- * if this chart has series of data parameter, add parameter into graphData.
22
- * @exec addSeries(), createChartDataSet();
23
- */
24
- init() {
25
- const series = this.chartData.series;
26
- const seriesKeys = Object.keys(series);
27
-
28
- for (let ix = 0, ixLen = seriesKeys.length; ix < ixLen; ix++) {
29
- this.addSeries(seriesKeys[ix], series[seriesKeys[ix]]);
30
- }
31
-
32
- this.createChartDataSet();
33
- }
34
-
35
- /**
36
- * Add series Information to this.seriesList
37
- * If it has extends props, execute extends function
38
- * @param id (require)
39
- * @param param (require)
40
- * @output this.seriesList[id] = series
41
- * @output this.graphData[id] = []
42
- */
43
- addSeries(id, param) {
44
- if (typeof id !== 'string') {
45
- throw new Error('[EVUI][ERROR][ChartDataStore]-Not found series id value.');
46
- }
47
-
48
- if (typeof param !== 'object') {
49
- throw new Error('[EVUI][ERROR][ChartDataStore]-Not found input series object.');
50
- }
51
-
52
- const skey = Object.keys(this.seriesList);
53
-
54
- let series;
55
- const defaultSeries = {
56
- name: param.name || `series-${this.sIdx++}`,
57
- color: param.color || this.chartOptions.colors[skey.length],
58
- show: param.show === undefined ? true : param.show,
59
- min: null,
60
- max: null,
61
- minIndex: null,
62
- maxIndex: null,
63
- seriesIndex: this.seriesList.length,
64
- data: [],
65
- insertIndex: -1,
66
- dataIndex: 0,
67
- startPoint: 0,
68
- highlight: {
69
- pointSize: param.highlight ? (param.highlight.size || 5) : 5,
70
- },
71
- groupIndex: null,
72
- stackIndex: null,
73
- isExistGrp: false,
74
- };
75
-
76
- if (this.getSeriesExtends) {
77
- series = this.getSeriesExtends(defaultSeries, param);
78
- }
79
-
80
- if (!this.seriesList[id]) {
81
- this.seriesList[id] = series;
82
- }
83
-
84
- if (!this.graphData[id] && this.chartOptions.type !== 'pie') {
85
- this.graphData[id] = [];
86
- }
87
- }
88
-
89
- /**
90
- * Add to extend property.
91
- * @param defaultSeries (require)
92
- * @param param (require)
93
- * @return extended series object
94
- */
95
- getSeriesExtends(defaultSeries, param) {
96
- const chartType = this.chartOptions.type;
97
- const skey = Object.keys(this.seriesList);
98
-
99
- const extSeries = {
100
- xAxisIndex: param.xAxisIndex ? param.xAxisIndex : 0,
101
- yAxisIndex: param.yAxisIndex ? param.yAxisIndex : 0,
102
- point: param.point || chartType === 'scatter',
103
- pointSize: param.pointSize || 4,
104
- pointStyle: param.pointStyle || '',
105
- pointFill: param.pointFill || this.chartOptions.colors[skey.length],
106
- lineWidth: param.lineWidth || 2,
107
- fill: param.fill || false,
108
- fillColor: param.fillColor || this.chartOptions.colors[skey.length],
109
- fillOpacity: param.fillOpacity || 0.4,
110
- };
111
-
112
- return _.merge(defaultSeries, extSeries);
113
- }
114
-
115
- /**
116
- * If this chart has data parameter, execute this function.
117
- * data: [
118
- * ['x', '2018/01', '2018/02', '2018/03', '2018/04', '2018/05'],
119
- * ['series1', 100, 200, 300, 400, 500],
120
- * ],
121
- * must have set axis data.
122
- * @exec this.addAxisDataSet();
123
- * @exec this.graphDataSet
124
- */
125
- createChartDataSet() {
126
- const chartData = this.chartData.data;
127
- const keys = Object.keys(chartData);
128
- const labels = this.chartData.labels;
129
-
130
- let data;
131
-
132
- if (this.chartData.labels) {
133
- this.addAxisLabels(labels);
134
- }
135
-
136
- for (let ix = 0; ix < keys.length; ix++) {
137
- data = chartData[keys[ix]];
138
- this.addGraphDataSet(keys[ix], data);
139
- }
140
- }
141
-
142
- /**
143
- * addAxisLabels (addAxis + addAxisData)
144
- * 데이터 처리를 위한 X축 배열 파싱
145
- * @param labels ex. ['2018/01', '2018/02', '2018/03', '2018/04', '2018/05']
146
- */
147
- addAxisLabels(labels) {
148
- for (let ix = 0, ixLen = labels.length; ix < ixLen; ix++) {
149
- this.addAxisLabel(labels[ix], ix);
150
- }
151
- }
152
-
153
- /**
154
- * addAxisLabel
155
- * @param label string or number (require)
156
- * @param labelIndex number
157
- */
158
- addAxisLabel(label, labelIndex = -1) {
159
- const labelList = this.labelList;
160
- const options = this.chartOptions;
161
- const horizontal = options.horizontal;
162
-
163
- let axisOption;
164
- if (horizontal) {
165
- axisOption = this.chartOptions.yAxes[0];
166
- } else {
167
- axisOption = this.chartOptions.xAxes[0];
168
- }
169
-
170
- let dateObj;
171
- let value;
172
-
173
- if (axisOption.labelType === 'time') {
174
- dateObj = moment(new Date(label));
175
-
176
- if (dateObj.isValid()) {
177
- value = +dateObj;
178
- } else {
179
- value = null;
180
- }
181
- } else {
182
- value = label;
183
- }
184
-
185
-
186
- if (value !== null && value !== undefined && labelList.indexOf(value) < 0) {
187
- if (typeof labelIndex === 'number' && labelIndex > -1) {
188
- labelList[labelIndex] = value;
189
- } else {
190
- labelList.push(value);
191
- }
192
- }
193
-
194
- this.calcAxisLMinMax(value);
195
- }
196
-
197
- /**
198
- * loop for addGraphData
199
- * @param seriesId (require)
200
- * @param data ex. [100,200,300,400,500] or [{ x: '', y: '' }]
201
- */
202
- addGraphDataSet(seriesId, data) {
203
- for (let ix = 0, ixLen = data.length; ix < ixLen; ix++) {
204
- this.addGraphData(seriesId, data[ix]);
205
- }
206
- }
207
-
208
- /**
209
- * addGraphData
210
- * @param seriesId (require)
211
- * @param value graph value
212
- * @param dataIndex dataIndex
213
- */
214
- addGraphData(seriesId, value, dataIndex = -1) {
215
- const options = this.chartOptions;
216
- const horizontal = options.horizontal;
217
-
218
- const series = this.seriesList[seriesId];
219
- const labelIndex = horizontal ? series.yAxisIndex : series.xAxisIndex;
220
- const labelAxisOption = horizontal ? options.yAxes[labelIndex] : options.xAxes[labelIndex];
221
-
222
- const labelAxisType = horizontal ? 'y' : 'x';
223
- const graphAxisType = horizontal ? 'x' : 'y';
224
-
225
- const sgData = this.graphData[seriesId];
226
- const index = (typeof dataIndex === 'number' && dataIndex > -1) ? dataIndex : sgData.length;
227
-
228
- let date;
229
- let ldata;
230
- let gdata;
231
-
232
- if (typeof value === 'object' && value) {
233
- gdata = value[graphAxisType];
234
- ldata = value[labelAxisType];
235
- } else {
236
- if (value === null || isNaN(value)) {
237
- gdata = null;
238
- } else {
239
- gdata = +value;
240
- }
241
-
242
- ldata = this.labelList[index];
243
- }
244
-
245
- if (labelAxisOption.labelType === 'time') {
246
- date = moment(ldata === undefined ? null : new Date(ldata));
247
-
248
- if (date.isValid()) {
249
- ldata = +date;
250
- } else {
251
- ldata = null;
252
- }
253
- }
254
-
255
- if (horizontal) {
256
- sgData[index] = { x: gdata, y: ldata, xp: null, yp: null, w: null, h: null };
257
- } else {
258
- sgData[index] = { x: ldata, y: gdata, xp: null, yp: null, w: null, h: null };
259
- }
260
-
261
- if (series.show) {
262
- this.setMinMaxValue(seriesId, ldata, gdata, index);
263
- }
264
- }
265
-
266
- /**
267
- * set min max value by series
268
- * @param seriesId (require)
269
- * @param labelData domain value
270
- * @param graphData graph value
271
- * @param index dataIndex
272
- */
273
- setMinMaxValue(seriesId, labelData, graphData, index) {
274
- const series = this.seriesList[seriesId];
275
-
276
- if (series.min === null || series.min > graphData) {
277
- series.min = graphData;
278
- series.minIndex = index;
279
- }
280
-
281
- if (series.max === null || series.max < graphData) {
282
- series.max = graphData;
283
- series.maxIndex = index;
284
- }
285
-
286
- this.calcAxisLMinMax(labelData);
287
- this.calcAxisGMinMax(seriesId, graphData);
288
- }
289
-
290
- calcAxisLMinMax(value) {
291
- if (value === null) {
292
- return;
293
- }
294
-
295
- const options = this.chartOptions;
296
- const horizontal = options.horizontal;
297
- let lMinMax;
298
-
299
- if (horizontal) {
300
- if (!this.yMinMax[0]) {
301
- this.yMinMax[0] = { min: null, max: null };
302
- }
303
-
304
- lMinMax = this.yMinMax[0];
305
- } else {
306
- if (!this.xMinMax[0]) {
307
- this.xMinMax[0] = { min: null, max: null };
308
- }
309
-
310
- lMinMax = this.xMinMax[0];
311
- }
312
-
313
- if (lMinMax.min === null || lMinMax.min > value) {
314
- lMinMax.min = value;
315
- }
316
-
317
- if (lMinMax.max === null || lMinMax.max < value) {
318
- lMinMax.max = value;
319
- }
320
- }
321
-
322
- calcAxisGMinMax(seriesId, value) {
323
- if (value === null) {
324
- return;
325
- }
326
-
327
- const series = this.seriesList[seriesId];
328
- const options = this.chartOptions;
329
- const horizontal = options.horizontal;
330
- const index = horizontal ? series.xAxisIndex : series.yAxisIndex;
331
- let gMinMax;
332
-
333
- if (horizontal) {
334
- if (!this.xMinMax[index]) {
335
- this.xMinMax[index] = { min: null, max: null, seriesId: null };
336
- }
337
-
338
- gMinMax = this.xMinMax[index];
339
- } else {
340
- if (!this.yMinMax[index]) {
341
- this.yMinMax[index] = { min: null, max: null, seriesId: null };
342
- }
343
-
344
- gMinMax = this.yMinMax[index];
345
- }
346
-
347
- if (gMinMax.min === null || gMinMax.min > value) {
348
- gMinMax.min = value;
349
- gMinMax.minSId = seriesId;
350
- }
351
-
352
- if (gMinMax.max === null || gMinMax.max < value) {
353
- gMinMax.max = value;
354
- gMinMax.maxSId = seriesId;
355
- }
356
- }
357
-
358
- getSeriesList() {
359
- return this.seriesList;
360
- }
361
-
362
- getXMinMax() {
363
- return this.xMinMax;
364
- }
365
-
366
- getYMinMax() {
367
- return this.yMinMax;
368
- }
369
-
370
- getGraphData() {
371
- return this.graphData;
372
- }
373
-
374
- getLabelList() {
375
- return this.labelList;
376
- }
377
-
378
- updateData() {
379
- this.axisList = { x: [], y: [] };
380
- this.xMinMax = [];
381
- this.yMinMax = [];
382
- this.graphData = {};
383
- this.seriesList = {};
384
-
385
- const seriesData = this.chartData.series;
386
- const seriesKeys = Object.keys(seriesData);
387
-
388
- for (let ix = 0, ixLen = seriesKeys.length; ix < ixLen; ix++) {
389
- this.addSeries(seriesKeys[ix], seriesData[seriesKeys[ix]]);
390
- }
391
-
392
- const sKeys = Object.keys(this.seriesList);
393
- let series;
394
-
395
- for (let ix = 0, ixLen = sKeys.length; ix < ixLen; ix++) {
396
- series = this.seriesList[sKeys[ix]];
397
- series.min = null;
398
- series.minIndex = null;
399
- series.max = null;
400
- series.maxIndex = null;
401
- series.isExistGrp = false;
402
- series.groupIndex = null;
403
- series.stackIndex = null;
404
-
405
- if (!this.graphData[sKeys[ix]]) {
406
- this.graphData[sKeys[ix]] = [];
407
- }
408
- }
409
-
410
- this.createChartDataSet();
411
- }
412
- }
@@ -1,70 +0,0 @@
1
- import _ from 'lodash-es';
2
- import DataStore from './data';
3
-
4
- export default class PieDataStore extends DataStore {
5
- constructor(props) {
6
- super(props);
7
-
8
- this.graphData = [];
9
- }
10
-
11
- createChartDataSet() {
12
- const chartData = this.chartData.data;
13
- let meta;
14
- let data;
15
-
16
- for (let ix = 0, ixLen = chartData.length; ix < ixLen; ix++) {
17
- meta = chartData[ix][0];
18
- data = _.slice(chartData[ix], 1);
19
-
20
- this.addGraphDataSet(meta, data);
21
- }
22
- }
23
-
24
- addGraphDataSet(seriesId, data) {
25
- for (let ix = 0, ixLen = data.length; ix < ixLen; ix++) {
26
- if (!this.graphData[ix]) {
27
- this.graphData[ix] = { data: [], ir: 0, or: 0, total: 0, index: 0 };
28
- }
29
-
30
- this.addGraphData(seriesId, data[ix], ix); // 'series1', 100, 0
31
- }
32
- }
33
-
34
- addGraphData(sId, graphData, dsIndex = 0) {
35
- const ds = this.graphData[dsIndex];
36
- const gdata = ds.data;
37
- const series = this.seriesList[sId];
38
-
39
- if (series.show) {
40
- ds.total += (graphData || 0);
41
- gdata.push({ id: sId, value: graphData, sa: 0, ea: 0 });
42
- }
43
- }
44
-
45
- updateData() {
46
- this.graphData = [];
47
-
48
- this.createChartDataSet();
49
- }
50
-
51
- sortingDescDataSet(dsIndex) {
52
- this.graphData[dsIndex].data = _.orderBy(this.graphData[dsIndex].data, 'value', 'desc');
53
- }
54
-
55
- getDataSetTotalValue(dsIndex) {
56
- const ds = this.graphData[dsIndex].data;
57
- let totalValue = 0;
58
- let series;
59
-
60
- for (let ix = 0, ixLen = ds.length; ix < ixLen; ix++) {
61
- series = this.seriesList[ds[ix].id];
62
-
63
- if (ds[ix].value && series.show) {
64
- totalValue += ds[ix].value;
65
- }
66
- }
67
-
68
- return totalValue;
69
- }
70
- }
@@ -1,222 +0,0 @@
1
- import _ from 'lodash-es';
2
- import moment from 'moment';
3
- import DataStore from './data';
4
-
5
- export default class StackDataStore extends DataStore {
6
- getSeriesExtends(defaultSeries, param) {
7
- const chartType = this.chartOptions.type;
8
- const horizontal = !!(this.chartOptions.horizontal);
9
- const skey = Object.keys(this.seriesList);
10
- let extSeries;
11
-
12
- if (chartType === 'line') {
13
- extSeries = {
14
- horizontal,
15
- axisType: horizontal ? 'y' : 'x',
16
- xAxisIndex: param.xAxisIndex ? param.xAxisIndex : 0,
17
- yAxisIndex: param.yAxisIndex ? param.yAxisIndex : 0,
18
- point: param.point || false,
19
- pointSize: param.pointSize || 4,
20
- pointStyle: param.pointStyle || '',
21
- pointFill: param.pointFill || this.chartOptions.colors[skey.length],
22
- lineWidth: param.lineWidth || 2,
23
- fill: param.fill || false,
24
- fillColor: param.fillColor || this.chartOptions.colors[skey.length],
25
- fillOpacity: param.fillOpacity || 0.4,
26
- };
27
- } else if (chartType === 'bar') { // 'bar'
28
- extSeries = {
29
- horizontal,
30
- axisType: horizontal ? 'y' : 'x',
31
- xAxisIndex: param.xAxisIndex ? param.xAxisIndex : 0,
32
- yAxisIndex: param.yAxisIndex ? param.yAxisIndex : 0,
33
- };
34
- }
35
-
36
- return _.merge(defaultSeries, extSeries);
37
- }
38
-
39
- /**
40
- * loop for addGraphData
41
- * @param seriesId (require)
42
- * @param data ex. [100,200,300,400,500]
43
- */
44
- addGraphDataSet(seriesId, data) {
45
- const series = this.seriesList[seriesId];
46
- const axisType = series.axisType;
47
- const axisIndex = axisType === 'x' ? series.xAxisIndex : series.yAxisIndex;
48
-
49
- if (!this.axisList[axisType][axisIndex]) {
50
- this.axisList[axisType][axisIndex] = [];
51
- this.createDummyAxis(axisType, axisIndex);
52
- }
53
-
54
- const axis = this.axisList[axisType][axisIndex];
55
-
56
- this.setSeriesGroupInfo(seriesId);
57
-
58
- for (let ix = 0, ixLen = data.length; ix < ixLen; ix++) {
59
- this.addGraphStackData(seriesId, axis[ix], data[ix]);
60
- }
61
- }
62
-
63
- addGraphStackData(seriesId, axisData, graphData, dataIndex) {
64
- const isHorizontal = !!this.chartOptions.horizontal;
65
- const data = this.graphData[seriesId];
66
- const series = this.seriesList[seriesId];
67
- const axisType = series.axisType;
68
-
69
- let axisOption;
70
- let axisIndex;
71
- let dateObj;
72
-
73
- let adata; // axis
74
- let gdata; // graph
75
- let sdata; // sum
76
-
77
- let bSId;
78
- let bdata;
79
- let b;
80
-
81
- if (!series.isExistGrp) {
82
- this.setSeriesGroupInfo(seriesId);
83
- }
84
-
85
- const groupIndex = series.groupIndex;
86
- const stackIndex = series.stackIndex;
87
-
88
-
89
- if (axisType === 'x') {
90
- axisIndex = series.xAxisIndex;
91
- axisOption = this.chartOptions.xAxes[axisIndex];
92
- } else {
93
- axisIndex = series.yAxisIndex;
94
- axisOption = this.chartOptions.yAxes[axisIndex];
95
- }
96
-
97
- let index = typeof dataIndex === 'number' && dataIndex > -1 ? dataIndex : data.length;
98
-
99
- if (this.chartOptions.bufferSize) {
100
- if (data.length >= this.chartOptions.bufferSize) {
101
- data.shift();
102
- --index;
103
- }
104
- }
105
-
106
- if (groupIndex !== null && stackIndex) {
107
- bSId = this.findBaseSeries(seriesId);
108
-
109
- if (bSId !== false) {
110
- bdata = this.graphData[bSId][index];
111
- }
112
- }
113
-
114
- if (axisOption.labelType === 'time') {
115
- dateObj = moment(axisData === undefined ? null : axisData);
116
-
117
- if (dateObj.isValid()) {
118
- adata = +dateObj;
119
- } else {
120
- adata = null;
121
- }
122
- } else {
123
- adata = axisData;
124
- }
125
-
126
- if (graphData === undefined || graphData === null || isNaN(graphData) || +graphData < 0) {
127
- gdata = groupIndex !== null ? 0 : null;
128
- } else {
129
- gdata = +graphData;
130
- }
131
-
132
- if (isHorizontal) {
133
- if (bdata && bdata.y === adata) {
134
- b = bdata.x || 0;
135
- } else {
136
- b = 0;
137
- }
138
- } else if (bdata && bdata.x === adata) {
139
- b = bdata.y || 0;
140
- } else {
141
- b = 0;
142
- }
143
-
144
- if (groupIndex !== null) {
145
- sdata = gdata + b;
146
- } else {
147
- sdata = gdata;
148
- }
149
-
150
- if (adata) {
151
- if (isHorizontal) {
152
- data[index] = { x: sdata, y: adata, b, i: gdata, xp: null, yp: null, w: null, h: null };
153
- } else {
154
- data[index] = { x: adata, y: sdata, b, i: gdata, xp: null, yp: null, w: null, h: null };
155
- }
156
- if (series.show) {
157
- this.setMinMaxValue(seriesId, adata, sdata, index);
158
- }
159
- }
160
- }
161
-
162
- findBaseSeries(seriesId) {
163
- const series = this.seriesList[seriesId];
164
- const groupIndex = series.groupIndex;
165
- const stackIndex = series.stackIndex;
166
-
167
- const groups = this.chartData.groups;
168
- const group = groups[groupIndex];
169
-
170
- let baseOffset = 1;
171
- let baseId = group[stackIndex - baseOffset];
172
- let baseSeries = this.seriesList[baseId];
173
-
174
- while (baseSeries && !baseSeries.show) {
175
- baseOffset += 1;
176
-
177
- if (stackIndex - baseOffset > -1) {
178
- baseId = group[stackIndex - baseOffset];
179
- baseSeries = this.seriesList[baseId];
180
- } else {
181
- baseId = false;
182
- break;
183
- }
184
- }
185
-
186
- return baseId;
187
- }
188
-
189
- setSeriesGroupInfo(seriesId) {
190
- const groups = this.chartData.groups;
191
- const series = this.seriesList[seriesId];
192
-
193
- let group;
194
-
195
- for (let ix = 0, ixLen = groups.length; ix < ixLen; ix++) {
196
- group = groups[ix];
197
-
198
- for (let jx = 0, jxLen = group.length; jx < jxLen; jx++) {
199
- if (group[jx] === seriesId) {
200
- series.stackIndex = jx;
201
- series.groupIndex = ix;
202
- series.isExistGrp = true;
203
- break;
204
- }
205
- }
206
- }
207
- }
208
- // static calculateBaseValue(series, index, value, comp) {
209
- // if (series.cData[index + comp].y === null) {
210
- // return null;
211
- // }
212
- //
213
- // const x1 = +new Date(series.cData[index + comp].x);
214
- // const y1 = series.cData[index + comp].y;
215
- // const x2 = +new Date(series.cData[index].x);
216
- // const y2 = series.cData[index].y;
217
- //
218
- // const slope = (y2 - y1) / (x2 - x1);
219
- //
220
- // return ((slope * +new Date(value)) - (slope * x1)) + y1;
221
- // }
222
- }