@progress/kendo-charts 1.32.1 → 1.33.0-dev.202311081130

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.
Files changed (89) hide show
  1. package/dist/cdn/js/kendo-charts.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/chart/bar-chart/bar.js +40 -16
  4. package/dist/es/chart/bubble-chart/bubble.js +10 -0
  5. package/dist/es/chart/bullet-chart/bullet.js +32 -11
  6. package/dist/es/chart/candlestick-chart/candlestick.js +37 -1
  7. package/dist/es/chart/categorical-chart.js +1 -1
  8. package/dist/es/chart/chart.js +307 -26
  9. package/dist/es/chart/constants.js +12 -1
  10. package/dist/es/chart/funnel-chart/funnel-chart.js +5 -3
  11. package/dist/es/chart/funnel-chart/funnel-segment.js +62 -3
  12. package/dist/es/chart/heatmap-chart/heatmap-chart.js +2 -1
  13. package/dist/es/chart/heatmap-chart/heatmap-point.js +68 -29
  14. package/dist/es/chart/legend/legend-item.js +32 -2
  15. package/dist/es/chart/legend/legend.js +6 -1
  16. package/dist/es/chart/line-chart/line-point.js +109 -26
  17. package/dist/es/chart/mixins/accessibility-attributes-mixin.js +36 -0
  18. package/dist/es/chart/pie-chart/pie-chart.js +1 -1
  19. package/dist/es/chart/pie-chart/pie-segment.js +50 -14
  20. package/dist/es/chart/plotarea/categorical-plotarea.js +53 -2
  21. package/dist/es/chart/plotarea/funnel-plotarea.js +8 -0
  22. package/dist/es/chart/plotarea/heatmap-plotarea.js +66 -1
  23. package/dist/es/chart/plotarea/plotarea-base.js +71 -1
  24. package/dist/es/chart/plotarea/radar-plotarea.js +8 -0
  25. package/dist/es/chart/radar-bar-chart/radar-segment.js +4 -0
  26. package/dist/es/chart/range-area-chart/range-area-point.js +26 -1
  27. package/dist/es/chart/range-bar-chart/range-bar.js +3 -24
  28. package/dist/es/chart/scatter-charts/scatter-chart.js +1 -1
  29. package/dist/es/common/constants.js +6 -0
  30. package/dist/es/common/cycleDown.js +5 -0
  31. package/dist/es/common/cycleIndex.js +13 -0
  32. package/dist/es/common/cycleUp.js +3 -0
  33. package/dist/es/common.js +3 -0
  34. package/dist/es/core/chart-element.js +31 -3
  35. package/dist/es/core/shape-builder.js +1 -1
  36. package/dist/es/core/shape-element.js +3 -0
  37. package/dist/es/core/utils/add-accessibility-attributes-to-visual.js +8 -0
  38. package/dist/es/core/utils/guid.js +17 -0
  39. package/dist/es/map/layers/shape.js +0 -2
  40. package/dist/es/map/navigator.js +0 -1
  41. package/dist/es/map/scroller/user-events.js +0 -2
  42. package/dist/es/map/utils.js +0 -18
  43. package/dist/es/map/zoom.js +0 -1
  44. package/dist/es2015/chart/bar-chart/bar.js +40 -16
  45. package/dist/es2015/chart/bubble-chart/bubble.js +10 -0
  46. package/dist/es2015/chart/bullet-chart/bullet.js +32 -11
  47. package/dist/es2015/chart/candlestick-chart/candlestick.js +37 -1
  48. package/dist/es2015/chart/categorical-chart.js +1 -1
  49. package/dist/es2015/chart/chart.js +295 -26
  50. package/dist/es2015/chart/constants.js +12 -1
  51. package/dist/es2015/chart/funnel-chart/funnel-chart.js +5 -3
  52. package/dist/es2015/chart/funnel-chart/funnel-segment.js +62 -3
  53. package/dist/es2015/chart/heatmap-chart/heatmap-chart.js +2 -1
  54. package/dist/es2015/chart/heatmap-chart/heatmap-point.js +68 -29
  55. package/dist/es2015/chart/legend/legend-item.js +32 -2
  56. package/dist/es2015/chart/legend/legend.js +6 -1
  57. package/dist/es2015/chart/line-chart/line-point.js +110 -26
  58. package/dist/es2015/chart/mixins/accessibility-attributes-mixin.js +36 -0
  59. package/dist/es2015/chart/pie-chart/pie-chart.js +1 -1
  60. package/dist/es2015/chart/pie-chart/pie-segment.js +50 -14
  61. package/dist/es2015/chart/plotarea/categorical-plotarea.js +49 -2
  62. package/dist/es2015/chart/plotarea/funnel-plotarea.js +8 -0
  63. package/dist/es2015/chart/plotarea/heatmap-plotarea.js +60 -1
  64. package/dist/es2015/chart/plotarea/plotarea-base.js +67 -1
  65. package/dist/es2015/chart/plotarea/radar-plotarea.js +8 -0
  66. package/dist/es2015/chart/radar-bar-chart/radar-segment.js +4 -0
  67. package/dist/es2015/chart/range-area-chart/range-area-point.js +26 -1
  68. package/dist/es2015/chart/range-bar-chart/range-bar.js +3 -24
  69. package/dist/es2015/chart/scatter-charts/scatter-chart.js +1 -1
  70. package/dist/es2015/common/constants.js +6 -0
  71. package/dist/es2015/common/cycleDown.js +5 -0
  72. package/dist/es2015/common/cycleIndex.js +13 -0
  73. package/dist/es2015/common/cycleUp.js +3 -0
  74. package/dist/es2015/common.js +3 -0
  75. package/dist/es2015/core/chart-element.js +31 -3
  76. package/dist/es2015/core/shape-builder.js +1 -1
  77. package/dist/es2015/core/shape-element.js +3 -0
  78. package/dist/es2015/core/utils/add-accessibility-attributes-to-visual.js +8 -0
  79. package/dist/es2015/core/utils/guid.js +17 -0
  80. package/dist/es2015/map/layers/shape.js +0 -2
  81. package/dist/es2015/map/navigator.js +0 -2
  82. package/dist/es2015/map/scroller/user-events.js +0 -2
  83. package/dist/es2015/map/utils.js +0 -18
  84. package/dist/es2015/map/zoom.js +0 -2
  85. package/dist/npm/main.js +1098 -156
  86. package/dist/systemjs/kendo-charts.js +1 -1
  87. package/package.json +1 -1
  88. package/dist/es/chart/area-chart/area-segment-mixin.js +0 -91
  89. package/dist/es2015/chart/area-chart/area-segment-mixin.js +0 -91
