@progress/kendo-charts 2.3.0-dev.202403201419 → 2.3.0-dev.202403250947

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.
@@ -70,6 +70,7 @@ var LegendItem = (function (BoxElement) {
70
70
  var markers = options.markers; if ( markers === void 0 ) markers = {};
71
71
  var markerColor = options.markerColor;
72
72
  var border = markers.border; if ( border === void 0 ) border = {};
73
+ markers.zIndex = undefined;
73
74
 
74
75
  return deepExtend({}, markers, {
75
76
  border: { color: border.color || markerColor },
@@ -5,6 +5,13 @@ import { nodeColor } from "./node";
5
5
  import { BOTTOM, CENTER, POINTER } from "../common/constants";
6
6
  import { AREA } from "../chart/constants";
7
7
 
8
+ var sortData = function (a, b) {
9
+ if (a.node.x0 - b.node.x0 !== 0) {
10
+ return a.node.x0 - b.node.x0;
11
+ }
12
+ return a.node.y0 - b.node.y0;
13
+ };
14
+
8
15
  export var Legend = (function (SankeyElement) {
9
16
  function Legend () {
10
17
  SankeyElement.apply(this, arguments);
@@ -30,6 +37,8 @@ export var Legend = (function (SankeyElement) {
30
37
  node: node,
31
38
  }); });
32
39
 
40
+ data.sort(sortData);
41
+
33
42
  var legend = new ChartLegend(Object.assign({}, options, {data: data}));
34
43
  legend.reflow(drawingRect);
35
44
 
@@ -28,6 +28,10 @@ export var Node = (function (SankeyElement) {
28
28
  opacity: options.opacity
29
29
  },
30
30
  stroke: { width: 0 },
31
+ className: 'k-sankey-node',
32
+ role: 'graphics-symbol',
33
+ ariaRoleDescription: 'Node',
34
+ ariaLabel: options.node.label.text
31
35
  };
32
36
  };
33
37
 
@@ -19,9 +19,9 @@ export var Sankey = (function (Observable) {
19
19
  function Sankey(element, options, theme) {
20
20
  Observable.call(this);
21
21
 
22
- this._initElement(element);
23
22
  this._initTheme(theme);
24
23
  this._setOptions(options);
24
+ this._initElement(element);
25
25
  this._initSurface();
26
26
 
27
27
  if (options && options.data) {
@@ -43,7 +43,16 @@ export var Sankey = (function (Observable) {
43
43
 
44
44
  Sankey.prototype._initElement = function _initElement (element) {
45
45
  this.element = element;
46
- addClass(this.element, [ "k-chart", "k-sankey" ]);
46
+ addClass(element, [ "k-chart", "k-sankey" ]);
47
+ element.setAttribute('role', 'graphics-document');
48
+ element.tabIndex = element.getAttribute("tabindex") || 0;
49
+
50
+ var ref = this.options;
51
+ var title = ref.title;
52
+
53
+ if (title.text) {
54
+ element.setAttribute('aria-label', title.text);
55
+ }
47
56
  };
48
57
 
49
58
  Sankey.prototype._initSurface = function _initSurface () {
@@ -480,12 +489,6 @@ export var Sankey = (function (Observable) {
480
489
  visual.append(titleVisual);
481
490
  }
482
491
 
483
- if (legendBox) {
484
- var legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes: nodes, colors: nodesColors}));
485
- var legendVisual = legendElement.exportVisual();
486
- visual.append(legendVisual);
487
- }
488
-
489
492
  var visualNodes = new Map();
490
493
  sankeyContext.nodesVisuals = visualNodes;
491
494
 
@@ -546,6 +549,12 @@ export var Sankey = (function (Observable) {
546
549
  }
547
550
  });
548
551
 
552
+ if (legendBox) {
553
+ var legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes: nodes, colors: nodesColors}));
554
+ var legendVisual = legendElement.exportVisual();
555
+ visual.append(legendVisual);
556
+ }
557
+
549
558
  return visual;
550
559
  };
551
560
 
@@ -64,6 +64,7 @@ class LegendItem extends BoxElement {
64
64
  const options = this.options;
65
65
  const { markers = {}, markerColor } = options;
66
66
  const { border = {} } = markers;
67
+ markers.zIndex = undefined;
67
68
 
68
69
  return deepExtend({}, markers, {
69
70
  border: { color: border.color || markerColor },
@@ -5,6 +5,13 @@ import { nodeColor } from "./node";
5
5
  import { BOTTOM, CENTER, POINTER } from "../common/constants";
6
6
  import { AREA } from "../chart/constants";
7
7
 
8
+ const sortData = (a, b) => {
9
+ if (a.node.x0 - b.node.x0 !== 0) {
10
+ return a.node.x0 - b.node.x0;
11
+ }
12
+ return a.node.y0 - b.node.y0;
13
+ };
14
+
8
15
  export class Legend extends SankeyElement {
9
16
  getElement() {
10
17
  const options = this.options;
@@ -20,6 +27,8 @@ export class Legend extends SankeyElement {
20
27
  node: node,
21
28
  }));
22
29
 
30
+ data.sort(sortData);
31
+
23
32
  const legend = new ChartLegend(Object.assign({}, options, {data}));
24
33
  legend.reflow(drawingRect);
25
34
 
@@ -20,6 +20,10 @@ export class Node extends SankeyElement {
20
20
  opacity: options.opacity
21
21
  },
22
22
  stroke: { width: 0 },
23
+ className: 'k-sankey-node',
24
+ role: 'graphics-symbol',
25
+ ariaRoleDescription: 'Node',
26
+ ariaLabel: options.node.label.text
23
27
  };
24
28
  }
25
29
  }
@@ -19,9 +19,9 @@ export class Sankey extends Observable {
19
19
  constructor(element, options, theme) {
20
20
  super();
21
21
 
22
- this._initElement(element);
23
22
  this._initTheme(theme);
24
23
  this._setOptions(options);
24
+ this._initElement(element);
25
25
  this._initSurface();
26
26
 
27
27
  if (options && options.data) {
@@ -39,7 +39,15 @@ export class Sankey extends Observable {
39
39
 
40
40
  _initElement(element) {
41
41
  this.element = element;
42
- addClass(this.element, [ "k-chart", "k-sankey" ]);
42
+ addClass(element, [ "k-chart", "k-sankey" ]);
43
+ element.setAttribute('role', 'graphics-document');
44
+ element.tabIndex = element.getAttribute("tabindex") || 0;
45
+
46
+ const { title } = this.options;
47
+
48
+ if (title.text) {
49
+ element.setAttribute('aria-label', title.text);
50
+ }
43
51
  }
44
52
 
45
53
  _initSurface() {
@@ -440,12 +448,6 @@ export class Sankey extends Observable {
440
448
  visual.append(titleVisual);
441
449
  }
442
450
 
443
- if (legendBox) {
444
- const legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes, colors: nodesColors}));
445
- const legendVisual = legendElement.exportVisual();
446
- visual.append(legendVisual);
447
- }
448
-
449
451
  const visualNodes = new Map();
450
452
  sankeyContext.nodesVisuals = visualNodes;
451
453
 
@@ -505,6 +507,12 @@ export class Sankey extends Observable {
505
507
  }
506
508
  });
507
509
 
510
+ if (legendBox) {
511
+ const legendElement = new Legend(Object.assign({}, legend, {drawingRect: legendBox, nodes, colors: nodesColors}));
512
+ const legendVisual = legendElement.exportVisual();
513
+ visual.append(legendVisual);
514
+ }
515
+
508
516
  return visual;
509
517
  }
510
518