evui 3.1.44 → 3.1.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.1.44",
3
+ "version": "3.1.48",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
 
86
86
  await watch(() => props.data, (chartData) => {
87
87
  const newData = getNormalizedData(chartData);
88
- const isUpdateSeries = !isEqual(newData.series, evChart.data.series);
88
+ const isUpdateSeries = !isEqual(newData, evChart.data);
89
89
  evChart.data = cloneDeep(newData);
90
90
  evChart.update({
91
91
  updateSeries: isUpdateSeries,
@@ -520,7 +520,7 @@ class EvChart {
520
520
  this.seriesList = {};
521
521
  this.lastTip = { pos: null, value: null };
522
522
 
523
- this.createSeriesSet(series, options.type);
523
+ this.createSeriesSet(series, options.type, options.horizontal);
524
524
 
525
525
  if (this.legendDOM) {
526
526
  this.resetLegend();
@@ -151,6 +151,7 @@ class Bar {
151
151
  this.drawBar({
152
152
  ctx,
153
153
  positions: { x, y, w, h },
154
+ isTop: item.isTop,
154
155
  });
155
156
 
156
157
  if (showValue.use) {
@@ -212,6 +213,7 @@ class Bar {
212
213
  this.drawBar({
213
214
  ctx,
214
215
  positions: { x, y, w, h: this.isHorizontal ? -h : h },
216
+ isTop: item.data.isTop,
215
217
  });
216
218
 
217
219
  if (showValue.use) {
@@ -409,7 +411,7 @@ class Bar {
409
411
  ctx.restore();
410
412
  }
411
413
 
412
- drawBar({ ctx, positions }) {
414
+ drawBar({ ctx, positions, isTop }) {
413
415
  const isHorizontal = this.isHorizontal;
414
416
  const isStackBar = 'stackIndex' in this;
415
417
  const isBorderRadius = this.borderRadius && this.borderRadius > 0;
@@ -421,7 +423,7 @@ class Bar {
421
423
  return;
422
424
  }
423
425
 
424
- if (isBorderRadius && !isStackBar) {
426
+ if ((!isStackBar && isBorderRadius) || (isStackBar && isBorderRadius && isTop)) {
425
427
  try {
426
428
  this.drawRoundedRect(ctx, positions);
427
429
  } catch (e) {
@@ -12,7 +12,7 @@ export default {
12
12
  * @returns {any} position
13
13
  */
14
14
  calculateX(value, min, max, area, startPoint = 0) {
15
- if (value === null) {
15
+ if (value === null || value === undefined) {
16
16
  return null;
17
17
  }
18
18
 
@@ -35,7 +35,7 @@ export default {
35
35
  * @returns {any} position
36
36
  */
37
37
  calculateSubX(value, min, max, area, startPoint = 0) {
38
- if (value === null) {
38
+ if (value === null || value === undefined) {
39
39
  return null;
40
40
  }
41
41
 
@@ -56,7 +56,7 @@ export default {
56
56
  calculateY(value, min, max, area, startPoint = 0) {
57
57
  let calcY;
58
58
 
59
- if (value === null) {
59
+ if (value === null || value === undefined) {
60
60
  return null;
61
61
  }
62
62
 
@@ -26,7 +26,7 @@ const modules = {
26
26
 
27
27
  if (series && sData) {
28
28
  if (series.isExistGrp && series.stackIndex) {
29
- series.data = this.addSeriesStackDS(sData, label, series.bsIds, series.stackIndex);
29
+ series.data = this.addSeriesStackDS(sData, label, series);
30
30
  } else {
31
31
  series.data = this.addSeriesDS(sData, label);
32
32
  }
@@ -173,12 +173,12 @@ const modules = {
173
173
  * Take data and label to create stack data for each series
174
174
  * @param {object} data chart series info
175
175
  * @param {object} label chart label
176
- * @param {array} bsIds stacked base data ID List
177
- * @param {number} sIdx series ordered index
176
+ * @param {object} series series Information
178
177
  *
179
178
  * @returns {array} data for each series
180
179
  */
181
- addSeriesStackDS(data, label, bsIds, sIdx = 0) {
180
+ addSeriesStackDS(data, label, series) {
181
+ const bsIds = series.bsIds; // stacked base data ID List
182
182
  const isHorizontal = this.options.horizontal;
183
183
  const sdata = [];
184
184
 
@@ -201,6 +201,8 @@ const modules = {
201
201
  };
202
202
 
203
203
  data.forEach((curr, index) => {
204
+ const { stackIndex, show: isShowSeries } = series;
205
+ const isTop = true; // is top position on stack (Stacked or not, default is true)
204
206
  const baseIndex = bsIds.length - 1 < 0 ? 0 : bsIds.length - 1;
205
207
  let bdata = getBaseDataPosition(baseIndex, index); // base(previous) series data
206
208
  let odata = curr; // current series original data
@@ -214,7 +216,7 @@ const modules = {
214
216
  }
215
217
 
216
218
  const oData = odata?.value ?? odata;
217
- if (sIdx > 0) {
219
+ if (stackIndex > 0) {
218
220
  if (oData != null) {
219
221
  gdata = bdata + oData;
220
222
  } else {
@@ -226,7 +228,14 @@ const modules = {
226
228
  gdata = oData;
227
229
  }
228
230
 
229
- sdata.push(this.addData(gdata, ldata, odata, bdata));
231
+ if (gdata && isShowSeries) {
232
+ for (let idx = baseIndex; idx > -1; idx--) {
233
+ const prevSeriesData = this.seriesList[bsIds[idx]];
234
+ prevSeriesData.data[index].isTop = false;
235
+ }
236
+ }
237
+
238
+ sdata.push(this.addData(gdata, ldata, odata, bdata, isTop));
230
239
  }
231
240
  });
232
241
 
@@ -267,14 +276,14 @@ const modules = {
267
276
  * @param {object} ldata label data (x-axis value for vertical chart)
268
277
  * @param {object} odata original data (without stacked value)
269
278
  * @param {object} bdata base data (stacked value)
279
+ * @param {boolean} isTop is top position on stack (Stacked or not, default is true)
270
280
 
271
281
  * @returns {object} data for each graph point
272
282
  */
273
- addData(gdata, ldata, odata = null, bdata = null) {
283
+ addData(gdata, ldata, odata = null, bdata = null, isTop = true) {
274
284
  let data;
275
- const gdataValue = gdata?.value ?? gdata;
276
- const odataValue = odata?.value ?? odata;
277
- const dataColor = gdata?.color ?? odata?.color;
285
+ const gdataValue = Object.hasOwnProperty.call(gdata, 'value') ? gdata.value : gdata;
286
+ const odataValue = Object.hasOwnProperty.call(gdata, 'value') ? odata.value : odata;
278
287
 
279
288
  if (this.options.horizontal) {
280
289
  data = { x: gdataValue, y: ldata, o: odataValue, b: bdata };
@@ -286,7 +295,11 @@ const modules = {
286
295
  data.yp = null;
287
296
  data.w = null;
288
297
  data.h = null;
289
- data.dataColor = dataColor || null;
298
+ data.isTop = isTop;
299
+
300
+ const gDataColor = Object.hasOwnProperty.call(gdata, 'color') ? gdata.color : null;
301
+ const oDataColor = Object.hasOwnProperty.call(odata, 'color') ? odata.color : null;
302
+ data.dataColor = gDataColor ?? oDataColor;
290
303
 
291
304
  return data;
292
305
  },
@@ -361,6 +361,7 @@ export const useShortcuts = (param) => {
361
361
  }
362
362
 
363
363
  clearShortcuts();
364
+ activeShortcut(targetKey);
364
365
  };
365
366
 
366
367
  watch(