evui 3.4.95 → 3.4.96

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.4.95",
3
+ "version": "3.4.96",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -502,12 +502,11 @@ class HeatMap {
502
502
  }
503
503
 
504
504
  ctx.save();
505
- let highlightOpacity = 1;
506
- if (Util.getColorStringType(gdata.dataColor) === 'RGBA') {
507
- highlightOpacity = Util.getOpacity(item.dataColor);
508
- }
509
505
 
510
- const dataColor = Util.colorStringToRgba(gdata.dataColor, highlightOpacity);
506
+ const dataColor = Util.getColorStringType(gdata.dataColor) === 'RGBA'
507
+ ? item.dataColor
508
+ : Util.colorStringToRgba(gdata.dataColor, 1);
509
+
511
510
  ctx.fillStyle = dataColor;
512
511
 
513
512
  if (shadowOpt.use) {
@@ -566,6 +565,7 @@ class HeatMap {
566
565
  data: null,
567
566
  hit: false,
568
567
  color: null,
568
+ dataColor: null,
569
569
  name: null,
570
570
  };
571
571
  const gdata = this.data;
@@ -583,6 +583,7 @@ class HeatMap {
583
583
  const foundItem = gdata[itemIndex];
584
584
  item.data = foundItem;
585
585
  item.color = foundItem.dataColor;
586
+ item.dataColor = foundItem.dataColor;
586
587
  item.index = itemIndex;
587
588
  item.hit = true;
588
589
  }
@@ -94,7 +94,7 @@ export default {
94
94
  * @returns {string} opacity
95
95
  */
96
96
  getOpacity(rgbaColorString) {
97
- const noneWhiteSpaceColorStr = rgbaColorString.replace(/ /g, '');
97
+ const noneWhiteSpaceColorStr = rgbaColorString?.replace(/ /g, '');
98
98
  const colorType = this.getColorStringType(noneWhiteSpaceColorStr);
99
99
 
100
100
  if (colorType === 'RGBA') {
@@ -1,8 +1,9 @@
1
1
  import { defaultsDeep } from 'lodash-es';
2
2
  import { PLOT_BAND_OPTION, PLOT_LINE_OPTION } from '@/components/chart/helpers/helpers.constant';
3
+ import { bnMinus, bnPlus } from '@/common/utils.bignumber';
4
+ import { truthyNumber } from '@/common/utils';
3
5
  import Scale from './scale';
4
6
  import Util from '../helpers/helpers.util';
5
- import { truthyNumber } from '../../../common/utils';
6
7
 
7
8
  class StepScale extends Scale {
8
9
  constructor(type, axisOpt, ctx, labels, options) {
@@ -63,12 +64,14 @@ class StepScale extends Scale {
63
64
  };
64
65
  }
65
66
 
66
- getInterval(range) {
67
- const max = range.maxValue;
68
- const min = range.minValue;
67
+ getIndexInterval(range) {
69
68
  const step = range.maxSteps;
70
69
 
71
- return this.interval ? this.interval : Math.ceil((max - min) / step);
70
+ if (this.interval) {
71
+ return this.interval;
72
+ }
73
+
74
+ return Math.ceil(this.labels.length / step);
72
75
  }
73
76
 
74
77
  /**
@@ -86,17 +89,17 @@ class StepScale extends Scale {
86
89
  } = range;
87
90
 
88
91
  const oriSteps = (maxIndex - minIndex) + 1;
89
- let interval = 1;
92
+ let indexInterval = 1;
90
93
 
91
94
  const isNumbersArray = this.labels.every(label => !isNaN(label));
92
95
  if (this.labelStyle.alignToGridLine && isNumbersArray) {
93
- interval = this.getInterval(range);
96
+ indexInterval = this.getIndexInterval(range);
94
97
  }
95
98
 
96
99
  return {
97
100
  oriSteps,
98
101
  steps: oriSteps,
99
- interval,
102
+ indexInterval,
100
103
  graphMin: minValue,
101
104
  graphMax: maxValue,
102
105
  minIndex,
@@ -125,7 +128,7 @@ class StepScale extends Scale {
125
128
  };
126
129
 
127
130
  const steps = stepInfo.steps;
128
- const count = stepInfo.interval;
131
+ const indexInterval = stepInfo.indexInterval;
129
132
  const startIndex = stepInfo.minIndex;
130
133
 
131
134
  const startPoint = aPos[this.units.rectStart];
@@ -180,7 +183,7 @@ class StepScale extends Scale {
180
183
  let index;
181
184
  const drawnLabels = [];
182
185
 
183
- for (index = 0; index < steps; index += count) {
186
+ for (index = 0; index < steps; index += indexInterval) {
184
187
  const labelIndex = startIndex + index;
185
188
  const item = this.labels[labelIndex];
186
189
  labelCenter = Math.round(startPoint + (labelGap * index));
@@ -261,8 +264,12 @@ class StepScale extends Scale {
261
264
  }
262
265
 
263
266
  if (alignToGridLine && index >= this.labels.length) {
264
- let labelLastText = +labels[labels.length - 1] + (+labels[1] - +labels[0]);
265
- if (count !== 1 && labelLastText - drawnLabels[drawnLabels.length - 1] <= 1) {
267
+ const cellInterval = bnMinus(+labels[1], +labels[0]);
268
+ let labelLastText = bnPlus(+labels[labels.length - 1], cellInterval);
269
+ if (
270
+ indexInterval !== 1
271
+ && bnMinus(labelLastText, drawnLabels[drawnLabels.length - 1]) <= cellInterval
272
+ ) {
266
273
  return;
267
274
  }
268
275