@@ -1,7 +1,8 @@
1
1
  import { autoTextColor, deepExtend, getTemplate, valueOrDefault } from '../../common';
2
2
  import { CENTER, ROUNDED_RECT, BOTTOM, WHITE } from '../../common/constants';
3
3
  import { ChartElement, Point, rectToBox, ShapeElement, TextBox } from '../../core';
4
- import { TOOLTIP_OFFSET } from '../constants';
4
+ import { CHART_POINT_CLASSNAME, CHART_POINT_ROLE, CHART_POINT_ROLE_DESCRIPTION, TOOLTIP_OFFSET } from '../constants';
5
+ import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
5
6
  import NoteMixin from '../mixins/note-mixin';
6
7
  import PointEventsMixin from '../mixins/point-events-mixin';
7
8
 
@@ -35,38 +36,43 @@ var HeatmapPoint = (function (ChartElement) {
35
36
  var labels = options.labels;
36
37
 
37
38
  if (labels.visible) {
38
- var pointData = this.pointData();
39
- var labelTemplate = getTemplate(labels);
40
- var labelText;
41
- var labelColor = labels.color;
42
-
43
- if (labelTemplate) {
44
- labelText = labelTemplate(pointData);
45
- } else {
46
- labelText = this.formatValue(labels.format);
47
- }
39
+ this.label = this.createLabelElement(labels);
40
+ this.append(this.label);
41
+ }
42
+ };
48
43
 
49
- if (!labelColor) {
50
- labelColor = autoTextColor(this.color);
51
- }
44
+ HeatmapPoint.prototype.createLabelElement = function createLabelElement (options) {
45
+ var labelColor = options.color;
46
+
47
+ if (!labelColor) {
48
+ labelColor = autoTextColor(this.color);
49
+ }
52
50
 
53
- this.label = new TextBox(labelText,
54
- deepExtend({
55
- align: CENTER,
56
- vAlign: CENTER,
57
- margin: {
58
- left: 5,
59
- right: 5
60
- },
61
- zIndex: valueOrDefault(labels.zIndex, this.series.zIndex)
51
+ return new TextBox(this.getLabelText(options),
52
+ deepExtend({
53
+ align: CENTER,
54
+ vAlign: CENTER,
55
+ margin: {
56
+ left: 5,
57
+ right: 5
62
58
  },
63
- labels, {
64
- color: labelColor
65
- }),
66
- pointData
67
- );
68
- this.append(this.label);
59
+ zIndex: valueOrDefault(options.zIndex, this.series.zIndex)
60
+ },
61
+ options, {
62
+ color: labelColor
63
+ }),
64
+ this.pointData()
65
+ );
66
+ };
67
+
68
+ HeatmapPoint.prototype.getLabelText = function getLabelText (options) {
69
+ var labelTemplate = getTemplate(options);
70
+
71
+ if (labelTemplate) {
72
+ return labelTemplate(this.pointData());
69
73
  }
74
+
75
+ return this.formatValue(options.format);
70
76
  };
71
77
 
72
78
  HeatmapPoint.prototype.formatValue = function formatValue (format) {
@@ -91,6 +97,12 @@ var HeatmapPoint = (function (ChartElement) {
91
97
  this.marker.reflow(this.markerBox());
92
98
  };
93
99
 
100
+ HeatmapPoint.prototype.createVisual = function createVisual () {
101
+ ChartElement.prototype.createVisual.call(this);
102
+
103
+ this.addAccessibilityAttributesToVisual();
104
+ };
105
+
94
106
  HeatmapPoint.prototype.markerBox = function markerBox () {
95
107
  var options = this.options;
96
108
  var markers = options.markers;
@@ -193,6 +205,27 @@ var HeatmapPoint = (function (ChartElement) {
193
205
  };
194
206
  };
195
207
 
208
+ HeatmapPoint.prototype.createFocusHighlight = function createFocusHighlight () {
209
+ var markerOptions = this.options.markers;
210
+ var highlightOptions = this.options.accessibility.highlight;
211
+
212
+ var highlight = new ShapeElement({
213
+ type: valueOrDefault(markerOptions.type, 'rect'),
214
+ width: markerOptions.size,
215
+ height: markerOptions.size,
216
+ rotation: markerOptions.rotation,
217
+ background: highlightOptions.color,
218
+ border: highlightOptions.border,
219
+ borderRadius: markerOptions.borderRadius,
220
+ padding: highlightOptions.border.width / 2,
221
+ zIndex: highlightOptions.zIndex
222
+ });
223
+
224
+ highlight.reflow(this.markerBox());
225
+
226
+ return highlight.getElement();
227
+ };
228
+
196
229
  HeatmapPoint.prototype.tooltipAnchor = function tooltipAnchor () {
197
230
  var left = this.box.center().x;
198
231
  var top = this.box.y1 - TOOLTIP_OFFSET;
@@ -229,6 +262,7 @@ var HeatmapPoint = (function (ChartElement) {
229
262
 
230
263
  deepExtend(HeatmapPoint.prototype, PointEventsMixin);
231
264
  deepExtend(HeatmapPoint.prototype, NoteMixin);
265
+ deepExtend(HeatmapPoint.prototype, AccessibilityAttributesMixin);
232
266
 
233
267
  HeatmapPoint.prototype.defaults = {
234
268
  markers: {
@@ -246,6 +280,11 @@ HeatmapPoint.prototype.defaults = {
246
280
  opacity: 1,
247
281
  notes: {
248
282
  label: {}
283
+ },
284
+ accessibility: {
285
+ role: CHART_POINT_ROLE,
286
+ className: CHART_POINT_CLASSNAME,
287
+ ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
249
288
  }
250
289
  };
251
290
 
@@ -1,9 +1,11 @@
1
1
  import { drawing as draw } from '@progress/kendo-drawing';
2
2
 
3
3
  import { BoxElement, FloatElement, ShapeElement, TextBox } from '../../core';
4
- import { LEGEND_ITEM_CLICK, LEGEND_ITEM_HOVER, LEGEND_ITEM_LEAVE } from '../constants';
4
+ import { LEGEND_ITEM_ARIA_ROLE_DESCRIPTION, LEGEND_ITEM_CLASSNAME, LEGEND_ITEM_CLICK, LEGEND_ITEM_HOVER, LEGEND_ITEM_LEAVE, LEGEND_ITEM_ROLE } from '../constants';
5
5
  import { CENTER, WHITE } from '../../common/constants';
6
- import { deepExtend, eventElement } from '../../common';
6
+ import { deepExtend, eventElement, setDefaultOptions } from '../../common';
7
+ import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
8
+ import addAccessibilityAttributesToVisual from '../../core/utils/add-accessibility-attributes-to-visual';
7
9
 
8
10
  var LegendItem = (function (BoxElement) {
9
11
  function LegendItem(options) {
@@ -103,6 +105,19 @@ var LegendItem = (function (BoxElement) {
103
105
  };
104
106
  };
105
107
 
108
+ LegendItem.prototype.createVisual = function createVisual () {
109
+ BoxElement.prototype.createVisual.call(this);
110
+ var options = this.options;
111
+
112
+ if (this.options.visible) {
113
+ var accessibilityOptions = deepExtend({ ariaLabel: options.text }, options.accessibility);
114
+
115
+ addAccessibilityAttributesToVisual(this.visual, accessibilityOptions);
116
+
117
+ this.visual.options.ariaChecked = options.active;
118
+ }
119
+ };
120
+
106
121
  LegendItem.prototype.renderVisual = function renderVisual () {
107
122
  var this$1 = this;
108
123
 
@@ -137,7 +152,22 @@ var LegendItem = (function (BoxElement) {
137
152
  }
138
153
  };
139
154
 
155
+ LegendItem.prototype.createFocusHighlight = function createFocusHighlight (style) {
156
+ var borderWidth = style.stroke.width;
157
+ return draw.Path.fromRect(this.container.box.pad(borderWidth / 2).toRect(), style);
158
+ };
159
+
140
160
  return LegendItem;
141
161
  }(BoxElement));
142
162
 
163
+ deepExtend(LegendItem.prototype, AccessibilityAttributesMixin);
164
+
165
+ setDefaultOptions(LegendItem, {
166
+ accessibility: {
167
+ role: LEGEND_ITEM_ROLE,
168
+ className: LEGEND_ITEM_CLASSNAME,
169
+ ariaRoleDescription: LEGEND_ITEM_ARIA_ROLE_DESCRIPTION
170
+ }
171
+ });
172
+
143
173
  export default LegendItem;
@@ -107,7 +107,8 @@ var Legend = (function (ChartElement) {
107
107
  innerElement.append(new LegendItem(deepExtend({}, {
108
108
  markers: options.markers,
109
109
  labels: options.labels,
110
- rtl: chartService.rtl
110
+ rtl: chartService.rtl,
111
+ accessibility: options.accessibility
111
112
  }, options.item, item)));
112
113
  }
113
114
 
@@ -129,6 +130,10 @@ var Legend = (function (ChartElement) {
129
130
  return this.container.children[0].children.length > 0;
130
131
  };
131
132
 
133
+ Legend.prototype.getItems = function getItems () {
134
+ return this.container.children[0].children;
135
+ };
136
+
132
137
  Legend.prototype.reflow = function reflow (targetBox) {
133
138
  var options = this.options;
134
139
  var legendBox = targetBox.clone();
@@ -4,10 +4,12 @@ import { ChartElement, TextBox, ShapeElement, Box, Point } from '../../core';
4
4
 
5
5
  import PointEventsMixin from '../mixins/point-events-mixin';
6
6
  import NoteMixin from '../mixins/note-mixin';
7
- import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, BORDER_BRIGHTNESS, TOOLTIP_OFFSET, ABOVE, BELOW } from '../constants';
7
+ import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, BORDER_BRIGHTNESS, TOOLTIP_OFFSET, ABOVE, BELOW, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
8
8
 
9
9
  import { WHITE, CIRCLE, CENTER, TOP, BOTTOM, LEFT, HIGHLIGHT_ZINDEX } from '../../common/constants';
10
10
  import { deepExtend, defined, getTemplate, valueOrDefault, getSpacing } from '../../common';
11
+ import TemplateService from '../../services/template-service';
12
+ import guid from '../../core/utils/guid';
11
13
 
12
14
  var LinePoint = (function (ChartElement) {
13
15
  function LinePoint(value, options) {
@@ -26,7 +28,6 @@ var LinePoint = (function (ChartElement) {
26
28
  LinePoint.prototype.render = function render () {
27
29
  var ref = this.options;
28
30
  var markers = ref.markers;
29
- var labels = ref.labels;
30
31
 
31
32
  if (this._rendered) {
32
33
  return;
@@ -39,35 +40,59 @@ var LinePoint = (function (ChartElement) {
39
40
  this.append(this.marker);
40
41
  }
41
42
 
43
+ this.createLabel();
44
+ this.createNote();
45
+
46
+ if (this.errorBar) {
47
+ this.append(this.errorBar);
48
+ }
49
+ };
50
+
51
+ LinePoint.prototype.createLabel = function createLabel () {
52
+ var options = this.options;
53
+ var labels = options.labels;
54
+
42
55
  if (labels.visible) {
43
- var labelTemplate = getTemplate(labels);
44
- var pointData = this.pointData();
45
- var labelText = this.value;
46
- if (labelTemplate) {
47
- labelText = labelTemplate(pointData);
48
- } else if (labels.format) {
49
- labelText = this.formatValue(labels.format);
50
- }
51
- this.label = new TextBox(labelText,
52
- deepExtend({
53
- align: CENTER,
54
- vAlign: CENTER,
55
- margin: {
56
- left: 5,
57
- right: 5
58
- },
59
- zIndex: valueOrDefault(labels.zIndex, this.series.zIndex)
60
- }, labels),
61
- pointData
62
- );
56
+ this.label = this.createLabelElement(labels);
63
57
  this.append(this.label);
64
58
  }
59
+ };
65
60
 
66
- this.createNote();
61
+ LinePoint.prototype.createLabelElement = function createLabelElement (options) {
62
+ return new TextBox(this.getLabelText(options),
63
+ deepExtend({
64
+ align: CENTER,
65
+ vAlign: CENTER,
66
+ margin: {
67
+ left: 5,
68
+ right: 5
69
+ },
70
+ zIndex: valueOrDefault(options.zIndex, this.series.zIndex)
71
+ }, options),
72
+ this.pointData()
73
+ );
74
+ };
67
75
 
68
- if (this.errorBar) {
69
- this.append(this.errorBar);
76
+ LinePoint.prototype.getLabelText = function getLabelText (options) {
77
+ var labelTemplate = getTemplate(options);
78
+
79
+ if (labelTemplate) {
80
+ return labelTemplate(this.pointData());
81
+ } else if (options.format) {
82
+ return this.formatValue(options.format);
70
83
  }
84
+
85
+ return this.value;
86
+ };
87
+
88
+ LinePoint.prototype.getAriaLabelText = function getAriaLabelText () {
89
+ var labels = this.options.labels;
90
+
91
+ if (labels.ariaTemplate) {
92
+ return TemplateService.compile(labels.ariaTemplate)(this.pointData());
93
+ }
94
+
95
+ return this.getLabelText(labels);
71
96
  };
72
97
 
73
98
  LinePoint.prototype.markerBorder = function markerBorder () {
@@ -96,7 +121,10 @@ var LinePoint = (function (ChartElement) {
96
121
  opacity: options.opacity,
97
122
  zIndex: valueOrDefault(options.zIndex, this.series.zIndex),
98
123
  animation: options.animation,
99
- visual: options.visual
124
+ visual: options.visual,
125
+ accessibilityOptions: deepExtend({
126
+ ariaLabel: this.getAriaLabelText(this.options.labels)
127
+ }, this.options.accessibility)
100
128
  }, {
101
129
  dataItem: this.dataItem,
102
130
  value: this.value,
@@ -233,6 +261,28 @@ var LinePoint = (function (ChartElement) {
233
261
  };
234
262
  };
235
263
 
264
+ LinePoint.prototype.createFocusHighlight = function createFocusHighlight () {
265
+ var markerOptions = this.options.markers;
266
+ var highlightOptions = this.options.accessibility.highlight;
267
+ var size = markerOptions.size + (markerOptions.border.width || 0);
268
+
269
+ var highlight = new ShapeElement({
270
+ type: markerOptions.type,
271
+ width: size,
272
+ height: size,
273
+ rotation: markerOptions.rotation,
274
+ background: highlightOptions.color,
275
+ border: highlightOptions.border,
276
+ opacity: highlightOptions.opacity,
277
+ padding: highlightOptions.border.width / 2,
278
+ zIndex: highlightOptions.zIndex
279
+ });
280
+
281
+ highlight.reflow(this._childBox);
282
+
283
+ return highlight.getElement();
284
+ };
285
+
236
286
  LinePoint.prototype.tooltipAnchor = function tooltipAnchor () {
237
287
  var markerBox = this.markerBox();
238
288
  var clipBox = this.owner.pane.clipBox();
@@ -291,6 +341,33 @@ var LinePoint = (function (ChartElement) {
291
341
  };
292
342
  };
293
343
 
344
+ LinePoint.prototype.focusVisual = function focusVisual () {
345
+ if (this.marker) {
346
+ this._id = guid();
347
+
348
+ if (this.marker.visual) {
349
+ this.marker.visual.options.set("id", this._id);
350
+ }
351
+
352
+ this.toggleFocusHighlight(true);
353
+ }
354
+ };
355
+
356
+ LinePoint.prototype.clearFocusFromVisual = function clearFocusFromVisual () {
357
+ if (this.marker) {
358
+ if (this.marker.visual) {
359
+ this.marker.visual.options.set("id", "");
360
+ }
361
+
362
+ this._id = null;
363
+ this.toggleFocusHighlight(false);
364
+ }
365
+ };
366
+
367
+ LinePoint.prototype.getIndex = function getIndex () {
368
+ return defined(this.categoryIx) ? this.categoryIx : this.pointIx;
369
+ };
370
+
294
371
  return LinePoint;
295
372
  }(ChartElement));
296
373
 
@@ -332,6 +409,12 @@ LinePoint.prototype.defaults = {
332
409
  line: {
333
410
  width: 1
334
411
  }
412
+ },
413
+ accessibility: {
414
+ tabIndex: 0,
415
+ role: CHART_POINT_ROLE,
416
+ className: CHART_POINT_CLASSNAME,
417
+ ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
335
418
  }
336
419
  };
337
420
 
@@ -0,0 +1,36 @@
1
+ import addAccessibilityAttributesToVisual from "../../core/utils/add-accessibility-attributes-to-visual";
2
+ import { deepExtend } from "../../common";
3
+ import guid from '../../core/utils/guid';
4
+ import TemplateService from "../../services/template-service";
5
+
6
+ var AccessibilityAttributesMixin = {
7
+ addAccessibilityAttributesToVisual: function() {
8
+ var accessibilityOptions = deepExtend({ ariaLabel: this.getAriaLabelText() }, this.options.accessibility);
9
+
10
+ addAccessibilityAttributesToVisual(this.visual, accessibilityOptions);
11
+ },
12
+
13
+ getAriaLabelText: function getAriaLabelText() {
14
+ var labels = this.options.labels;
15
+
16
+ if (labels.ariaTemplate) {
17
+ return TemplateService.compile(labels.ariaTemplate)(this.pointData());
18
+ }
19
+
20
+ return this.getLabelText(labels);
21
+ },
22
+
23
+ focusVisual: function focusVisual() {
24
+ this._id = guid();
25
+ this.visual.options.set("id", this._id);
26
+ this.toggleFocusHighlight(true);
27
+ },
28
+
29
+ clearFocusFromVisual: function clearFocusFromVisual() {
30
+ this.visual.options.set("id", "");
31
+ this._id = null;
32
+ this.toggleFocusHighlight(false);
33
+ }
34
+ };
35
+
36
+ export default AccessibilityAttributesMixin;
@@ -114,7 +114,7 @@ var PieChart = (function (ChartElement) {
114
114
  dataItem: fields.dataItem,
115
115
  category: fields.category,
116
116
  percentage: fields.percentage
117
- }, { defaults: series._defaults, excluded: [ "data", "content", "template", "visual", "toggle" ] });
117
+ }, { defaults: series._defaults, excluded: [ "data", "content", "template", "visual", "toggle", "ariaTemplate" ] });
118
118
  };
119
119
 
120
120
  PieChart.prototype.addValue = function addValue (value, sector, fields) {
@@ -4,11 +4,12 @@ import { ChartElement, ShapeBuilder, TextBox, Box } from '../../core';
4
4
 
5
5
  import PointEventsMixin from '../mixins/point-events-mixin';
6
6
 
7
- import { OUTSIDE_END, INSIDE_END, PIE, FADEIN, TOOLTIP_OFFSET } from '../constants';
7
+ import { OUTSIDE_END, INSIDE_END, PIE, FADEIN, TOOLTIP_OFFSET, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
8
8
  import hasGradientOverlay from '../utils/has-gradient-overlay';
9
9
 
10
10
  import { TOP, BOTTOM, LEFT, RIGHT, DEFAULT_FONT, CIRCLE, WHITE, CENTER, DEFAULT_PRECISION } from '../../common/constants';
11
11
  import { autoTextColor, setDefaultOptions, getSpacing, getTemplate, deepExtend, round, rad } from '../../common';
12
+ import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
12
13
 
13
14
  var PieSegment = (function (ChartElement) {
14
15
  function PieSegment(value, sector, options) {
@@ -23,23 +24,18 @@ var PieSegment = (function (ChartElement) {
23
24
  PieSegment.prototype.constructor = PieSegment;
24
25
 
25
26
  PieSegment.prototype.render = function render () {
26
- var labels = this.options.labels;
27
- var chartService = this.owner.chartService;
28
- var labelText = this.value;
29
-
30
27
  if (this._rendered || this.visible === false) {
31
28
  return;
32
29
  }
33
30
  this._rendered = true;
34
31
 
35
- var labelTemplate = getTemplate(labels);
36
- var pointData = this.pointData();
32
+ this.createLabel();
33
+ };
37
34
 
38
- if (labelTemplate) {
39
- labelText = labelTemplate(pointData);
40
- } else if (labels.format) {
41
- labelText = chartService.format.auto(labels.format, labelText);
42
- }
35
+ PieSegment.prototype.createLabel = function createLabel () {
36
+ var labels = this.options.labels;
37
+ var chartService = this.owner.chartService;
38
+ var labelText = this.getLabelText(labels);
43
39
 
44
40
  if (labels.visible && (labelText || labelText === 0)) {
45
41
  if (labels.position === CENTER || labels.position === INSIDE_END) {
@@ -63,12 +59,22 @@ var PieSegment = (function (ChartElement) {
63
59
  type: FADEIN,
64
60
  delay: this.animationDelay
65
61
  }
66
- }), pointData);
62
+ }), this.pointData());
67
63
 
68
64
  this.append(this.label);
69
65
  }
70
66
  };
71
67
 
68
+ PieSegment.prototype.getLabelText = function getLabelText (options) {
69
+ var labelTemplate = getTemplate(options);
70
+
71
+ if (labelTemplate) {
72
+ return labelTemplate(this.pointData());
73
+ }
74
+
75
+ return this.owner.chartService.format.auto(options.format, this.value);
76
+ };
77
+
72
78
  PieSegment.prototype.reflow = function reflow (targetBox) {
73
79
  this.render();
74
80
  this.box = targetBox;
@@ -120,6 +126,8 @@ var PieSegment = (function (ChartElement) {
120
126
 
121
127
  ChartElement.prototype.createVisual.call(this);
122
128
 
129
+ this.addAccessibilityAttributesToVisual();
130
+
123
131
  if (this.value) {
124
132
  if (options.visual) {
125
133
  var startAngle = (sector.startAngle + 180) % 360;
@@ -252,6 +260,24 @@ var PieSegment = (function (ChartElement) {
252
260
  };
253
261
  };
254
262
 
263
+ PieSegment.prototype.createFocusHighlight = function createFocusHighlight (style) {
264
+ var borderWidth = this.options.accessibility.highlight.border.width;
265
+ var result = this.createSegment(this.sector, deepExtend({}, style, {
266
+ stroke: {
267
+ width: borderWidth * 2
268
+ }
269
+ }));
270
+
271
+ var clipPath = new draw.MultiPath();
272
+
273
+ clipPath.paths.push(draw.Path.fromRect(result.bbox()));
274
+ clipPath.paths.push(this.createSegment(this.sector, {}));
275
+
276
+ result.clip(clipPath);
277
+
278
+ return result;
279
+ };
280
+
255
281
  PieSegment.prototype.tooltipAnchor = function tooltipAnchor () {
256
282
  var sector = this.sector.clone().expand(TOOLTIP_OFFSET);
257
283
  var midAndle = sector.middle();
@@ -277,6 +303,10 @@ var PieSegment = (function (ChartElement) {
277
303
  };
278
304
  };
279
305
 
306
+ PieSegment.prototype.getIndex = function getIndex () {
307
+ return this.index;
308
+ };
309
+
280
310
  return PieSegment;
281
311
  }(ChartElement));
282
312
 
@@ -339,9 +369,15 @@ setDefaultOptions(PieSegment, {
339
369
  width: 1
340
370
  }
341
371
  },
342
- visible: true
372
+ visible: true,
373
+ accessibility: {
374
+ role: CHART_POINT_ROLE,
375
+ className: CHART_POINT_CLASSNAME,
376
+ ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
377
+ }
343
378
  });
344
379
 
345
380
  deepExtend(PieSegment.prototype, PointEventsMixin);
381
+ deepExtend(PieSegment.prototype, AccessibilityAttributesMixin);
346
382
 
347
383
  export default PieSegment;
@@ -24,10 +24,10 @@ import { appendIfNotNull, categoriesCount, createOutOfRangePoints, equalsIgnoreC
24
24
 
25
25
  import { BAR, COLUMN, BULLET, VERTICAL_BULLET, LINE, VERTICAL_LINE, AREA, VERTICAL_AREA,
26
26
  RANGE_AREA, VERTICAL_RANGE_AREA, RANGE_COLUMN, RANGE_BAR, WATERFALL, HORIZONTAL_WATERFALL,
27
- BOX_PLOT, VERTICAL_BOX_PLOT, OHLC, CANDLESTICK, LOGARITHMIC, STEP, EQUALLY_SPACED_SERIES } from '../constants';
27
+ BOX_PLOT, VERTICAL_BOX_PLOT, OHLC, CANDLESTICK, LOGARITHMIC, STEP, EQUALLY_SPACED_SERIES, RADAR_LINE, RADAR_AREA } from '../constants';
28
28
 
29
29
  import { DATE, MAX_VALUE } from '../../common/constants';
30
- import { setDefaultOptions, inArray, deepExtend, defined, eventElement, grep } from '../../common';
30
+ import { setDefaultOptions, inArray, deepExtend, defined, eventElement, grep, cycleIndex } from '../../common';
31
31
 
32
32
  var AREA_SERIES = [ AREA, VERTICAL_AREA, RANGE_AREA, VERTICAL_RANGE_AREA ];
33
33
  var OUT_OF_RANGE_SERIES = [ LINE, VERTICAL_LINE ].concat(AREA_SERIES);
@@ -841,6 +841,57 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
841
841
  updateAxisOptions(this.originalOptions, axis, options);
842
842
  };
843
843
 
844
+ CategoricalPlotArea.prototype._pointsByVertical = function _pointsByVertical (basePoint, offset) {
845
+ if ( offset === void 0 ) offset = 0;
846
+
847
+ if (this.invertAxes) {
848
+ return this._siblingsBySeriesIndex(basePoint, offset);
849
+ }
850
+
851
+ return this._siblingsByPointIndex(basePoint, offset);
852
+ };
853
+
854
+ CategoricalPlotArea.prototype._pointsByHorizontal = function _pointsByHorizontal (basePoint, offset) {
855
+ if ( offset === void 0 ) offset = 0;
856
+
857
+ if (this.invertAxes) {
858
+ return this._siblingsByPointIndex(basePoint, offset);
859
+ }
860
+
861
+ return this._siblingsBySeriesIndex(basePoint, offset);
862
+ };
863
+
864
+ CategoricalPlotArea.prototype._siblingsByPointIndex = function _siblingsByPointIndex (basePoint) {
865
+ return this
866
+ .pointsByPointIndex(basePoint.getIndex())
867
+ .sort(this._getSeriesCompareFn(basePoint));
868
+ };
869
+
870
+ CategoricalPlotArea.prototype._siblingsBySeriesIndex = function _siblingsBySeriesIndex (basePoint, offset) {
871
+ var index = cycleIndex(basePoint.series.index + offset, this.series.length);
872
+
873
+ return this.pointsBySeriesIndex(index);
874
+ };
875
+
876
+ CategoricalPlotArea.prototype._getSeriesCompareFn = function _getSeriesCompareFn (point) {
877
+ var isStacked = this._isInStackedSeries(point);
878
+
879
+ if (isStacked && this.invertAxes || !isStacked && !this.invertAxes) {
880
+ return function (a, b) { return a.box.center().x - b.box.center().x; };
881
+ }
882
+
883
+ return function (a, b) { return a.box.center().y - b.box.center().y; };
884
+ };
885
+
886
+ CategoricalPlotArea.prototype._isInStackedSeries = function _isInStackedSeries (point) {
887
+ var sortableSeries = inArray(point.series.type,
888
+ [ AREA, VERTICAL_AREA, RANGE_AREA, VERTICAL_RANGE_AREA, LINE, VERTICAL_LINE, RADAR_LINE, RADAR_AREA]);
889
+
890
+ var stackableSeries = inArray(point.series.type, [ COLUMN, BAR]);
891
+
892
+ return sortableSeries || stackableSeries && point.options.isStacked;
893
+ };
894
+
844
895
  return CategoricalPlotArea;
845
896
  }(PlotAreaBase));
846
897
 
@@ -45,6 +45,14 @@ var FunnelPlotArea = (function (PlotAreaBase) {
45
45
  append(this.options.legend.items, chart.legendItems);
46
46
  };
47
47
 
48
+ FunnelPlotArea.prototype._pointsByVertical = function _pointsByVertical (basePoint) {
49
+ return this.pointsBySeriesIndex(basePoint.series.index);
50
+ };
51
+
52
+ FunnelPlotArea.prototype._pointsByHorizontal = function _pointsByHorizontal (basePoint) {
53
+ return [basePoint];
54
+ };
55
+
48
56
  return FunnelPlotArea;
49
57
  }(PlotAreaBase));
50
58