@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.
- package/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/chart/bar-chart/bar.js +40 -16
- package/dist/es/chart/bubble-chart/bubble.js +10 -0
- package/dist/es/chart/bullet-chart/bullet.js +32 -11
- package/dist/es/chart/candlestick-chart/candlestick.js +37 -1
- package/dist/es/chart/categorical-chart.js +1 -1
- package/dist/es/chart/chart.js +307 -26
- package/dist/es/chart/constants.js +12 -1
- package/dist/es/chart/funnel-chart/funnel-chart.js +5 -3
- package/dist/es/chart/funnel-chart/funnel-segment.js +62 -3
- package/dist/es/chart/heatmap-chart/heatmap-chart.js +2 -1
- package/dist/es/chart/heatmap-chart/heatmap-point.js +68 -29
- package/dist/es/chart/legend/legend-item.js +32 -2
- package/dist/es/chart/legend/legend.js +6 -1
- package/dist/es/chart/line-chart/line-point.js +109 -26
- package/dist/es/chart/mixins/accessibility-attributes-mixin.js +36 -0
- package/dist/es/chart/pie-chart/pie-chart.js +1 -1
- package/dist/es/chart/pie-chart/pie-segment.js +50 -14
- package/dist/es/chart/plotarea/categorical-plotarea.js +53 -2
- package/dist/es/chart/plotarea/funnel-plotarea.js +8 -0
- package/dist/es/chart/plotarea/heatmap-plotarea.js +66 -1
- package/dist/es/chart/plotarea/plotarea-base.js +71 -1
- package/dist/es/chart/plotarea/radar-plotarea.js +8 -0
- package/dist/es/chart/radar-bar-chart/radar-segment.js +4 -0
- package/dist/es/chart/range-area-chart/range-area-point.js +26 -1
- package/dist/es/chart/range-bar-chart/range-bar.js +3 -24
- package/dist/es/chart/scatter-charts/scatter-chart.js +1 -1
- package/dist/es/common/constants.js +6 -0
- package/dist/es/common/cycleDown.js +5 -0
- package/dist/es/common/cycleIndex.js +13 -0
- package/dist/es/common/cycleUp.js +3 -0
- package/dist/es/common.js +3 -0
- package/dist/es/core/chart-element.js +31 -3
- package/dist/es/core/shape-builder.js +1 -1
- package/dist/es/core/shape-element.js +3 -0
- package/dist/es/core/utils/add-accessibility-attributes-to-visual.js +8 -0
- package/dist/es/core/utils/guid.js +17 -0
- package/dist/es/map/layers/shape.js +0 -2
- package/dist/es/map/navigator.js +0 -1
- package/dist/es/map/scroller/user-events.js +0 -2
- package/dist/es/map/utils.js +0 -18
- package/dist/es/map/zoom.js +0 -1
- package/dist/es2015/chart/bar-chart/bar.js +40 -16
- package/dist/es2015/chart/bubble-chart/bubble.js +10 -0
- package/dist/es2015/chart/bullet-chart/bullet.js +32 -11
- package/dist/es2015/chart/candlestick-chart/candlestick.js +37 -1
- package/dist/es2015/chart/categorical-chart.js +1 -1
- package/dist/es2015/chart/chart.js +295 -26
- package/dist/es2015/chart/constants.js +12 -1
- package/dist/es2015/chart/funnel-chart/funnel-chart.js +5 -3
- package/dist/es2015/chart/funnel-chart/funnel-segment.js +62 -3
- package/dist/es2015/chart/heatmap-chart/heatmap-chart.js +2 -1
- package/dist/es2015/chart/heatmap-chart/heatmap-point.js +68 -29
- package/dist/es2015/chart/legend/legend-item.js +32 -2
- package/dist/es2015/chart/legend/legend.js +6 -1
- package/dist/es2015/chart/line-chart/line-point.js +110 -26
- package/dist/es2015/chart/mixins/accessibility-attributes-mixin.js +36 -0
- package/dist/es2015/chart/pie-chart/pie-chart.js +1 -1
- package/dist/es2015/chart/pie-chart/pie-segment.js +50 -14
- package/dist/es2015/chart/plotarea/categorical-plotarea.js +49 -2
- package/dist/es2015/chart/plotarea/funnel-plotarea.js +8 -0
- package/dist/es2015/chart/plotarea/heatmap-plotarea.js +60 -1
- package/dist/es2015/chart/plotarea/plotarea-base.js +67 -1
- package/dist/es2015/chart/plotarea/radar-plotarea.js +8 -0
- package/dist/es2015/chart/radar-bar-chart/radar-segment.js +4 -0
- package/dist/es2015/chart/range-area-chart/range-area-point.js +26 -1
- package/dist/es2015/chart/range-bar-chart/range-bar.js +3 -24
- package/dist/es2015/chart/scatter-charts/scatter-chart.js +1 -1
- package/dist/es2015/common/constants.js +6 -0
- package/dist/es2015/common/cycleDown.js +5 -0
- package/dist/es2015/common/cycleIndex.js +13 -0
- package/dist/es2015/common/cycleUp.js +3 -0
- package/dist/es2015/common.js +3 -0
- package/dist/es2015/core/chart-element.js +31 -3
- package/dist/es2015/core/shape-builder.js +1 -1
- package/dist/es2015/core/shape-element.js +3 -0
- package/dist/es2015/core/utils/add-accessibility-attributes-to-visual.js +8 -0
- package/dist/es2015/core/utils/guid.js +17 -0
- package/dist/es2015/map/layers/shape.js +0 -2
- package/dist/es2015/map/navigator.js +0 -2
- package/dist/es2015/map/scroller/user-events.js +0 -2
- package/dist/es2015/map/utils.js +0 -18
- package/dist/es2015/map/zoom.js +0 -2
- package/dist/npm/main.js +1098 -156
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +1 -1
- package/dist/es/chart/area-chart/area-segment-mixin.js +0 -91
- package/dist/es2015/chart/area-chart/area-segment-mixin.js +0 -91
package/dist/es/chart/chart.js
CHANGED
|
@@ -20,16 +20,17 @@ import isDateAxis from './utils/is-date-axis';
|
|
|
20
20
|
import getDateField from './utils/get-date-field';
|
|
21
21
|
import { ChartPane, ChartPlotArea, findAxisByName } from './api-elements';
|
|
22
22
|
|
|
23
|
-
import { X, Y, VALUE, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_SERIES_OPACITY
|
|
23
|
+
import { X, Y, VALUE, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_SERIES_OPACITY,
|
|
24
|
+
ARROW_DOWN, ARROW_UP, ARROW_LEFT, ARROW_RIGHT, ARIA_ACTIVE_DESCENDANT, TAB, TOP, LEFT, BLACK } from '../common/constants';
|
|
24
25
|
import { addClass, Class, setDefaultOptions, deepExtend, defined, find, isObject, isFunction, elementSize, elementOffset,
|
|
25
26
|
elementScale, elementStyles, eventCoordinates, bindEvents, unbindEvents, mousewheelDelta, FontLoader, inArray, last, round,
|
|
26
|
-
HashMap, valueOrDefault, isString } from '../common';
|
|
27
|
+
HashMap, valueOrDefault, isString, cycleUp, cycleDown } from '../common';
|
|
27
28
|
|
|
28
29
|
import { dateComparer } from '../date-utils';
|
|
29
30
|
|
|
30
31
|
import { DRAG_START, DRAG, DRAG_END, ZOOM_START, ZOOM, ZOOM_END, SELECT_START, SELECT, SELECT_END, PLOT_AREA_HOVER, PLOT_AREA_LEAVE,
|
|
31
32
|
RENDER, CATEGORY, PIE, DONUT, FUNNEL, PYRAMID, COLUMN, MOUSEWHEEL, MOUSEWHEEL_DELAY, MOUSEWHEEL_ZOOM_RATE, SHOW_TOOLTIP, SERIES_HOVER,
|
|
32
|
-
SERIES_OVER, SERIES_LEAVE, SERIES_CLICK, DRILLDOWN } from './constants';
|
|
33
|
+
SERIES_OVER, SERIES_LEAVE, SERIES_CLICK, DRILLDOWN, LEGEND_ITEM_CLICK } from './constants';
|
|
33
34
|
|
|
34
35
|
import './animations';
|
|
35
36
|
import './register-charts';
|
|
@@ -39,6 +40,9 @@ var AXIS_NAMES = [ CATEGORY, VALUE, X, Y ];
|
|
|
39
40
|
var MOUSEMOVE = "mousemove";
|
|
40
41
|
var CONTEXTMENU = "contextmenu";
|
|
41
42
|
var MOUSELEAVE = "mouseleave";
|
|
43
|
+
var KEYDOWN = "keydown";
|
|
44
|
+
var FOCUS = "focus";
|
|
45
|
+
var BLUR = "blur";
|
|
42
46
|
var MOUSEMOVE_DELAY = 20;
|
|
43
47
|
|
|
44
48
|
var Chart = (function (Class) {
|
|
@@ -59,6 +63,7 @@ var Chart = (function (Class) {
|
|
|
59
63
|
this._originalOptions = deepExtend({}, options);
|
|
60
64
|
this._theme = themeOptions;
|
|
61
65
|
this._initTheme(options, themeOptions);
|
|
66
|
+
this._focusState = {};
|
|
62
67
|
|
|
63
68
|
this._initHandlers();
|
|
64
69
|
this._initSurface();
|
|
@@ -81,6 +86,9 @@ var Chart = (function (Class) {
|
|
|
81
86
|
Chart.prototype._initElement = function _initElement (element) {
|
|
82
87
|
this._setElementClass(element);
|
|
83
88
|
element.style.position = "relative";
|
|
89
|
+
element.tabIndex = element.getAttribute("tabindex") ? element.getAttribute("tabindex") : 0;
|
|
90
|
+
// To support user agents and assistive technologies based on the ARIA 1.0 specification, authors may wish to include the document role as a fallback value, in the form role="graphics-document document".
|
|
91
|
+
element.setAttribute("role", "graphics-document document");
|
|
84
92
|
while (element.firstChild) {
|
|
85
93
|
element.removeChild(element.firstChild);
|
|
86
94
|
}
|
|
@@ -296,8 +304,11 @@ var Chart = (function (Class) {
|
|
|
296
304
|
|
|
297
305
|
this._destroyView();
|
|
298
306
|
|
|
307
|
+
this._setElementAccessibilityAttributes();
|
|
308
|
+
|
|
299
309
|
this._model = model;
|
|
300
310
|
this._plotArea = model._plotArea;
|
|
311
|
+
this._legend = model._legend;
|
|
301
312
|
|
|
302
313
|
model.renderVisual();
|
|
303
314
|
|
|
@@ -335,6 +346,13 @@ var Chart = (function (Class) {
|
|
|
335
346
|
}
|
|
336
347
|
};
|
|
337
348
|
|
|
349
|
+
Chart.prototype._setElementAccessibilityAttributes = function _setElementAccessibilityAttributes () {
|
|
350
|
+
var titleOptions = this.options.title;
|
|
351
|
+
var title = isString(titleOptions) ? titleOptions : (titleOptions.description || titleOptions.text);
|
|
352
|
+
|
|
353
|
+
this.element.setAttribute("aria-roledescription", title);
|
|
354
|
+
};
|
|
355
|
+
|
|
338
356
|
Chart.prototype.exportVisual = function exportVisual (exportOptions) {
|
|
339
357
|
var visual;
|
|
340
358
|
if (exportOptions && (exportOptions.width || exportOptions.height || exportOptions.options)) {
|
|
@@ -484,7 +502,9 @@ var Chart = (function (Class) {
|
|
|
484
502
|
model.append.apply(model, Title.orderTitles([title, subtitle]));
|
|
485
503
|
|
|
486
504
|
if (options.legend && options.legend.visible) {
|
|
487
|
-
|
|
505
|
+
var legend = new Legend(plotArea.options.legend, this.chartService);
|
|
506
|
+
model.append(legend);
|
|
507
|
+
model._legend = legend;
|
|
488
508
|
}
|
|
489
509
|
model.append(plotArea);
|
|
490
510
|
model.reflow();
|
|
@@ -547,6 +567,9 @@ var Chart = (function (Class) {
|
|
|
547
567
|
|
|
548
568
|
Chart.prototype._initHandlers = function _initHandlers () {
|
|
549
569
|
this._clickHandler = this._click.bind(this);
|
|
570
|
+
this._keydownHandler = this._keydown.bind(this);
|
|
571
|
+
this._focusHandler = this._focus.bind(this);
|
|
572
|
+
this._blurHandler = this._blur.bind(this);
|
|
550
573
|
this._mousewheelHandler = this._mousewheel.bind(this);
|
|
551
574
|
this._mouseleaveHandler = this._mouseleave.bind(this);
|
|
552
575
|
this._surfaceMouseenterHandler = this._mouseover.bind(this);
|
|
@@ -592,7 +615,10 @@ var Chart = (function (Class) {
|
|
|
592
615
|
} else if (name === SERIES_LEAVE) {
|
|
593
616
|
this._resetDrilldownPoint();
|
|
594
617
|
} else if (name === SERIES_CLICK) {
|
|
618
|
+
this._focusPoint(args.point);
|
|
595
619
|
this._startDrilldown(args.point);
|
|
620
|
+
} else if (name === LEGEND_ITEM_CLICK) {
|
|
621
|
+
this._focusLegendItem(args);
|
|
596
622
|
}
|
|
597
623
|
|
|
598
624
|
var observers = this.observers;
|
|
@@ -613,7 +639,7 @@ var Chart = (function (Class) {
|
|
|
613
639
|
|
|
614
640
|
this._touchAction = element.style.touchAction;
|
|
615
641
|
|
|
616
|
-
bindEvents(element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj ));
|
|
642
|
+
bindEvents(element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj[ KEYDOWN ] = this._keydownHandler, obj[ FOCUS ] = this._focusHandler, obj[ BLUR] = this._blurHandler, obj ));
|
|
617
643
|
|
|
618
644
|
if (this._shouldAttachMouseMove()) {
|
|
619
645
|
bindEvents(element, ( obj$1 = {}, obj$1[ MOUSEMOVE ] = this._mousemove, obj$1 ));
|
|
@@ -659,6 +685,7 @@ var Chart = (function (Class) {
|
|
|
659
685
|
if (this._mousewheelZoom && !this._stopChartHandlers(e)) {
|
|
660
686
|
this._gestureDistance = e.distance;
|
|
661
687
|
this._unsetActivePoint();
|
|
688
|
+
this._clearFocusedElement();
|
|
662
689
|
this.surface.suspendTracking();
|
|
663
690
|
}
|
|
664
691
|
};
|
|
@@ -727,6 +754,7 @@ var Chart = (function (Class) {
|
|
|
727
754
|
if (this._pannable && this._pannable.start(e)) {
|
|
728
755
|
this.surface.suspendTracking();
|
|
729
756
|
this._unsetActivePoint();
|
|
757
|
+
this._clearFocusedElement();
|
|
730
758
|
this._suppressHover = true;
|
|
731
759
|
this.chartService.panning = true;
|
|
732
760
|
}
|
|
@@ -850,6 +878,7 @@ var Chart = (function (Class) {
|
|
|
850
878
|
|
|
851
879
|
if (!this._zooming) {
|
|
852
880
|
this._unsetActivePoint();
|
|
881
|
+
this._clearFocusedElement();
|
|
853
882
|
this.surface.suspendTracking();
|
|
854
883
|
this._zooming = true;
|
|
855
884
|
}
|
|
@@ -933,6 +962,7 @@ var Chart = (function (Class) {
|
|
|
933
962
|
} else {
|
|
934
963
|
this._suppressHover = true;
|
|
935
964
|
this._unsetActivePoint();
|
|
965
|
+
this._clearFocusedElement();
|
|
936
966
|
this._navState = {
|
|
937
967
|
axisRanges: ranges,
|
|
938
968
|
pane: pane,
|
|
@@ -1069,6 +1099,232 @@ var Chart = (function (Class) {
|
|
|
1069
1099
|
}
|
|
1070
1100
|
};
|
|
1071
1101
|
|
|
1102
|
+
Chart.prototype._isLegendBeforeChart = function _isLegendBeforeChart () {
|
|
1103
|
+
var ref = this;
|
|
1104
|
+
var legendPosition = ref.options.legend.position;
|
|
1105
|
+
var legend = ref._legend;
|
|
1106
|
+
|
|
1107
|
+
return legend && legend.hasItems() && (legendPosition === TOP || legendPosition === LEFT);
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
Chart.prototype._focus = function _focus () {
|
|
1111
|
+
if (!this._preventInitialPointFocus) {
|
|
1112
|
+
if (this._isLegendBeforeChart()) {
|
|
1113
|
+
this._focusFirstLegendItem();
|
|
1114
|
+
} else {
|
|
1115
|
+
this._focusFirstPoint();
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
Chart.prototype._keydown = function _keydown (e) {
|
|
1121
|
+
var ref = this;
|
|
1122
|
+
var legendInFocus = ref._focusState.legendInFocus;
|
|
1123
|
+
var legend = ref._legend;
|
|
1124
|
+
|
|
1125
|
+
if (e.key === TAB) {
|
|
1126
|
+
this._clearFocusedElement();
|
|
1127
|
+
var isLegendBeforeChart = this._isLegendBeforeChart();
|
|
1128
|
+
|
|
1129
|
+
if (legendInFocus && isLegendBeforeChart !== e.shiftKey) {
|
|
1130
|
+
this._navigatePoints(e);
|
|
1131
|
+
} else if (!legendInFocus && isLegendBeforeChart === e.shiftKey && legend.hasItems()) {
|
|
1132
|
+
this._navigateLegend(e);
|
|
1133
|
+
}
|
|
1134
|
+
} else if (!legendInFocus) {
|
|
1135
|
+
this._navigatePoints(e);
|
|
1136
|
+
} else {
|
|
1137
|
+
this._navigateLegend(e);
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
Chart.prototype._navigatePoints = function _navigatePoints (e) {
|
|
1142
|
+
var this$1 = this;
|
|
1143
|
+
|
|
1144
|
+
var ref = this;
|
|
1145
|
+
var focusState = ref._focusState;
|
|
1146
|
+
var plotArea = ref._plotArea;
|
|
1147
|
+
|
|
1148
|
+
focusState.legendInFocus = false;
|
|
1149
|
+
|
|
1150
|
+
if (!focusState.focusedElement) {
|
|
1151
|
+
this._focusFirstPoint();
|
|
1152
|
+
e.preventDefault();
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
var moveFocus = function (point) {
|
|
1157
|
+
focusState.focusedPoint = point;
|
|
1158
|
+
|
|
1159
|
+
this$1._focusElement(focusState.focusedPoint);
|
|
1160
|
+
e.preventDefault();
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
switch (e.key) {
|
|
1164
|
+
case ARROW_RIGHT:
|
|
1165
|
+
moveFocus(plotArea.getPointToTheRight(focusState.focusedPoint));
|
|
1166
|
+
break;
|
|
1167
|
+
case ARROW_LEFT:
|
|
1168
|
+
moveFocus(plotArea.getPointToTheLeft(focusState.focusedPoint));
|
|
1169
|
+
break;
|
|
1170
|
+
case ARROW_DOWN:
|
|
1171
|
+
moveFocus(plotArea.getPointBelow(focusState.focusedPoint));
|
|
1172
|
+
break;
|
|
1173
|
+
case ARROW_UP:
|
|
1174
|
+
moveFocus(plotArea.getPointAbove(focusState.focusedPoint));
|
|
1175
|
+
break;
|
|
1176
|
+
default:
|
|
1177
|
+
break;
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
Chart.prototype._navigateLegend = function _navigateLegend (e) {
|
|
1182
|
+
var this$1 = this;
|
|
1183
|
+
|
|
1184
|
+
var ref = this;
|
|
1185
|
+
var focusState = ref._focusState;
|
|
1186
|
+
var legend = ref._legend;
|
|
1187
|
+
|
|
1188
|
+
focusState.legendInFocus = true;
|
|
1189
|
+
|
|
1190
|
+
if (!focusState.focusedElement) {
|
|
1191
|
+
this._focusFirstLegendItem();
|
|
1192
|
+
e.preventDefault();
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
var itemsLength = legend.getItems().length;
|
|
1197
|
+
var moveFocus = function () {
|
|
1198
|
+
this$1._focusElement(this$1._getFocusedLegendItem());
|
|
1199
|
+
e.preventDefault();
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
switch (e.key) {
|
|
1203
|
+
case ARROW_UP:
|
|
1204
|
+
case ARROW_LEFT:
|
|
1205
|
+
focusState.focusedLegendItemIndex = cycleDown(
|
|
1206
|
+
focusState.focusedLegendItemIndex,
|
|
1207
|
+
itemsLength
|
|
1208
|
+
);
|
|
1209
|
+
moveFocus();
|
|
1210
|
+
break;
|
|
1211
|
+
case ARROW_DOWN:
|
|
1212
|
+
case ARROW_RIGHT:
|
|
1213
|
+
focusState.focusedLegendItemIndex = cycleUp(
|
|
1214
|
+
focusState.focusedLegendItemIndex,
|
|
1215
|
+
itemsLength
|
|
1216
|
+
);
|
|
1217
|
+
moveFocus();
|
|
1218
|
+
break;
|
|
1219
|
+
default:
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
Chart.prototype._focusFirstPoint = function _focusFirstPoint () {
|
|
1225
|
+
var point = this._focusState.focusedPoint = this._plotArea.getFirstPoint();
|
|
1226
|
+
|
|
1227
|
+
if (point) {
|
|
1228
|
+
this._focusElement(point);
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
Chart.prototype._focusChart = function _focusChart () {
|
|
1233
|
+
if (document.activeElement !== this.element) {
|
|
1234
|
+
this._preventInitialPointFocus = true;
|
|
1235
|
+
this.element.focus();
|
|
1236
|
+
this._preventInitialPointFocus = false;
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
Chart.prototype._focusPoint = function _focusPoint (point) {
|
|
1241
|
+
this._focusState.focusedPoint = point;
|
|
1242
|
+
|
|
1243
|
+
this._focusChart();
|
|
1244
|
+
|
|
1245
|
+
this._focusElement(point, true);
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
Chart.prototype._focusFirstLegendItem = function _focusFirstLegendItem () {
|
|
1249
|
+
var ref = this;
|
|
1250
|
+
var focusState = ref._focusState;
|
|
1251
|
+
|
|
1252
|
+
focusState.focusedLegendItemIndex = 0;
|
|
1253
|
+
this._focusElement(this._getFocusedLegendItem());
|
|
1254
|
+
focusState.legendInFocus = true;
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
Chart.prototype._focusLegendItem = function _focusLegendItem (args) {
|
|
1258
|
+
var ref = this;
|
|
1259
|
+
var focusState = ref._focusState;
|
|
1260
|
+
|
|
1261
|
+
focusState.focusedLegendItemIndex = args.seriesIndex;
|
|
1262
|
+
focusState.legendInFocus = true;
|
|
1263
|
+
|
|
1264
|
+
this._focusChart();
|
|
1265
|
+
|
|
1266
|
+
this._focusElement(this._getFocusedLegendItem(), true);
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1269
|
+
Chart.prototype._getFocusedLegendItem = function _getFocusedLegendItem () {
|
|
1270
|
+
var ref = this;
|
|
1271
|
+
var focusState = ref._focusState;
|
|
1272
|
+
var legend = ref._legend;
|
|
1273
|
+
|
|
1274
|
+
return legend.getItems()[focusState.focusedLegendItemIndex];
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
Chart.prototype._focusElement = function _focusElement (element, omitHighlight) {
|
|
1278
|
+
var ref = this;
|
|
1279
|
+
var focusState = ref._focusState;
|
|
1280
|
+
|
|
1281
|
+
this._clearFocusedElement();
|
|
1282
|
+
|
|
1283
|
+
focusState.focusedElement = element;
|
|
1284
|
+
|
|
1285
|
+
if (!omitHighlight) {
|
|
1286
|
+
element.focusVisual();
|
|
1287
|
+
|
|
1288
|
+
this._setElementActiveDescendant(element._id);
|
|
1289
|
+
|
|
1290
|
+
if (focusState.legendInFocus) {
|
|
1291
|
+
this._showSeriesInactiveOpacity(focusState.focusedLegendItemIndex);
|
|
1292
|
+
} else {
|
|
1293
|
+
this._showInactiveOpacity(element);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
Chart.prototype._clearFocusedElement = function _clearFocusedElement () {
|
|
1299
|
+
var ref = this;
|
|
1300
|
+
var focusState = ref._focusState;
|
|
1301
|
+
|
|
1302
|
+
if (!focusState) {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
if (focusState.focusedElement) {
|
|
1307
|
+
focusState.focusedElement.clearFocusFromVisual();
|
|
1308
|
+
this._setElementActiveDescendant(null);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
focusState.focusedElement = null;
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
Chart.prototype._setElementActiveDescendant = function _setElementActiveDescendant (id) {
|
|
1315
|
+
if (id) {
|
|
1316
|
+
this.element.setAttribute(ARIA_ACTIVE_DESCENDANT, id);
|
|
1317
|
+
} else {
|
|
1318
|
+
this.element.removeAttribute(ARIA_ACTIVE_DESCENDANT);
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
|
|
1322
|
+
Chart.prototype._blur = function _blur () {
|
|
1323
|
+
this._focusState.legendInFocus = false;
|
|
1324
|
+
this._clearFocusedElement();
|
|
1325
|
+
this._hideInactiveOpacity();
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1072
1328
|
Chart.prototype._startHover = function _startHover (element, e) {
|
|
1073
1329
|
if (this._suppressHover) {
|
|
1074
1330
|
return false;
|
|
@@ -1078,7 +1334,19 @@ var Chart = (function (Class) {
|
|
|
1078
1334
|
return (element.hover || element.over) && !(element instanceof PlotAreaBase);
|
|
1079
1335
|
});
|
|
1080
1336
|
|
|
1081
|
-
this.
|
|
1337
|
+
var activePoint = this._activePoint;
|
|
1338
|
+
|
|
1339
|
+
this._updateHoveredPoint(point, e);
|
|
1340
|
+
|
|
1341
|
+
if (point && activePoint !== point && point.hover) {
|
|
1342
|
+
this._activePoint = point;
|
|
1343
|
+
|
|
1344
|
+
if (!this._sharedTooltip() && !point.hover(this, e)) {
|
|
1345
|
+
this._displayTooltip(point);
|
|
1346
|
+
|
|
1347
|
+
this._showInactiveOpacity(point);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1082
1350
|
|
|
1083
1351
|
return point;
|
|
1084
1352
|
};
|
|
@@ -1249,28 +1517,15 @@ var Chart = (function (Class) {
|
|
|
1249
1517
|
return chartInstance;
|
|
1250
1518
|
};
|
|
1251
1519
|
|
|
1252
|
-
Chart.prototype._showInactiveOpacity = function _showInactiveOpacity (point
|
|
1253
|
-
var activePoint = this._activePoint;
|
|
1520
|
+
Chart.prototype._showInactiveOpacity = function _showInactiveOpacity (point) {
|
|
1254
1521
|
var multipleSeries = this._plotArea.series.length > 1;
|
|
1255
1522
|
var hasInactiveOpacity = this._hasInactiveOpacity();
|
|
1256
1523
|
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
this.
|
|
1261
|
-
|
|
1262
|
-
if (!this._sharedTooltip() && !point.hover(this, e)) {
|
|
1263
|
-
this._displayTooltip(point);
|
|
1264
|
-
|
|
1265
|
-
if (hasInactiveOpacity) {
|
|
1266
|
-
this._displayInactiveOpacity(point, multipleSeries);
|
|
1267
|
-
} else {
|
|
1268
|
-
this._highlight.show(point);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1524
|
+
if (hasInactiveOpacity) {
|
|
1525
|
+
this._displayInactiveOpacity(point, multipleSeries);
|
|
1526
|
+
} else {
|
|
1527
|
+
this._highlight.show(point);
|
|
1271
1528
|
}
|
|
1272
|
-
|
|
1273
|
-
return point;
|
|
1274
1529
|
};
|
|
1275
1530
|
|
|
1276
1531
|
Chart.prototype._hideInactiveOpacity = function _hideInactiveOpacity (point) {
|
|
@@ -1343,6 +1598,7 @@ var Chart = (function (Class) {
|
|
|
1343
1598
|
} else {
|
|
1344
1599
|
unbindEvents(document, ( obj = {}, obj[ MOUSEMOVE ] = this._mouseMoveTrackHandler, obj ));
|
|
1345
1600
|
this._unsetActivePoint();
|
|
1601
|
+
this._clearFocusedElement();
|
|
1346
1602
|
this._mouseMoveTrackHandler = null;
|
|
1347
1603
|
|
|
1348
1604
|
this._hideInactiveOpacity(point);
|
|
@@ -1577,6 +1833,10 @@ var Chart = (function (Class) {
|
|
|
1577
1833
|
};
|
|
1578
1834
|
|
|
1579
1835
|
Chart.prototype._legendItemHover = function _legendItemHover (seriesIndex, pointIndex) {
|
|
1836
|
+
this._showSeriesInactiveOpacity(seriesIndex, pointIndex);
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
Chart.prototype._showSeriesInactiveOpacity = function _showSeriesInactiveOpacity (seriesIndex, pointIndex) {
|
|
1580
1840
|
var ref = this;
|
|
1581
1841
|
var plotArea = ref._plotArea;
|
|
1582
1842
|
var highlight = ref._highlight;
|
|
@@ -1656,7 +1916,7 @@ var Chart = (function (Class) {
|
|
|
1656
1916
|
|
|
1657
1917
|
this._destroyed = true;
|
|
1658
1918
|
|
|
1659
|
-
unbindEvents(this.element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSEMOVE ] = this._mousemove, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj ));
|
|
1919
|
+
unbindEvents(this.element, ( obj = {}, obj[ CONTEXTMENU ] = this._clickHandler, obj[ MOUSEWHEEL ] = this._mousewheelHandler, obj[ MOUSEMOVE ] = this._mousemove, obj[ MOUSELEAVE ] = this._mouseleaveHandler, obj[ KEYDOWN ] = this._keydownHandler, obj[ FOCUS ] = this._focusHandler, obj[ BLUR] = this._blurHandler, obj ));
|
|
1660
1920
|
|
|
1661
1921
|
if (this.domEvents) {
|
|
1662
1922
|
this.domEvents.destroy();
|
|
@@ -1667,6 +1927,8 @@ var Chart = (function (Class) {
|
|
|
1667
1927
|
unbindEvents(document, ( obj$1 = {}, obj$1[ MOUSEMOVE ] = this._mouseMoveTrackHandler, obj$1 ));
|
|
1668
1928
|
}
|
|
1669
1929
|
|
|
1930
|
+
this._focusState = null;
|
|
1931
|
+
|
|
1670
1932
|
this._destroyView();
|
|
1671
1933
|
|
|
1672
1934
|
this._destroySurface();
|
|
@@ -1704,6 +1966,7 @@ var Chart = (function (Class) {
|
|
|
1704
1966
|
}
|
|
1705
1967
|
|
|
1706
1968
|
this._unsetActivePoint();
|
|
1969
|
+
this._clearFocusedElement();
|
|
1707
1970
|
this._resetDrilldownPoint();
|
|
1708
1971
|
this._destroySelections();
|
|
1709
1972
|
|
|
@@ -1940,7 +2203,16 @@ setDefaultOptions(Chart, {
|
|
|
1940
2203
|
chartArea: {},
|
|
1941
2204
|
legend: {
|
|
1942
2205
|
visible: true,
|
|
1943
|
-
labels: {}
|
|
2206
|
+
labels: {},
|
|
2207
|
+
accessibility: {
|
|
2208
|
+
highlight: {
|
|
2209
|
+
border: {
|
|
2210
|
+
opacity: 1,
|
|
2211
|
+
color: BLACK,
|
|
2212
|
+
width: 2
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
1944
2216
|
},
|
|
1945
2217
|
categoryAxis: {},
|
|
1946
2218
|
seriesDefaults: {
|
|
@@ -1952,6 +2224,15 @@ setDefaultOptions(Chart, {
|
|
|
1952
2224
|
labels: {},
|
|
1953
2225
|
negativeValues: {
|
|
1954
2226
|
visible: false
|
|
2227
|
+
},
|
|
2228
|
+
accessibility: {
|
|
2229
|
+
highlight: {
|
|
2230
|
+
border: {
|
|
2231
|
+
opacity: 1,
|
|
2232
|
+
width: 2
|
|
2233
|
+
},
|
|
2234
|
+
zIndex: 200
|
|
2235
|
+
}
|
|
1955
2236
|
}
|
|
1956
2237
|
},
|
|
1957
2238
|
series: [],
|
|
@@ -92,6 +92,14 @@ var SHOW_TOOLTIP = "showTooltip";
|
|
|
92
92
|
var HIDE_TOOLTIP = "hideTooltip";
|
|
93
93
|
var PANE_RENDER = "paneRender";
|
|
94
94
|
|
|
95
|
+
|
|
96
|
+
var CHART_POINT_ROLE = "graphics-symbol";
|
|
97
|
+
var CHART_POINT_CLASSNAME = "k-chart-point";
|
|
98
|
+
var CHART_POINT_ROLE_DESCRIPTION = "Point";
|
|
99
|
+
var LEGEND_ITEM_ROLE = "checkbox";
|
|
100
|
+
var LEGEND_ITEM_CLASSNAME = "k-chart-legend-item";
|
|
101
|
+
var LEGEND_ITEM_ARIA_ROLE_DESCRIPTION = "Legend item";
|
|
102
|
+
|
|
95
103
|
var LOGARITHMIC = "log";
|
|
96
104
|
var CATEGORY = "category";
|
|
97
105
|
|
|
@@ -134,5 +142,8 @@ export {
|
|
|
134
142
|
HEATMAP,
|
|
135
143
|
DRILLDOWN, DRILLDOWN_FIELD,
|
|
136
144
|
MIN_MOVING_AVERAGE_PERIOD,
|
|
137
|
-
TRENDLINE_SERIES, TRENDLINE_LINEAR, TRENDLINE_MOVING_AVERAGE
|
|
145
|
+
TRENDLINE_SERIES, TRENDLINE_LINEAR, TRENDLINE_MOVING_AVERAGE,
|
|
146
|
+
CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION,
|
|
147
|
+
LEGEND_ITEM_ROLE, LEGEND_ITEM_CLASSNAME,
|
|
148
|
+
LEGEND_ITEM_ARIA_ROLE_DESCRIPTION
|
|
138
149
|
};
|
|
@@ -26,16 +26,17 @@ var FunnelChart = (function (ChartElement) {
|
|
|
26
26
|
FunnelChart.prototype.constructor = FunnelChart;
|
|
27
27
|
|
|
28
28
|
FunnelChart.prototype.formatPointValue = function formatPointValue (point, format) {
|
|
29
|
-
return this.chartService.format.auto(format,point.value);
|
|
29
|
+
return this.plotArea.chartService.format.auto(format,point.value);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
FunnelChart.prototype.render = function render () {
|
|
33
33
|
var this$1 = this;
|
|
34
34
|
|
|
35
|
+
var seriesIx = 0;
|
|
35
36
|
var ref = this;
|
|
36
37
|
var options = ref.options;
|
|
37
38
|
var seriesColors = ref.plotArea.options.seriesColors; if ( seriesColors === void 0 ) seriesColors = [];
|
|
38
|
-
var series = options.series[
|
|
39
|
+
var series = options.series[seriesIx];
|
|
39
40
|
var data = series.data;
|
|
40
41
|
|
|
41
42
|
if (!data) {
|
|
@@ -63,6 +64,7 @@ var FunnelChart = (function (ChartElement) {
|
|
|
63
64
|
index: i,
|
|
64
65
|
owner: this$1,
|
|
65
66
|
series: series,
|
|
67
|
+
seriesIx: seriesIx,
|
|
66
68
|
dataItem: data[i],
|
|
67
69
|
percentage: pointData.value / total
|
|
68
70
|
}, fields, { visible: pointData.visible });
|
|
@@ -85,7 +87,7 @@ var FunnelChart = (function (ChartElement) {
|
|
|
85
87
|
series: series,
|
|
86
88
|
dataItem: fields.dataItem,
|
|
87
89
|
index: fields.index
|
|
88
|
-
}, { defaults: series._defaults, excluded: [ "data", "content", "template", "toggle", "visual" ] });
|
|
90
|
+
}, { defaults: series._defaults, excluded: [ "data", "content", "template", "toggle", "visual", "ariaTemplate" ] });
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
FunnelChart.prototype.createSegment = function createSegment (value, fields) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { drawing as draw } from '@progress/kendo-drawing';
|
|
1
|
+
import { drawing as draw, geometry as geom } from '@progress/kendo-drawing';
|
|
2
2
|
|
|
3
3
|
import { ChartElement, Box, Point } from '../../core';
|
|
4
4
|
import PointEventsMixin from '../mixins/point-events-mixin';
|
|
5
5
|
|
|
6
6
|
import { WHITE } from '../../common/constants';
|
|
7
|
-
import { deepExtend, setDefaultOptions } from '../../common';
|
|
7
|
+
import { deepExtend, setDefaultOptions, getTemplate } from '../../common';
|
|
8
|
+
import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
|
|
9
|
+
import { CHART_POINT_CLASSNAME, CHART_POINT_ROLE, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
|
|
8
10
|
|
|
9
11
|
var FunnelSegment = (function (ChartElement) {
|
|
10
12
|
function FunnelSegment(value, options, segmentOptions) {
|
|
@@ -18,11 +20,25 @@ var FunnelSegment = (function (ChartElement) {
|
|
|
18
20
|
FunnelSegment.prototype = Object.create( ChartElement && ChartElement.prototype );
|
|
19
21
|
FunnelSegment.prototype.constructor = FunnelSegment;
|
|
20
22
|
|
|
23
|
+
FunnelSegment.prototype.getLabelText = function getLabelText (options) {
|
|
24
|
+
var labelTemplate = getTemplate(options);
|
|
25
|
+
|
|
26
|
+
if (labelTemplate) {
|
|
27
|
+
return labelTemplate(this.pointData());
|
|
28
|
+
} else if (options.format) {
|
|
29
|
+
return this.formatValue(options.format);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return this.value;
|
|
33
|
+
};
|
|
34
|
+
|
|
21
35
|
FunnelSegment.prototype.reflow = function reflow (chartBox) {
|
|
22
36
|
var points = this.points;
|
|
23
37
|
var label = this.children[0];
|
|
38
|
+
var x1 = Math.min(points[0].x, points[3].x);
|
|
39
|
+
var x2 = Math.max(points[1].x, points[2].x);
|
|
24
40
|
|
|
25
|
-
this.box = new Box(
|
|
41
|
+
this.box = new Box(x1, points[0].y, x2, points[2].y);
|
|
26
42
|
|
|
27
43
|
if (label) {
|
|
28
44
|
label.reflow(new Box(chartBox.x1, points[0].y, chartBox.x2, points[2].y));
|
|
@@ -37,6 +53,8 @@ var FunnelSegment = (function (ChartElement) {
|
|
|
37
53
|
|
|
38
54
|
ChartElement.prototype.createVisual.call(this);
|
|
39
55
|
|
|
56
|
+
this.addAccessibilityAttributesToVisual();
|
|
57
|
+
|
|
40
58
|
if (options.visual) {
|
|
41
59
|
visual = options.visual({
|
|
42
60
|
category: this.category,
|
|
@@ -93,6 +111,24 @@ var FunnelSegment = (function (ChartElement) {
|
|
|
93
111
|
};
|
|
94
112
|
};
|
|
95
113
|
|
|
114
|
+
FunnelSegment.prototype.createFocusHighlight = function createFocusHighlight (style) {
|
|
115
|
+
var borderWidth = this.options.accessibility.highlight.border.width;
|
|
116
|
+
var result = draw.Path.fromPoints(this.points, deepExtend({}, style, {
|
|
117
|
+
stroke: {
|
|
118
|
+
width: borderWidth * 2
|
|
119
|
+
}
|
|
120
|
+
})).close();
|
|
121
|
+
|
|
122
|
+
var clipPath = new draw.MultiPath();
|
|
123
|
+
|
|
124
|
+
clipPath.paths.push(draw.Path.fromRect(this.box.clone().pad(borderWidth).toRect()));
|
|
125
|
+
clipPath.paths.push(draw.Path.fromPoints(this.points));
|
|
126
|
+
|
|
127
|
+
result.clip(clipPath);
|
|
128
|
+
|
|
129
|
+
return result;
|
|
130
|
+
};
|
|
131
|
+
|
|
96
132
|
FunnelSegment.prototype.tooltipAnchor = function tooltipAnchor () {
|
|
97
133
|
var box = this.box;
|
|
98
134
|
return {
|
|
@@ -109,6 +145,20 @@ var FunnelSegment = (function (ChartElement) {
|
|
|
109
145
|
return point.owner.formatPointValue(point, format);
|
|
110
146
|
};
|
|
111
147
|
|
|
148
|
+
FunnelSegment.prototype.pointData = function pointData () {
|
|
149
|
+
return {
|
|
150
|
+
dataItem: this.dataItem,
|
|
151
|
+
category: this.category,
|
|
152
|
+
value: this.value,
|
|
153
|
+
series: this.series,
|
|
154
|
+
percentage: this.percentage
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
FunnelSegment.prototype.getIndex = function getIndex () {
|
|
159
|
+
return this.index;
|
|
160
|
+
};
|
|
161
|
+
|
|
112
162
|
return FunnelSegment;
|
|
113
163
|
}(ChartElement));
|
|
114
164
|
|
|
@@ -116,9 +166,18 @@ setDefaultOptions(FunnelSegment, {
|
|
|
116
166
|
color: WHITE,
|
|
117
167
|
border: {
|
|
118
168
|
width: 1
|
|
169
|
+
},
|
|
170
|
+
labels: {
|
|
171
|
+
format: ""
|
|
172
|
+
},
|
|
173
|
+
accessibility: {
|
|
174
|
+
role: CHART_POINT_ROLE,
|
|
175
|
+
className: CHART_POINT_CLASSNAME,
|
|
176
|
+
ariaRoleDescription: CHART_POINT_ROLE_DESCRIPTION
|
|
119
177
|
}
|
|
120
178
|
});
|
|
121
179
|
|
|
122
180
|
deepExtend(FunnelSegment.prototype, PointEventsMixin);
|
|
181
|
+
deepExtend(FunnelSegment.prototype, AccessibilityAttributesMixin);
|
|
123
182
|
|
|
124
183
|
export default FunnelSegment;
|
|
@@ -71,7 +71,8 @@ var HeatmapChart = (function (ChartElement) {
|
|
|
71
71
|
defaults: series._defaults,
|
|
72
72
|
excluded: [
|
|
73
73
|
"data", "tooltip", "content", "template",
|
|
74
|
-
"visual", "toggle", "drilldownSeriesFactory"
|
|
74
|
+
"visual", "toggle", "drilldownSeriesFactory",
|
|
75
|
+
"ariaTemplate"
|
|
75
76
|
]
|
|
76
77
|
};
|
|
77
78
|
|