@progress/kendo-charts 2.3.0-dev.202403271344 → 2.3.0-dev.202404030834

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.
@@ -26,6 +26,7 @@ export var Legend = (function (SankeyElement) {
26
26
  var drawingRect = options.drawingRect;
27
27
  var nodes = options.nodes; if ( nodes === void 0 ) nodes = [];
28
28
  var colors = options.colors; if ( colors === void 0 ) colors = [];
29
+ var item = options.item;
29
30
 
30
31
  if (options.visible === false || !nodes.length) {
31
32
  return null;
@@ -33,7 +34,10 @@ export var Legend = (function (SankeyElement) {
33
34
 
34
35
  var data = nodes.map(function (node, index) { return ({
35
36
  text: (node.label && node.label.text) || '',
36
- area: { background: nodeColor(node, colors, index), opacity: node.opacity },
37
+ area: {
38
+ background: item.areaBackground !== undefined ? item.areaBackground : nodeColor(node, colors, index),
39
+ opacity: item.areaOpacity !== undefined ? item.areaOpacity : node.opacity
40
+ },
37
41
  node: node,
38
42
  }); });
39
43
 
@@ -53,6 +53,10 @@ export var Sankey = (function (Observable) {
53
53
  if (title.text) {
54
54
  element.setAttribute('aria-label', title.text);
55
55
  }
56
+
57
+ if (title.description) {
58
+ element.setAttribute("aria-roledescription", title.description);
59
+ }
56
60
  };
57
61
 
58
62
  Sankey.prototype._initSurface = function _initSurface () {
@@ -178,34 +182,29 @@ export var Sankey = (function (Observable) {
178
182
  Sankey.prototype._mousemove = function _mousemove (ev) {
179
183
  var this$1 = this;
180
184
 
185
+ var ref = this.options.tooltips;
186
+ var followPointer = ref.followPointer;
187
+ var delay = ref.delay;
181
188
  var element = ev.element;
182
-
183
189
  var tooltipElType = element.type;
184
- if (tooltipElType !== LINK && tooltipElType !== NODE) {
190
+
191
+ if ((tooltipElType !== LINK && tooltipElType !== NODE) || (this.tooltipShown && !followPointer)) {
185
192
  return;
186
193
  }
187
194
 
188
- ev.tooltipTargetType = tooltipElType;
189
195
  var mouseEvent = ev.originalEvent;
190
196
  var rect = this.element.getBoundingClientRect();
191
197
  var isLeft = mouseEvent.clientX - rect.left < rect.width / 2;
192
- var ref = this.options.tooltips;
193
- var offset = ref.offset;
194
- var followPointer = ref.followPointer;
195
- var delay = ref.delay;
196
-
197
- if (this.tooltipShown && !followPointer) {
198
- return;
199
- }
198
+ var isTop = mouseEvent.clientY - rect.top < rect.height / 2;
200
199
 
201
200
  ev.tooltipData = {
202
201
  popupOffset: {
203
- left: mouseEvent.pageX + (isLeft ? offset : (-1 * offset)),
202
+ left: mouseEvent.pageX,
204
203
  top: mouseEvent.pageY
205
204
  },
206
205
  popupAlign: {
207
206
  horizontal: isLeft ? 'left' : 'right',
208
- vertical: 'center'
207
+ vertical: isTop ? 'top' : 'bottom'
209
208
  }
210
209
  };
211
210
 
@@ -617,7 +616,6 @@ setDefaultOptions(Sankey, {
617
616
  }
618
617
  },
619
618
  tooltips: {
620
- offset: 10,
621
619
  followPointer: false,
622
620
  delay: 1000
623
621
  }
@@ -15,7 +15,7 @@ const sortData = (a, b) => {
15
15
  export class Legend extends SankeyElement {
16
16
  getElement() {
17
17
  const options = this.options;
18
- const { drawingRect, nodes = [], colors = [] } = options;
18
+ const { drawingRect, nodes = [], colors = [], item } = options;
19
19
 
20
20
  if (options.visible === false || !nodes.length) {
21
21
  return null;
@@ -23,7 +23,10 @@ export class Legend extends SankeyElement {
23
23
 
24
24
  const data = nodes.map((node, index) => ({
25
25
  text: (node.label && node.label.text) || '',
26
- area: { background: nodeColor(node, colors, index), opacity: node.opacity },
26
+ area: {
27
+ background: item.areaBackground !== undefined ? item.areaBackground : nodeColor(node, colors, index),
28
+ opacity: item.areaOpacity !== undefined ? item.areaOpacity : node.opacity
29
+ },
27
30
  node: node,
28
31
  }));
29
32
 
@@ -48,6 +48,10 @@ export class Sankey extends Observable {
48
48
  if (title.text) {
49
49
  element.setAttribute('aria-label', title.text);
50
50
  }
51
+
52
+ if (title.description) {
53
+ element.setAttribute("aria-roledescription", title.description);
54
+ }
51
55
  }
52
56
 
53
57
  _initSurface() {
@@ -164,31 +168,27 @@ export class Sankey extends Observable {
164
168
  }
165
169
 
166
170
  _mousemove(ev) {
171
+ const { followPointer, delay } = this.options.tooltips;
167
172
  const element = ev.element;
168
-
169
173
  const tooltipElType = element.type;
170
- if (tooltipElType !== LINK && tooltipElType !== NODE) {
174
+
175
+ if ((tooltipElType !== LINK && tooltipElType !== NODE) || (this.tooltipShown && !followPointer)) {
171
176
  return;
172
177
  }
173
178
 
174
- ev.tooltipTargetType = tooltipElType;
175
179
  const mouseEvent = ev.originalEvent;
176
180
  const rect = this.element.getBoundingClientRect();
177
181
  const isLeft = mouseEvent.clientX - rect.left < rect.width / 2;
178
- const { offset, followPointer, delay } = this.options.tooltips;
179
-
180
- if (this.tooltipShown && !followPointer) {
181
- return;
182
- }
182
+ const isTop = mouseEvent.clientY - rect.top < rect.height / 2;
183
183
 
184
184
  ev.tooltipData = {
185
185
  popupOffset: {
186
- left: mouseEvent.pageX + (isLeft ? offset : (-1 * offset)),
186
+ left: mouseEvent.pageX,
187
187
  top: mouseEvent.pageY
188
188
  },
189
189
  popupAlign: {
190
190
  horizontal: isLeft ? 'left' : 'right',
191
- vertical: 'center'
191
+ vertical: isTop ? 'top' : 'bottom'
192
192
  }
193
193
  };
194
194
 
@@ -573,7 +573,6 @@ setDefaultOptions(Sankey, {
573
573
  }
574
574
  },
575
575
  tooltips: {
576
- offset: 10,
577
576
  followPointer: false,
578
577
  delay: 1000
579
578
  }