@progress/kendo-charts 2.8.1-develop.1 → 2.8.1-develop.3

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.
@@ -1530,7 +1530,7 @@ class Chart {
1530
1530
  inactivePoints = this._getInactivePoints(activePoint, chartInstance);
1531
1531
 
1532
1532
  if (inactivePoints && inactivePoints.length) {
1533
- this._highlight.show(inactivePoints, 1 - this._getInactiveOpacityForSeries(activePoint.series));
1533
+ this._highlight.show(inactivePoints, this._getInactiveOpacityForSeries(activePoint.series));
1534
1534
  }
1535
1535
  }
1536
1536
  }
@@ -1693,7 +1693,17 @@ class Chart {
1693
1693
  _getInactiveOpacityForSeries(series) {
1694
1694
  let defaultInactiveOpacity = this.options.seriesDefaults.highlight.inactiveOpacity;
1695
1695
  let seriesInactiveOpacity = series.highlight.inactiveOpacity;
1696
- return seriesInactiveOpacity || defaultInactiveOpacity || series.opacity || DEFAULT_SERIES_OPACITY;
1696
+
1697
+ if (seriesInactiveOpacity !== undefined) {
1698
+ return seriesInactiveOpacity;
1699
+ }
1700
+ if (defaultInactiveOpacity !== undefined) {
1701
+ return defaultInactiveOpacity;
1702
+ }
1703
+ if (series.opacity !== undefined) {
1704
+ return series.opacity;
1705
+ }
1706
+ return DEFAULT_SERIES_OPACITY;
1697
1707
  }
1698
1708
 
1699
1709
  _getDefaultOpacityForSeries(series) {
@@ -22,6 +22,8 @@ class Highlight {
22
22
 
23
23
  togglePointHighlight(point, show, opacity) {
24
24
  const toggleHandler = (point.options.highlight || {}).toggle;
25
+ const highlight = point.options.highlight || {};
26
+ const pointInactiveOpacity = opacity !== undefined ? opacity : highlight.inactiveOpacity;
25
27
  if (toggleHandler) {
26
28
  const eventArgs = {
27
29
  category: point.category,
@@ -35,17 +37,19 @@ class Highlight {
35
37
  };
36
38
  toggleHandler(eventArgs);
37
39
  if (!eventArgs._defaultPrevented) {
38
- point.toggleHighlight(show, opacity);
40
+ point.toggleHighlight(show, pointInactiveOpacity);
39
41
  }
40
42
  } else {
41
- point.toggleHighlight(show, opacity);
43
+ point.toggleHighlight(show, pointInactiveOpacity);
42
44
  }
43
45
  }
44
46
 
45
47
  hide() {
46
48
  const points = this._points;
47
49
  while (points.length) {
48
- this.togglePointHighlight(points.pop(), false);
50
+ const point = points.pop();
51
+ const highlight = point.options.highlight || {};
52
+ this.togglePointHighlight(point, false, highlight.inactiveOpacity);
49
53
  }
50
54
  }
51
55
 
@@ -426,6 +426,15 @@ function createState(data, seriesType) {
426
426
  );
427
427
  }
428
428
 
429
+ function preserveStackProperties(source, target) {
430
+ for (let i = 0; i < target.series.length; i++) {
431
+ if (typeof source.series[i].stack !== 'undefined') {
432
+ target.series[i].stack = source.series[i].stack;
433
+ target.stack = source.stack;
434
+ }
435
+ }
436
+ }
437
+
429
438
  function mergeStates(source, target) {
430
439
  const newState = structuredClone(target);
431
440
  newState.legend = source.legend;
@@ -473,6 +482,7 @@ function updateState(currentState, action, value) {
473
482
  state.seriesType,
474
483
  { categoryAxis: value }
475
484
  );
485
+ preserveStackProperties(state, newState);
476
486
  return mergeStates(state, newState);
477
487
  } else if (state.seriesType === pieType) {
478
488
  const newState = pieChartState(state.data, state.seriesType, {
@@ -1530,7 +1530,7 @@ class Chart {
1530
1530
  inactivePoints = this._getInactivePoints(activePoint, chartInstance);
1531
1531
 
1532
1532
  if (inactivePoints && inactivePoints.length) {
1533
- this._highlight.show(inactivePoints, 1 - this._getInactiveOpacityForSeries(activePoint.series));
1533
+ this._highlight.show(inactivePoints, this._getInactiveOpacityForSeries(activePoint.series));
1534
1534
  }
1535
1535
  }
1536
1536
  }
@@ -1693,7 +1693,17 @@ class Chart {
1693
1693
  _getInactiveOpacityForSeries(series) {
1694
1694
  let defaultInactiveOpacity = this.options.seriesDefaults.highlight.inactiveOpacity;
1695
1695
  let seriesInactiveOpacity = series.highlight.inactiveOpacity;
1696
- return seriesInactiveOpacity || defaultInactiveOpacity || series.opacity || DEFAULT_SERIES_OPACITY;
1696
+
1697
+ if (seriesInactiveOpacity !== undefined) {
1698
+ return seriesInactiveOpacity;
1699
+ }
1700
+ if (defaultInactiveOpacity !== undefined) {
1701
+ return defaultInactiveOpacity;
1702
+ }
1703
+ if (series.opacity !== undefined) {
1704
+ return series.opacity;
1705
+ }
1706
+ return DEFAULT_SERIES_OPACITY;
1697
1707
  }
1698
1708
 
1699
1709
  _getDefaultOpacityForSeries(series) {
@@ -22,6 +22,8 @@ class Highlight {
22
22
 
23
23
  togglePointHighlight(point, show, opacity) {
24
24
  const toggleHandler = (point.options.highlight || {}).toggle;
25
+ const highlight = point.options.highlight || {};
26
+ const pointInactiveOpacity = opacity !== undefined ? opacity : highlight.inactiveOpacity;
25
27
  if (toggleHandler) {
26
28
  const eventArgs = {
27
29
  category: point.category,
@@ -35,17 +37,19 @@ class Highlight {
35
37
  };
36
38
  toggleHandler(eventArgs);
37
39
  if (!eventArgs._defaultPrevented) {
38
- point.toggleHighlight(show, opacity);
40
+ point.toggleHighlight(show, pointInactiveOpacity);
39
41
  }
40
42
  } else {
41
- point.toggleHighlight(show, opacity);
43
+ point.toggleHighlight(show, pointInactiveOpacity);
42
44
  }
43
45
  }
44
46
 
45
47
  hide() {
46
48
  const points = this._points;
47
49
  while (points.length) {
48
- this.togglePointHighlight(points.pop(), false);
50
+ const point = points.pop();
51
+ const highlight = point.options.highlight || {};
52
+ this.togglePointHighlight(point, false, highlight.inactiveOpacity);
49
53
  }
50
54
  }
51
55
 
@@ -426,6 +426,15 @@ function createState(data, seriesType) {
426
426
  );
427
427
  }
428
428
 
429
+ function preserveStackProperties(source, target) {
430
+ for (let i = 0; i < target.series.length; i++) {
431
+ if (typeof source.series[i].stack !== 'undefined') {
432
+ target.series[i].stack = source.series[i].stack;
433
+ target.stack = source.stack;
434
+ }
435
+ }
436
+ }
437
+
429
438
  function mergeStates(source, target) {
430
439
  const newState = structuredClone(target);
431
440
  newState.legend = source.legend;
@@ -473,6 +482,7 @@ function updateState(currentState, action, value) {
473
482
  state.seriesType,
474
483
  { categoryAxis: value }
475
484
  );
485
+ preserveStackProperties(state, newState);
476
486
  return mergeStates(state, newState);
477
487
  } else if (state.seriesType === pieType) {
478
488
  const newState = pieChartState(state.data, state.seriesType, {