@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,6 +1,7 @@
1
- import { deepExtend, eventElement, grep, inArray, setDefaultOptions, createHashSet } from '../../common';
1
+ import { deepExtend, eventElement, grep, inArray, setDefaultOptions, createHashSet, cycleIndex } from '../../common';
2
2
  import { DATE } from '../../common/constants';
3
3
  import { CategoryAxis, DateCategoryAxis, Point } from '../../core';
4
+ import { dateEquals } from '../../date-utils';
4
5
  import { HEATMAP } from '../constants';
5
6
  import HeatmapChart from '../heatmap-chart/heatmap-chart';
6
7
  import PlotAreaEventsMixin from '../mixins/plotarea-events-mixin';
@@ -293,9 +294,73 @@ var HeatmapPlotArea = (function (PlotAreaBase) {
293
294
  return Object.assign({}, axis.options.crosshair, { zIndex: 0 });
294
295
  };
295
296
 
297
+ HeatmapPlotArea.prototype._pointsByVertical = function _pointsByVertical (basePoint, offset) {
298
+ var this$1 = this;
299
+ if ( offset === void 0 ) offset = 0;
300
+
301
+ var normalizedOffset = this.axisX.options.reverse ? offset * -1 : offset;
302
+ var axisXItems = this.axisX.children;
303
+ var xIndex = this._getPointAxisXIndex(basePoint) + normalizedOffset;
304
+
305
+ xIndex = cycleIndex(xIndex, axisXItems.length);
306
+ var targetXValue = axisXItems[xIndex].value;
307
+
308
+ var points = this
309
+ .filterPoints(function (point) { return compareValues(point.pointData().x, targetXValue); })
310
+ .sort(function (a, b) { return this$1._getPointAxisYIndex(a) - this$1._getPointAxisYIndex(b); });
311
+
312
+ if (this.axisY.options.reverse) {
313
+ return points.reverse();
314
+ }
315
+
316
+ return points;
317
+ };
318
+
319
+ HeatmapPlotArea.prototype._pointsByHorizontal = function _pointsByHorizontal (basePoint, offset) {
320
+ var this$1 = this;
321
+ if ( offset === void 0 ) offset = 0;
322
+
323
+ var normalizedOffset = this.axisY.options.reverse ? offset * -1 : offset;
324
+ var axisYItems = this.axisY.children;
325
+ var yIndex = this._getPointAxisYIndex(basePoint) + normalizedOffset;
326
+
327
+ yIndex = cycleIndex(yIndex, axisYItems.length);
328
+ var targetYValue = axisYItems[yIndex].value;
329
+
330
+ var points = this
331
+ .filterPoints(function (point) { return compareValues(point.pointData().y, targetYValue); })
332
+ .sort(function (a, b) { return this$1._getPointAxisXIndex(a) - this$1._getPointAxisXIndex(b); });
333
+
334
+ if (this.axisX.options.reverse) {
335
+ return points.reverse();
336
+ }
337
+
338
+ return points;
339
+ };
340
+
341
+ HeatmapPlotArea.prototype._getPointAxisXIndex = function _getPointAxisXIndex (point) {
342
+ return this._getPointAxisIndex(this.axisX, point.pointData().x);
343
+ };
344
+
345
+ HeatmapPlotArea.prototype._getPointAxisYIndex = function _getPointAxisYIndex (point) {
346
+ return this._getPointAxisIndex(this.axisY, point.pointData().y);
347
+ };
348
+
349
+ HeatmapPlotArea.prototype._getPointAxisIndex = function _getPointAxisIndex (axis, pointValue) {
350
+ return axis.children.findIndex(function (axisItem) { return compareValues(pointValue, axisItem.value); });
351
+ };
352
+
296
353
  return HeatmapPlotArea;
297
354
  }(PlotAreaBase));
298
355
 
356
+ function compareValues(a, b) {
357
+ if (a instanceof Date && b instanceof Date) {
358
+ return dateEquals(a, b);
359
+ }
360
+
361
+ return a === b;
362
+ }
363
+
299
364
  function updateAxisOptions(targetOptions, axisIndex, vertical, options) {
300
365
  var axisOptions = ([].concat(vertical ? targetOptions.yAxis : targetOptions.xAxis))[axisIndex];
301
366
  deepExtend(axisOptions, options);
@@ -7,7 +7,8 @@ import { hasValue } from '../utils';
7
7
  import SeriesBinder from '../series-binder';
8
8
 
9
9
  import { WHITE, BLACK, X, Y, COORD_PRECISION, TOP, BOTTOM, LEFT, RIGHT, START, END, INHERIT } from '../../common/constants';
10
- import { append, deepExtend, defined, getSpacing, getTemplate, inArray, isFunction, isString, limitValue, round, setDefaultOptions, last } from '../../common';
10
+ import { append, deepExtend, defined, getSpacing, getTemplate, inArray, isFunction, isString,
11
+ limitValue, round, setDefaultOptions, last, cycleIndex } from '../../common';
11
12
  import { TRENDLINE_SERIES } from '../constants';
12
13
 
13
14
  var PlotAreaBase = (function (ChartElement) {
@@ -846,6 +847,7 @@ var PlotAreaBase = (function (ChartElement) {
846
847
  if (categoryIndex !== null) {
847
848
  for (var i = 0; i < charts.length; i++) {
848
849
  var chart = charts[i];
850
+
849
851
  if (chart.pane.options.name === "_navigator") {
850
852
  continue;
851
853
  }
@@ -871,6 +873,12 @@ var PlotAreaBase = (function (ChartElement) {
871
873
  });
872
874
  };
873
875
 
876
+ PlotAreaBase.prototype.pointsByPointIndex = function pointsByPointIndex (pointIndex) {
877
+ return this.filterPoints(function(point) {
878
+ return point.getIndex() === pointIndex;
879
+ });
880
+ };
881
+
874
882
  PlotAreaBase.prototype.pointsBySeriesName = function pointsBySeriesName (name) {
875
883
  return this.filterPoints(function(point) {
876
884
  return point.series.name === name;
@@ -1037,6 +1045,68 @@ var PlotAreaBase = (function (ChartElement) {
1037
1045
  return this.series.find(function (series) { return series.name === name; });
1038
1046
  };
1039
1047
 
1048
+ PlotAreaBase.prototype.getFirstPoint = function getFirstPoint () {
1049
+ return this.pointsBySeriesIndex(0)[0];
1050
+ };
1051
+
1052
+ PlotAreaBase.prototype.getPointBelow = function getPointBelow (point) {
1053
+ return this._getNextPoint(point, this._pointsByVertical, 1);
1054
+ };
1055
+
1056
+ PlotAreaBase.prototype.getPointAbove = function getPointAbove (point) {
1057
+ return this._getNextPoint(point, this._pointsByVertical, -1);
1058
+ };
1059
+
1060
+ PlotAreaBase.prototype.getPointToTheRight = function getPointToTheRight (point) {
1061
+ return this._getNextPoint(point, this._pointsByHorizontal, 1);
1062
+ };
1063
+
1064
+ PlotAreaBase.prototype.getPointToTheLeft = function getPointToTheLeft (point) {
1065
+ return this._getNextPoint(point, this._pointsByHorizontal, -1);
1066
+ };
1067
+
1068
+ PlotAreaBase.prototype._getNextPoint = function _getNextPoint (point, getPointsFunc, increment) {
1069
+ var this$1 = this;
1070
+
1071
+ var points = getPointsFunc.call(this, point);
1072
+ var pointIndex = points.indexOf(point);
1073
+ var nextIndex = pointIndex + increment;
1074
+ var loopPoints = function (direction) {
1075
+ // loop over to last non-empty collection
1076
+ var result;
1077
+ var offset = 0;
1078
+ do {
1079
+ offset += direction;
1080
+ result = getPointsFunc.call(this$1, point, offset);
1081
+ } while (result.length === 0);
1082
+
1083
+ return result;
1084
+ };
1085
+
1086
+ if (nextIndex < 0) {
1087
+ points = loopPoints(-1);
1088
+
1089
+ return points.at(-1);
1090
+ } else if (nextIndex >= points.length) {
1091
+ points = loopPoints(1);
1092
+
1093
+ return points.at(0);
1094
+ }
1095
+
1096
+ return points[nextIndex];
1097
+ };
1098
+
1099
+ PlotAreaBase.prototype._pointsByVertical = function _pointsByVertical (basePoint) {
1100
+ return this.pointsByPointIndex(basePoint.getIndex());
1101
+ };
1102
+
1103
+ PlotAreaBase.prototype._pointsByHorizontal = function _pointsByHorizontal (basePoint, offset) {
1104
+ if ( offset === void 0 ) offset = 0;
1105
+
1106
+ var index = cycleIndex(basePoint.series.index + offset, this.series.length);
1107
+ return this.pointsBySeriesIndex(index);
1108
+ };
1109
+
1040
1110
  return PlotAreaBase;
1041
1111
  }(ChartElement));
1042
1112
 
@@ -167,6 +167,14 @@ var RadarPlotArea = (function (PolarPlotAreaBase) {
167
167
 
168
168
  RadarPlotArea.prototype.createCrosshairs = function createCrosshairs () {};
169
169
 
170
+ RadarPlotArea.prototype._pointsByVertical = function _pointsByVertical (basePoint) {
171
+ return PolarPlotAreaBase.prototype._pointsByVertical.call(this, basePoint).sort(this._getSeriesCompareFn());
172
+ };
173
+
174
+ RadarPlotArea.prototype._getSeriesCompareFn = function _getSeriesCompareFn () {
175
+ return function (a, b) { return b.value - a.value; };
176
+ };
177
+
170
178
  return RadarPlotArea;
171
179
  }(PolarPlotAreaBase));
172
180
 
@@ -11,6 +11,10 @@ var RadarSegment = (function (DonutSegment) {
11
11
  RadarSegment.prototype = Object.create( DonutSegment && DonutSegment.prototype );
12
12
  RadarSegment.prototype.constructor = RadarSegment;
13
13
 
14
+ RadarSegment.prototype.getIndex = function getIndex () {
15
+ return this.categoryIx;
16
+ };
17
+
14
18
  return RadarSegment;
15
19
  }(DonutSegment));
16
20
 
@@ -5,7 +5,7 @@ import RangeLinePoint from './range-line-point';
5
5
  import PointEventsMixin from '../mixins/point-events-mixin';
6
6
  import NoteMixin from '../mixins/note-mixin';
7
7
 
8
- import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, TOOLTIP_OFFSET, ABOVE, BELOW } from '../constants';
8
+ import { LINE_MARKER_SIZE, FADEIN, INITIAL_ANIMATION_DURATION, TOOLTIP_OFFSET, ABOVE, BELOW, CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
9
9
  import { WHITE, CIRCLE, HIGHLIGHT_ZINDEX, LEFT, RIGHT, BOTTOM, CENTER } from '../../common/constants';
10
10
  import { deepExtend, valueOrDefault, getSpacing } from '../../common';
11
11
 
@@ -91,6 +91,14 @@ var RangeAreaPoint = (function (ChartElement) {
91
91
  };
92
92
  };
93
93
 
94
+ RangeAreaPoint.prototype.createFocusHighlight = function createFocusHighlight () {
95
+ var group = new draw.Group();
96
+ group.append(this.fromPoint.createFocusHighlight());
97
+ group.append(this.toPoint.createFocusHighlight());
98
+
99
+ return group;
100
+ };
101
+
94
102
  RangeAreaPoint.prototype.tooltipAnchor = function tooltipAnchor () {
95
103
  var clipBox = this.owner.pane.clipBox();
96
104
  var showTooltip = !clipBox || clipBox.overlaps(this.box);
@@ -194,6 +202,18 @@ var RangeAreaPoint = (function (ChartElement) {
194
202
  point.owner = this.owner;
195
203
  };
196
204
 
205
+ RangeAreaPoint.prototype.focusVisual = function focusVisual () {
206
+ this.fromPoint.focusVisual();
207
+ };
208
+
209
+ RangeAreaPoint.prototype.clearFocusFromVisual = function clearFocusFromVisual () {
210
+ this.toPoint.clearFocusFromVisual();
211
+ };
212
+
213
+ RangeAreaPoint.prototype.getIndex = function getIndex () {
214
+ return this.categoryIx;
215
+ };
216
+
197
217
  return RangeAreaPoint;
198
218
  }(ChartElement));
199
219
 
@@ -235,6 +255,11 @@ RangeAreaPoint.prototype.defaults = {
235
255
  },
236
256
  tooltip: {
237
257
  format: '{0} - {1}'
258
+ },
259
+ accessibility: {
260
+ role: CHART_POINT_ROLE,
261
+ className: CHART_POINT_CLASSNAME,
262
+ ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
238
263
  }
239
264
  };
240
265
 
@@ -1,7 +1,6 @@
1
1
  import Bar from '../bar-chart/bar';
2
- import BarLabel from '../bar-chart/bar-label';
3
2
 
4
- import { deepExtend, getTemplate } from '../../common';
3
+ import { deepExtend } from '../../common';
5
4
 
6
5
  var RangeBar = (function (Bar) {
7
6
  function RangeBar () {
@@ -18,36 +17,16 @@ var RangeBar = (function (Bar) {
18
17
  var toOptions = deepExtend({}, labels, labels.to);
19
18
 
20
19
  if (fromOptions.visible) {
21
- this.labelFrom = this._createLabel(fromOptions);
20
+ this.labelFrom = this.createLabelElement(fromOptions);
22
21
  this.append(this.labelFrom);
23
22
  }
24
23
 
25
24
  if (toOptions.visible) {
26
- this.labelTo = this._createLabel(toOptions);
25
+ this.labelTo = this.createLabelElement(toOptions);
27
26
  this.append(this.labelTo);
28
27
  }
29
28
  };
30
29
 
31
- RangeBar.prototype._createLabel = function _createLabel (options) {
32
- var labelTemplate = getTemplate(options);
33
- var pointData = this.pointData();
34
-
35
- var labelText;
36
-
37
- if (labelTemplate) {
38
- labelText = labelTemplate(pointData);
39
- } else {
40
- labelText = this.formatValue(options.format);
41
- }
42
-
43
- return new BarLabel(labelText,
44
- deepExtend({
45
- vertical: this.options.vertical
46
- },
47
- options
48
- ), pointData);
49
- };
50
-
51
30
  RangeBar.prototype.reflow = function reflow (targetBox) {
52
31
  this.render();
53
32
 
@@ -172,7 +172,7 @@ var ScatterChart = (function (ChartElement) {
172
172
  excluded: [
173
173
  "data", "tooltip", "content", "template", "visual", "toggle",
174
174
  "_outOfRangeMinPoint", "_outOfRangeMaxPoint",
175
- "drilldownSeriesFactory"
175
+ "drilldownSeriesFactory", "ariaTemplate"
176
176
  ]
177
177
  };
178
178
 
@@ -1,4 +1,10 @@
1
1
  export var ARC = "arc";
2
+ export var ARROW_UP = "ArrowUp";
3
+ export var ARROW_DOWN = "ArrowDown";
4
+ export var ARROW_LEFT = "ArrowLeft";
5
+ export var ARROW_RIGHT = "ArrowRight";
6
+ export var TAB = "Tab";
7
+ export var ARIA_ACTIVE_DESCENDANT = "aria-activedescendant";
2
8
  export var AXIS_LABEL_CLICK = "axisLabelClick";
3
9
  export var BLACK = "#000";
4
10
  export var BOTTOM = "bottom";
@@ -0,0 +1,5 @@
1
+ export default function cycleDown(index, count) {
2
+ var result = index - 1;
3
+
4
+ return result < 0 ? count - 1 : result;
5
+ }
@@ -0,0 +1,13 @@
1
+ export default function cycleIndex(index, length) {
2
+ if (length === 1 || (index % length) === 0) {
3
+ return 0;
4
+ }
5
+
6
+ if (index < 0) {
7
+ return length + (index % length);
8
+ } else if (index >= length) {
9
+ return index % length;
10
+ }
11
+
12
+ return index;
13
+ }
@@ -0,0 +1,3 @@
1
+ export default function cycleUp(index, count) {
2
+ return (index + 1) % count;
3
+ }
package/dist/es/common.js CHANGED
@@ -3,6 +3,9 @@ export { default as removeClass } from './common/remove-class';
3
3
  export { default as alignPathToPixel } from './common/align-path-to-pixel';
4
4
  export { default as clockwise } from './common/clockwise';
5
5
  export { default as convertableToNumber } from './common/convertable-to-number';
6
+ export { default as cycleUp } from './common/cycleUp';
7
+ export { default as cycleDown } from './common/cycleDown';
8
+ export { default as cycleIndex } from './common/cycleIndex';
6
9
  export { default as deepExtend } from './common/deep-extend';
7
10
  export { default as elementStyles } from './common/element-styles';
8
11
  export { default as getSpacing } from './common/get-spacing';
@@ -1,7 +1,7 @@
1
1
  import { drawing as draw } from '@progress/kendo-drawing';
2
2
 
3
3
  import { WHITE } from '../common/constants';
4
- import { Class, deepExtend, defined, valueOrDefault } from '../common';
4
+ import { Class, deepExtend, defined, valueOrDefault, autoTextColor } from '../common';
5
5
 
6
6
  var ChartElement = (function (Class) {
7
7
  function ChartElement(options) {
@@ -260,8 +260,8 @@ var ChartElement = (function (Class) {
260
260
  percentage: this.percentage,
261
261
  runningTotal: this.runningTotal,
262
262
  total: this.total
263
- }
264
- ));
263
+ })
264
+ );
265
265
 
266
266
  if (!highlight) {
267
267
  return;
@@ -280,6 +280,34 @@ var ChartElement = (function (Class) {
280
280
  highlight.visible(show);
281
281
  };
282
282
 
283
+ ChartElement.prototype.toggleFocusHighlight = function toggleFocusHighlight (show) {
284
+ var options = ((this.options || {}).accessibility || {}).highlight || {};
285
+ var focusHighlight = this._focusHighlight;
286
+
287
+ if (!show && !focusHighlight) {
288
+ return;
289
+ }
290
+
291
+ if (!focusHighlight) {
292
+ var rootBackground = this.getRoot().options.background;
293
+ var highlightColor = autoTextColor(rootBackground);
294
+ var focusHighlightOptions = {
295
+ fill: {
296
+ opacity: options.opacity,
297
+ color: options.color
298
+ },
299
+ stroke: Object.assign({}, {color: highlightColor}, options.border),
300
+ zIndex: options.zIndex
301
+ };
302
+
303
+ focusHighlight = this._focusHighlight = this.createFocusHighlight(focusHighlightOptions);
304
+
305
+ this.appendVisual(focusHighlight);
306
+ }
307
+
308
+ focusHighlight.visible(show);
309
+ };
310
+
283
311
  ChartElement.prototype.createGradientOverlay = function createGradientOverlay (element, options, gradientOptions) {
284
312
  var overlay = new draw.Path(Object.assign({
285
313
  stroke: {
@@ -17,7 +17,7 @@ var ShapeBuilder = (function (Class) {
17
17
  var endAngle = sector.angle + startAngle;
18
18
 
19
19
  //required in order to avoid reversing the arc direction in cases like 0.000000000000001 + 100 === 100
20
- if (sector.angle > 0 && startAngle === endAngle) {
20
+ if (sector.angle === 0 || sector.angle > 0 && startAngle === endAngle) {
21
21
  endAngle += DIRECTION_ANGLE;
22
22
  }
23
23
 
@@ -3,6 +3,7 @@ import { round, setDefaultOptions } from '../common';
3
3
  import { CENTER, CIRCLE, COORD_PRECISION, CROSS, ROUNDED_RECT, TRIANGLE } from '../common/constants';
4
4
  import { valueOrDefault } from '../drawing-utils';
5
5
  import BoxElement from './box-element';
6
+ import addAccessibilityAttributesToVisual from './utils/add-accessibility-attributes-to-visual';
6
7
 
7
8
  var ShapeElement = (function (BoxElement) {
8
9
  function ShapeElement(options, pointData) {
@@ -112,6 +113,8 @@ var ShapeElement = (function (BoxElement) {
112
113
 
113
114
  ShapeElement.prototype.createVisual = function createVisual () {
114
115
  this.visual = this.createElement();
116
+
117
+ addAccessibilityAttributesToVisual(this.visual, this.options.accessibilityOptions);
115
118
  };
116
119
 
117
120
  return ShapeElement;
@@ -0,0 +1,8 @@
1
+ export default function addAccessibilityAttributesToVisual(visual, accessibilityOptions) {
2
+ if (accessibilityOptions) {
3
+ visual.options.className = accessibilityOptions.className;
4
+ visual.options.role = accessibilityOptions.role;
5
+ visual.options.ariaLabel = accessibilityOptions.ariaLabel;
6
+ visual.options.ariaRoleDescription = accessibilityOptions.ariaRoleDescription;
7
+ }
8
+ }
@@ -0,0 +1,17 @@
1
+ export default function guid() {
2
+ var id = "";
3
+ var i;
4
+ var random;
5
+
6
+ for (i = 0; i < 32; i++) {
7
+ random = Math.random() * 16 | 0;
8
+
9
+ if (i === 8 || i === 12 || i === 16 || i === 20) {
10
+ id += "-";
11
+ }
12
+
13
+ id += (i === 12 ? 4 : (i === 16 ? (random & 3 | 8) : random)).toString(16); // eslint-disable-line no-nested-ternary
14
+ }
15
+
16
+ return id;
17
+ }
@@ -321,7 +321,6 @@ var GeoJsonLoader = (function (Class) {
321
321
  }
322
322
  };
323
323
 
324
- /* eslint-disable indent */
325
324
  GeoJsonLoader.prototype._loadGeometryTo = function _loadGeometryTo (container, geometry, dataItem) {
326
325
  var this$1 = this;
327
326
 
@@ -360,7 +359,6 @@ var GeoJsonLoader = (function (Class) {
360
359
  break;
361
360
  }
362
361
  };
363
- /* eslint-disable indent */
364
362
 
365
363
  GeoJsonLoader.prototype._setLineFill = function _setLineFill (path) {
366
364
  var segments = path.segments;
@@ -138,7 +138,6 @@ export var Navigator = (function (Observable) {
138
138
  e.preventDefault();
139
139
  };
140
140
 
141
- /* eslint-disable indent */
142
141
  Navigator.prototype._keydown = function _keydown (e) {
143
142
  switch (e.which) {
144
143
  case keys.UP:
@@ -509,7 +509,6 @@ export var UserEvents = (function (Observable) {
509
509
  this.trigger(CANCEL);
510
510
  };
511
511
 
512
- /* eslint-disable indent */
513
512
  UserEvents.prototype.notify = function notify (event, data) {
514
513
  var that = this,
515
514
  touches = that.touches;
@@ -539,7 +538,6 @@ export var UserEvents = (function (Observable) {
539
538
  type: eventName
540
539
  }));
541
540
  };
542
- /* eslint-enable indent */
543
541
 
544
542
  UserEvents.prototype.press = function press (x, y, target) {
545
543
  this._apiCall('_start', x, y, target);
@@ -421,24 +421,6 @@ export var wheelDeltaY = function (jQueryEvent) {
421
421
  return delta;
422
422
  };
423
423
 
424
- export var guid = function () {
425
- var id = "";
426
- var i;
427
- var random;
428
-
429
- for (i = 0; i < 32; i++) {
430
- random = Math.random() * 16 | 0;
431
-
432
- if (i === 8 || i === 12 || i === 16 || i === 20) {
433
- id += "-";
434
- }
435
-
436
- id += (i === 12 ? 4 : (i === 16 ? (random & 3 | 8) : random)).toString(16); // eslint-disable-line no-nested-ternary
437
- }
438
-
439
- return id;
440
- };
441
-
442
424
  export var now = function () {
443
425
  return Number(new Date());
444
426
  };
@@ -109,7 +109,6 @@ export var ZoomControl = (function (Observable) {
109
109
  e.preventDefault();
110
110
  };
111
111
 
112
- /* eslint-disable indent */
113
112
  ZoomControl.prototype._keydown = function _keydown (e) {
114
113
  switch (e.which) {
115
114
  case keys.NUMPAD_PLUS:
@@ -2,7 +2,7 @@ import { drawing as draw, Color } from '@progress/kendo-drawing';
2
2
 
3
3
  import BarLabel from './bar-label';
4
4
 
5
- import { BORDER_BRIGHTNESS, TOOLTIP_OFFSET } from '../constants';
5
+ import { CHART_POINT_ROLE_DESCRIPTION, CHART_POINT_CLASSNAME, CHART_POINT_ROLE, BORDER_BRIGHTNESS, TOOLTIP_OFFSET } from '../constants';
6
6
 
7
7
  import hasGradientOverlay from '../utils/has-gradient-overlay';
8
8
 
@@ -10,6 +10,7 @@ import { ChartElement, Point } from '../../core';
10
10
 
11
11
  import PointEventsMixin from '../mixins/point-events-mixin';
12
12
  import NoteMixin from '../mixins/note-mixin';
13
+ import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
13
14
 
14
15
  import { WHITE, LEFT, RIGHT, BOTTOM, TOP } from '../../common/constants';
15
16
  import { alignPathToPixel, deepExtend, defined, getTemplate, valueOrDefault } from '../../common';
@@ -46,24 +47,28 @@ class Bar extends ChartElement {
46
47
  const labels = options.labels;
47
48
 
48
49
  if (labels.visible) {
49
- const pointData = this.pointData();
50
- let labelTemplate = getTemplate(labels);
51
- let labelText;
50
+ this.label = this.createLabelElement(labels);
51
+ this.append(this.label);
52
+ }
53
+ }
52
54
 
53
- if (labelTemplate) {
54
- labelText = labelTemplate(pointData);
55
- } else {
56
- labelText = this.formatValue(labels.format);
57
- }
55
+ createLabelElement(options) {
56
+ return new BarLabel(this.getLabelText(options),
57
+ deepExtend({
58
+ vertical: this.options.vertical
59
+ },
60
+ options
61
+ ), this.pointData());
62
+ }
58
63
 
59
- this.label = new BarLabel(labelText,
60
- deepExtend({
61
- vertical: options.vertical
62
- },
63
- labels
64
- ), pointData);
65
- this.append(this.label);
64
+ getLabelText(options) {
65
+ let labelTemplate = getTemplate(options);
66
+
67
+ if (labelTemplate) {
68
+ return labelTemplate(this.pointData());
66
69
  }
70
+
71
+ return this.formatValue(options.format);
67
72
  }
68
73
 
69
74
  formatValue(format) {
@@ -100,6 +105,8 @@ class Bar extends ChartElement {
100
105
  if (this.visible !== false) {
101
106
  super.createVisual();
102
107
 
108
+ this.addAccessibilityAttributesToVisual();
109
+
103
110
  if (customVisual) {
104
111
  const visual = this.rectVisual = customVisual({
105
112
  category: this.category,
@@ -193,6 +200,13 @@ class Bar extends ChartElement {
193
200
  };
194
201
  }
195
202
 
203
+ createFocusHighlight(style) {
204
+ const borderWidth = this.options.accessibility.highlight.border.width;
205
+ const highlight = draw.Path.fromRect(this.box.pad(borderWidth / 2).toRect(), style);
206
+
207
+ return alignPathToPixel(highlight);
208
+ }
209
+
196
210
  getBorderColor() {
197
211
  const color = this.color;
198
212
  const border = this.options.border;
@@ -270,10 +284,15 @@ class Bar extends ChartElement {
270
284
  series: this.series
271
285
  };
272
286
  }
287
+
288
+ getIndex() {
289
+ return this.categoryIx;
290
+ }
273
291
  }
274
292
 
275
293
  deepExtend(Bar.prototype, PointEventsMixin);
276
294
  deepExtend(Bar.prototype, NoteMixin);
295
+ deepExtend(Bar.prototype, AccessibilityAttributesMixin);
277
296
 
278
297
  Bar.prototype.defaults = {
279
298
  border: {
@@ -290,6 +309,11 @@ Bar.prototype.defaults = {
290
309
  opacity: 1,
291
310
  notes: {
292
311
  label: {}
312
+ },
313
+ accessibility: {
314
+ role: CHART_POINT_ROLE,
315
+ className: CHART_POINT_CLASSNAME,
316
+ ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
293
317
  }
294
318
  };
295
319