You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
24 KiB
JavaScript
57 lines
24 KiB
JavaScript
2 months ago
|
/*
|
||
|
Highcharts JS v6.0.4 (2017-12-15)
|
||
|
Accessibility module
|
||
|
|
||
|
(c) 2010-2017 Highsoft AS
|
||
|
Author: Oystein Moseng
|
||
|
|
||
|
License: www.highcharts.com/license
|
||
|
*/
|
||
|
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(d){function n(a){return a.replace(/&/g,"\x26amp;").replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g,"\x26#x27;").replace(/\//g,"\x26#x2F;")}function p(a){return"string"===typeof a?a.replace(/<\/?[^>]+(>|$)/g,""):a}function q(a){for(var b=a.childNodes.length;b--;)a.appendChild(a.childNodes[b])}var m=d.win.document,k=d.each,r=d.erase,h=d.addEvent,u=d.dateFormat,
|
||
|
v=d.merge,x={position:"absolute",left:"-9999px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},w={"default":["series","data point","data points"],line:["line","data point","data points"],spline:["line","data point","data points"],area:["line","data point","data points"],areaspline:["line","data point","data points"],pie:["pie","slice","slices"],column:["column series","column","columns"],bar:["bar series","bar","bars"],scatter:["scatter series","data point","data points"],boxplot:["boxplot series",
|
||
|
"box","boxes"],arearange:["arearange series","data point","data points"],areasplinerange:["areasplinerange series","data point","data points"],bubble:["bubble series","bubble","bubbles"],columnrange:["columnrange series","column","columns"],errorbar:["errorbar series","errorbar","errorbars"],funnel:["funnel","data point","data points"],pyramid:["pyramid","data point","data points"],waterfall:["waterfall series","column","columns"],map:["map","area","areas"],mapline:["line","data point","data points"],
|
||
|
mappoint:["point series","data point","data points"],mapbubble:["bubble series","bubble","bubbles"]},y={boxplot:" Box plot charts are typically used to display groups of statistical data. Each data point in the chart can have up to 5 values: minimum, lower quartile, median, upper quartile and maximum. ",arearange:" Arearange charts are line charts displaying a range between a lower and higher value for each point. ",areasplinerange:" These charts are line charts displaying a range between a lower and higher value for each point. ",
|
||
|
bubble:" Bubble charts are scatter charts where each data point also has a size value. ",columnrange:" Columnrange charts are column charts displaying a range between a lower and higher value for each point. ",errorbar:" Errorbar series are used to display the variability of the data. ",funnel:" Funnel charts are used to display reduction of data in stages. ",pyramid:" Pyramid charts consist of a single pyramid with item heights corresponding to each point value. ",waterfall:" A waterfall chart is a column chart where each column contributes towards a total end value. "};
|
||
|
d.Series.prototype.commonKeys="name id category x value y".split(" ");d.Series.prototype.specialKeys="z open high q3 median q1 low close".split(" ");d.seriesTypes.pie&&(d.seriesTypes.pie.prototype.specialKeys=[]);d.setOptions({accessibility:{enabled:!0,pointDescriptionThreshold:!1}});d.wrap(d.Series.prototype,"render",function(a){a.apply(this,Array.prototype.slice.call(arguments,1));this.chart.options.accessibility.enabled&&this.setA11yDescription()});d.Series.prototype.setA11yDescription=function(){var a=
|
||
|
this.chart.options.accessibility,b=this.points&&this.points.length&&this.points[0].graphic&&this.points[0].graphic.element,c=b&&b.parentNode||this.graph&&this.graph.element||this.group&&this.group.element;c&&(c.lastChild===b&&q(c),this.points&&(this.points.length<a.pointDescriptionThreshold||!1===a.pointDescriptionThreshold)&&k(this.points,function(b){b.graphic&&(b.graphic.element.setAttribute("role","img"),b.graphic.element.setAttribute("tabindex","-1"),b.graphic.element.setAttribute("aria-label",
|
||
|
p(b.series.options.pointDescriptionFormatter&&b.series.options.pointDescriptionFormatter(b)||a.pointDescriptionFormatter&&a.pointDescriptionFormatter(b)||b.buildPointInfoString())))}),1<this.chart.series.length||a.describeSingleSeries)&&(c.setAttribute("role",this.options.exposeElementToA11y?"img":"region"),c.setAttribute("tabindex","-1"),c.setAttribute("aria-label",p(a.seriesDescriptionFormatter&&a.seriesDescriptionFormatter(this)||this.buildSeriesInfoString())))};d.Series.prototype.buildSeriesInfoString=
|
||
|
function(){var a=w[this.type]||w["default"],b=this.description||this.options.description;return(this.name?this.name+", ":"")+(1===this.chart.types.length?a[0]:"series")+" "+(this.index+1)+" of "+this.chart.series.length+(1===this.chart.types.length?" with ":". "+a[0]+" with ")+(this.points.length+" "+(1===this.points.length?a[1]:a[2]))+(b?". "+b:"")+(1<this.chart.yAxis.length&&this.yAxis?". Y axis, "+this.yAxis.getDescription():"")+(1<this.chart.xAxis.length&&this.xAxis?". X axis, "+this.xAxis.getDescription():
|
||
|
"")};d.Point.prototype.buildPointInfoString=function(){var a=this,b=a.series,c=b.chart.options.accessibility,e="",l=b.xAxis&&b.xAxis.isDatetimeAxis,c=l&&u(c.pointDateFormatter&&c.pointDateFormatter(a)||c.pointDateFormat||d.Tooltip.prototype.getXDateFormat(a,b.chart.options.tooltip,b.xAxis),a.x);d.find(b.specialKeys,function(b){return void 0!==a[b]})?(l&&(e=c),k(b.commonKeys.concat(b.specialKeys),function(b){void 0===a[b]||l&&"x"===b||(e+=(e?". ":"")+b+", "+a[b])})):e=(this.name||c||this.category||
|
||
|
this.id||"x, "+this.x)+", "+(void 0!==this.value?this.value:this.y);return this.index+1+". "+e+"."+(this.description?" "+this.description:"")};d.Axis.prototype.getDescription=function(){return this.userOptions&&this.userOptions.description||this.axisTitle&&this.axisTitle.textStr||this.options.id||this.categories&&"categories"||"values"};d.wrap(d.Series.prototype,"init",function(a){a.apply(this,Array.prototype.slice.call(arguments,1));var b=this.chart;b.options.accessibility.enabled&&(b.types=b.types||
|
||
|
[],0>b.types.indexOf(this.type)&&b.types.push(this.type),h(this,"remove",function(){var a=this,e=!1;k(b.series,function(c){c!==a&&0>b.types.indexOf(a.type)&&(e=!0)});e||r(b.types,a.type)}))});d.Chart.prototype.getTypeDescription=function(){var a=this.types&&this.types[0],b=this.series[0]&&this.series[0].mapTitle;if(a){if("map"===a)return b?"Map of "+b:"Map of unspecified region.";if(1<this.types.length)return"Combination chart.";if(-1<["spline","area","areaspline"].indexOf(a))return"Line chart."}else return"Empty chart.";
|
||
|
return a+" chart."+(y[a]||"")};d.Chart.prototype.getAxesDescription=function(){var a=this.xAxis.length,b=this.yAxis.length,c={},e;if(a)if(c.xAxis="The chart has "+a+(1<a?" X axes":" X axis")+" displaying ",2>a)c.xAxis+=this.xAxis[0].getDescription()+".";else{for(e=0;e<a-1;++e)c.xAxis+=(e?", ":"")+this.xAxis[e].getDescription();c.xAxis+=" and "+this.xAxis[e].getDescription()+"."}if(b)if(c.yAxis="The chart has "+b+(1<b?" Y axes":" Y axis")+" displaying ",2>b)c.yAxis+=this.yAxis[0].getDescription()+
|
||
|
".";else{for(e=0;e<b-1;++e)c.yAxis+=(e?", ":"")+this.yAxis[e].getDescription();c.yAxis+=" and "+this.yAxis[e].getDescription()+"."}return c};d.Chart.prototype.addAccessibleContextMenuAttribs=function(){var a=this.exportDivElements;a&&(k(a,function(b){"DIV"!==b.tagName||b.children&&b.children.length||(b.setAttribute("role","menuitem"),b.setAttribute("tabindex",-1))}),a[0].parentNode.setAttribute("role","menu"),a[0].parentNode.setAttribute("aria-label","Chart export"))};d.Chart.prototype.addScreenReaderRegion=
|
||
|
function(a,b){var c=this,e=c.series,d=c.options,f=d.accessibility,g=c.screenReaderRegion=m.createElement("div"),z=m.createElement("h4"),k=m.createElement("a"),h=m.createElement("h4"),t=c.types||[],t=(1===t.length&&"pie"===t[0]||"map"===t[0])&&{}||c.getAxesDescription(),p=e[0]&&w[e[0].type]||w["default"];g.setAttribute("id",a);g.setAttribute("role","region");g.setAttribute("aria-label","Chart screen reader information.");g.innerHTML=f.screenReaderSectionFormatter&&f.screenReaderSectionFormatter(c)||
|
||
|
"\x3cdiv\x3eUse regions/landmarks to skip ahead to chart"+(1<e.length?" and navigate between data series":"")+".\x3c/div\x3e\x3ch3\x3e"+(d.title.text?n(d.title.text):"Chart")+(d.subtitle&&d.subtitle.text?". "+n(d.subtitle.text):"")+"\x3c/h3\x3e\x3ch4\x3eLong description.\x3c/h4\x3e\x3cdiv\x3e"+(d.chart.description||"No description available.")+"\x3c/div\x3e\x3ch4\x3eStructure.\x3c/h4\x3e\x3cdiv\x3eChart type: "+(d.chart.typeDescription||c.getTypeDescription())+"\x3c/div\x3e"+(1===e.length?"\x3cdiv\x3e"+
|
||
|
p[0]+" with "+e[0].points.length+" "+(1===e[0].points.length?p[1]:p[2])+".\x3c/div\x3e":"")+(t.xAxis?"\x3cdiv\x3e"+t.xAxis+"\x3c/div\x3e":"")+(t.yAxis?"\x3cdiv\x3e"+t.yAxis+"\x3c/div\x3e":"");c.getCSV&&(k.innerHTML="View as data table.",k.href="#"+b,k.setAttribute("tabindex","-1"),k.onclick=f.onTableAnchorClick||function(){c.viewData();m.getElementById(b).focus()},z.appendChild(k),g.appendChild(z));h.innerHTML="Chart graphic.";c.renderTo.insertBefore(h,c.renderTo.firstChild);c.renderTo.insertBefore(g,
|
||
|
c.renderTo.firstChild);v(!0,h.style,x);v(!0,g.style,x)};d.Chart.prototype.callbacks.push(function(a){var b=a.options;if(b.accessibility.enabled){var c=m.createElementNS("http://www.w3.org/2000/svg","title"),e=m.createElementNS("http://www.w3.org/2000/svg","g"),l=a.container.getElementsByTagName("desc")[0],f=a.container.getElementsByTagName("text"),g="highcharts-title-"+a.index,h="highcharts-data-table-"+a.index,q="highcharts-information-region-"+a.index,b=b.title.text||"Chart";c.textContent=n(b);
|
||
|
c.id=g;l.parentNode.insertBefore(c,l);a.renderTo.setAttribute("role","region");a.renderTo.setAttribute("aria-label",p("Interactive chart. "+b+". Use up and down arrows to navigate with most screen readers."));if(a.exportSVGElements&&a.exportSVGElements[0]&&a.exportSVGElements[0].element){var r=a.exportSVGElements[0].element.onclick,c=a.exportSVGElements[0].element.parentNode;a.exportSVGElements[0].element.onclick=function(){r.apply(this,Array.prototype.slice.call(arguments));a.addAccessibleContextMenuAttribs();
|
||
|
a.highlightExportItem(0)};a.exportSVGElements[0].element.setAttribute("role","button");a.exportSVGElements[0].element.setAttribute("aria-label","View export menu");e.appendChild(a.exportSVGElements[0].element);e.setAttribute("role","region");e.setAttribute("aria-label","Chart export menu");c.appendChild(e)}a.rangeSelector&&k(["minInput","maxInput"],function(b,c){a.rangeSelector[b]&&(a.rangeSelector[b].setAttribute("tabindex","-1"),a.rangeSelector[b].setAttribute("role","textbox"),a.rangeSelector[b].setAttribute("aria-label",
|
||
|
"Select "+(c?"end":"start")+" date."))});k(f,function(b){b.setAttribute("aria-hidden","true")});a.addScreenReaderRegion(q,h);d.wrap(a,"getTable",function(b){return b.apply(this,Array.prototype.slice.call(arguments,1)).replace("\x3ctable\x3e",'\x3ctable id\x3d"'+h+'" summary\x3d"Table representation of chart"\x3e')})}})})(n);(function(d){function n(a){return"string"===typeof a?a.replace(/<\/?[^>]+(>|$)/g,""):a}function p(a,b){this.chart=a;this.id=b.id;this.keyCodeMap=b.keyCodeMap;this.validate=b.validate;
|
||
|
this.init=b.init;this.terminate=b.terminate}function q(a){var b;a&&a.onclick&&r.createEvent&&(b=r.createEvent("Events"),b.initEvent("click",!0,!1),a.onclick(b))}function m(a){var b=a.series.chart.options.accessibility;return a.isNull&&b.keyboardNavigation.skipNullPoints||a.series.options.skipKeyboardNavigation||!a.series.visible||!1===a.visible||b.pointDescriptionThreshold&&b.pointDescriptionThreshold<=a.series.points.length}var k=d.win,r=k.document,h=d.each,u=d.addEvent,v=d.fireEvent,x=d.merge,w=
|
||
|
d.pick,y;d.extend(d.SVGElement.prototype,{addFocusBorder:function(a,b){this.focusBorder&&this.removeFocusBorder();var c=this.getBBox();a=w(a,3);this.focusBorder=this.renderer.rect(c.x-a,c.y-a,c.width+2*a,c.height+2*a,b&&b.borderRadius).addClass("highcharts-focus-border").attr({stroke:b&&b.stroke,"stroke-width":b&&b.strokeWidth}).attr({zIndex:99}).add(this.parentGroup)},removeFocusBorder:function(){this.focusBorder&&(this.focusBorder.destroy(),delete this.focusBorder)}});d.Series.prototype.keyboardMoveVertical=
|
||
|
!0;h(["column","pie"],function(a){d.seriesTypes[a]&&(d.seriesTypes[a].prototype.keyboardMoveVertical=!1)});d.setOptions({accessibility:{keyboardNavigation:{enabled:!0,focusBorder:{enabled:!0,hideBrowserFocusOutline:!0,style:{color:"#335cad",lineWidth:2,borderRadius:3},margin:2},skipNullPoints:!0}}});p.prototype={run:function(a){var b=this,c=a.which||a.keyCode,e=!1,d=!1;h(this.keyCodeMap,function(f){-1<f[0].indexOf(c)&&(e=!0,d=!1===f[1].call(b,c,a)?!1:!0)});e||9!==c||(d=this.move(a.shiftKey?-1:1));
|
||
|
return d},move:function(a){var b=this.chart;this.terminate&&this.terminate(a);b.keyboardNavigationModuleIndex+=a;var c=b.keyboardNavigationModules[b.keyboardNavigationModuleIndex];b.focusElement&&b.focusElement.removeFocusBorder();if(c){if(c.validate&&!c.validate())return this.move(a);if(c.init)return c.init(a),!0}b.keyboardNavigationModuleIndex=0;0<a?(this.chart.exiting=!0,this.chart.tabExitAnchor.focus()):this.chart.renderTo.focus();return!1}};d.Axis.prototype.panStep=function(a,b){var c=b||3;b=
|
||
|
this.getExtremes();var e=(b.max-b.min)/c*a,c=b.max+e,e=b.min+e,d=c-e;0>a&&e<b.dataMin?(e=b.dataMin,c=e+d):0<a&&c>b.dataMax&&(c=b.dataMax,e=c-d);this.setExtremes(e,c)};d.Chart.prototype.setFocusToElement=function(a,b){var c=this.options.accessibility.keyboardNavigation.focusBorder;b=b||a;b.element&&b.element.focus&&(b.element.focus(),c.hideBrowserFocusOutline&&b.css({outline:"none"}));c.enabled&&a!==this.focusElement&&(this.focusElement&&this.focusElement.removeFocusBorder(),a.addFocusBorder(c.margin,
|
||
|
{stroke:c.style.color,strokeWidth:c.style.lineWidth,borderRadius:c.style.borderRadius}),this.focusElement=a)};d.Point.prototype.highlight=function(){var a=this.series.chart;if(this.isNull)a.tooltip&&a.tooltip.hide(0);else this.onMouseOver();this.graphic&&a.setFocusToElement(this.graphic);a.highlightedPoint=this;return this};d.Chart.prototype.highlightAdjacentPoint=function(a){var b=this.series,c=this.highlightedPoint,e=c&&c.index||0,d=c&&c.series.points,f=this.series&&this.series[this.series.length-
|
||
|
1],f=f&&f.points&&f.points[f.points.length-1];if(!b[0]||!b[0].points)return!1;if(c){if(d[e]!==c)for(f=0;f<d.length;++f)if(d[f]===c){e=f;break}b=b[c.series.index+(a?1:-1)];e=d[e+(a?1:-1)]||b&&b.points[a?0:b.points.length-1];if(!e)return!1}else e=a?b[0].points[0]:f;return m(e)?(this.highlightedPoint=e,this.highlightAdjacentPoint(a)):e.highlight()};d.Series.prototype.highlightFirstValidPoint=function(){var a=this.chart.highlightedPoint,b=(a&&a.series)===this?a.index:0;if(a=this.points){for(var c=b,e=
|
||
|
a.length;c<e;++c)if(!m(a[c]))return a[c].highlight();for(;0<=b;--b)if(!m(a[b]))return a[b].highlight()}return!1};d.Chart.prototype.highlightAdjacentSeries=function(a){var b,c,e=this.highlightedPoint,d=(b=this.series&&this.series[this.series.length-1])&&b.points&&b.points[b.points.length-1];if(!this.highlightedPoint)return b=a?this.series&&this.series[0]:b,(c=a?b&&b.points&&b.points[0]:d)?c.highlight():!1;b=this.series[e.series.index+(a?-1:1)];if(!b)return!1;var d=Infinity,f,g=b.points.length;if(void 0===
|
||
|
e.plotX||void 0===e.plotY)c=void 0;else{for(;g--;)f=b.points[g],void 0!==f.plotX&&void 0!==f.plotY&&(f=(e.plotX-f.plotX)*(e.plotX-f.plotX)*4+(e.plotY-f.plotY)*(e.plotY-f.plotY)*1,f<d&&(d=f,c=g));c=void 0!==c&&b.points[c]}if(!c)return!1;if(!b.visible)return c.highlight(),a=this.highlightAdjacentSeries(a),a?a:(e.highlight(),!1);c.highlight();return c.series.highlightFirstValidPoint()};d.Chart.prototype.highlightAdjacentPointVertical=function(a){var b=this.highlightedPoint,c=Infinity,e;if(void 0===b.plotX||
|
||
|
void 0===b.plotY)return!1;h(this.series,function(d){h(d.points,function(f){if(void 0!==f.plotY&&void 0!==f.plotX&&f!==b){var g=f.plotY-b.plotY,l=Math.abs(f.plotX-b.plotX),l=Math.abs(g)*Math.abs(g)+l*l*4;d.yAxis.reversed&&(g*=-1);!(0>g&&a||0<g&&!a||5>l||m(f))&&l<c&&(c=l,e=f)}})});return e?e.highlight():!1};d.Chart.prototype.showExportMenu=function(){this.exportSVGElements&&this.exportSVGElements[0]&&(this.exportSVGElements[0].element.onclick(),this.highlightExportItem(0))};d.Chart.prototype.hideExportMenu=
|
||
|
function(){var a=this.exportDivElements;if(a){h(a,function(b){v(b,"mouseleave")});if(a[this.highlightedExportItem]&&a[this.highlightedExportItem].onmouseout)a[this.highlightedExportItem].onmouseout();this.highlightedExportItem=0;y&&this.renderTo.focus()}};d.Chart.prototype.highlightExportItem=function(a){var b=this.exportDivElements&&this.exportDivElements[a],c=this.exportDivElements&&this.exportDivElements[this.highlightedExportItem];if(b&&"DIV"===b.tagName&&(!b.children||!b.children.length)){b.focus&&
|
||
|
y&&b.focus();if(c&&c.onmouseout)c.onmouseout();if(b.onmouseover)b.onmouseover();this.highlightedExportItem=a;return!0}};d.Chart.prototype.highlightLastExportItem=function(){var a;if(this.exportDivElements)for(a=this.exportDivElements.length;a--&&!this.highlightExportItem(a););};d.Chart.prototype.highlightRangeSelectorButton=function(a){var b=this.rangeSelector.buttons;b[this.highlightedRangeSelectorItemIx]&&b[this.highlightedRangeSelectorItemIx].setState(this.oldRangeSelectorItemState||0);this.highlightedRangeSelectorItemIx=
|
||
|
a;return b[a]?(this.setFocusToElement(b[a].box,b[a]),this.oldRangeSelectorItemState=b[a].state,b[a].setState(2),!0):!1};d.Chart.prototype.highlightLegendItem=function(a){var b=this.legend.allItems,c=this.highlightedLegendItemIx;return b[a]?(b[c]&&v(b[c].legendGroup.element,"mouseout"),void 0!==b[a].pageIx&&b[a].pageIx+1!==this.legend.currentPage&&this.legend.scroll(1+b[a].pageIx-this.legend.currentPage),this.highlightedLegendItemIx=a,this.setFocusToElement(b[a].legendItem,b[a].legendGroup),v(b[a].legendGroup.element,
|
||
|
"mouseover"),!0):!1};d.Chart.prototype.addKeyboardNavigationModules=function(){function a(a,e,d){return new p(b,x({keyCodeMap:e},{id:a},d))}var b=this;b.keyboardNavigationModules=[a("entry",[]),a("points",[[[37,39],function(a){a=39===a;return b.highlightAdjacentPoint(a)?!0:this.init(a?1:-1)}],[[38,40],function(a){a=38!==a;var c=b.options.accessibility.keyboardNavigation;if(c.mode&&"serialize"===c.mode)return b.highlightAdjacentPoint(a)?!0:this.init(a?1:-1);b[b.highlightedPoint&&b.highlightedPoint.series.keyboardMoveVertical?
|
||
|
"highlightAdjacentPointVertical":"highlightAdjacentSeries"](a);return!0}],[[13,32],function(){b.highlightedPoint&&b.highlightedPoint.firePointEvent("click")}]],{init:function(a){var c=b.series.length,d=0<a?0:c;if(0<a)for(delete b.highlightedPoint;d<c;){if(a=b.series[d].highlightFirstValidPoint())return a;++d}else for(;d--;)if(b.highlightedPoint=b.series[d].points[b.series[d].points.length-1],a=b.series[d].highlightFirstValidPoint())return a},terminate:function(){b.tooltip&&b.tooltip.hide(0);delete b.highlightedPoint}}),
|
||
|
a("exporting",[[[37,38],function(){for(var a=b.highlightedExportItem||0,e=!0;a--;)if(b.highlightExportItem(a)){e=!1;break}if(e)return b.highlightLastExportItem(),!0}],[[39,40],function(){for(var a=!0,e=(b.highlightedExportItem||0)+1;e<b.exportDivElements.length;++e)if(b.highlightExportItem(e)){a=!1;break}if(a)return b.highlightExportItem(0),!0}],[[13,32],function(){q(b.exportDivElements[b.highlightedExportItem])}]],{validate:function(){return b.exportChart&&!(b.options.exporting&&!1===b.options.exporting.enabled)},
|
||
|
init:function(a){b.highlightedPoint=null;b.showExportMenu();0>a&&b.highlightLastExportItem()},terminate:function(){b.hideExportMenu()}}),a("mapZoom",[[[38,40,37,39],function(a){b[38===a||40===a?"yAxis":"xAxis"][0].panStep(39>a?-1:1)}],[[9],function(a,e){b.mapNavButtons[b.focusedMapNavButtonIx].setState(0);if(e.shiftKey&&!b.focusedMapNavButtonIx||!e.shiftKey&&b.focusedMapNavButtonIx)return b.mapZoom(),this.move(e.shiftKey?-1:1);b.focusedMapNavButtonIx+=e.shiftKey?-1:1;a=b.mapNavButtons[b.focusedMapNavButtonIx];
|
||
|
b.setFocusToElement(a.box,a);a.setState(2)}],[[13,32],function(){q(b.mapNavButtons[b.focusedMapNavButtonIx].element)}]],{validate:function(){return b.mapZoom&&b.mapNavButtons&&2===b.mapNavButtons.length},init:function(a){var c=b.mapNavButtons[0],d=b.mapNavButtons[1],c=0<a?c:d;h(b.mapNavButtons,function(b,a){b.element.setAttribute("tabindex",-1);b.element.setAttribute("role","button");b.element.setAttribute("aria-label","Zoom "+(a?"out ":"")+"chart")});b.setFocusToElement(c.box,c);c.setState(2);b.focusedMapNavButtonIx=
|
||
|
0<a?0:1}}),a("rangeSelector",[[[37,39,38,40],function(a){a=37===a||38===a?-1:1;if(!b.highlightRangeSelectorButton(b.highlightedRangeSelectorItemIx+a))return this.move(a)}],[[13,32],function(){3!==b.oldRangeSelectorItemState&&q(b.rangeSelector.buttons[b.highlightedRangeSelectorItemIx].element)}]],{validate:function(){return b.rangeSelector&&b.rangeSelector.buttons&&b.rangeSelector.buttons.length},init:function(a){h(b.rangeSelector.buttons,function(b){b.element.setAttribute("tabindex","-1");b.element.setAttribute("role",
|
||
|
"button");b.element.setAttribute("aria-label","Select range "+(b.text&&b.text.textStr))});b.highlightRangeSelectorButton(0<a?0:b.rangeSelector.buttons.length-1)}}),a("rangeSelectorInput",[[[9,38,40],function(a,d){a=9===a&&d.shiftKey||38===a?-1:1;d=b.highlightedInputRangeIx+=a;if(1<d||0>d)return this.move(a);b.rangeSelector[d?"maxInput":"minInput"].focus()}]],{validate:function(){return b.rangeSelector&&b.rangeSelector.inputGroup&&"hidden"!==b.rangeSelector.inputGroup.element.getAttribute("visibility")&&
|
||
|
!1!==b.options.rangeSelector.inputEnabled&&b.rangeSelector.minInput&&b.rangeSelector.maxInput},init:function(a){b.highlightedInputRangeIx=0<a?0:1;b.rangeSelector[b.highlightedInputRangeIx?"maxInput":"minInput"].focus()}}),a("legend",[[[37,39,38,40],function(a){a=37===a||38===a?-1:1;b.highlightLegendItem(b.highlightedLegendItemIx+a)||this.init(a)}],[[13,32],function(){q(b.legend.allItems[b.highlightedLegendItemIx].legendItem.element.parentNode)}]],{validate:function(){return b.legend&&b.legend.allItems&&
|
||
|
b.legend.display&&!(b.colorAxis&&b.colorAxis.length)&&!1!==(b.options.legend&&b.options.legend.keyboardNavigation&&b.options.legend.keyboardNavigation.enabled)},init:function(a){h(b.legend.allItems,function(a){a.legendGroup.element.setAttribute("tabindex","-1");a.legendGroup.element.setAttribute("role","button");a.legendGroup.element.setAttribute("aria-label",n("Toggle visibility of series "+a.name))});b.highlightLegendItem(0<a?0:b.legend.allItems.length-1)}})]};d.Chart.prototype.addExitAnchor=function(){var a=
|
||
|
this;a.tabExitAnchor=r.createElement("div");a.tabExitAnchor.setAttribute("tabindex","0");x(!0,a.tabExitAnchor.style,{position:"absolute",left:"-9999px",top:"auto",width:"1px",height:"1px",overflow:"hidden"});a.renderTo.appendChild(a.tabExitAnchor);return u(a.tabExitAnchor,"focus",function(b){b=b||k.event;a.exiting?a.exiting=!1:(a.renderTo.focus(),b.preventDefault(),a.keyboardNavigationModuleIndex=a.keyboardNavigationModules.length-1,b=a.keyboardNavigationModules[a.keyboardNavigationModuleIndex],b.validate&&
|
||
|
!b.validate()?b.move(-1):b.init(-1))})};d.Chart.prototype.resetKeyboardNavigation=function(){var a=this.keyboardNavigationModules[this.keyboardNavigationModuleIndex||0];a&&a.terminate&&a.terminate();this.focusElement&&this.focusElement.removeFocusBorder();this.keyboardNavigationModuleIndex=0;this.keyboardReset=!0};d.wrap(d.Series.prototype,"destroy",function(a){var b=this.chart;b.highlightedPoint&&b.highlightedPoint.series===this&&(delete b.highlightedPoint,b.focusElement&&b.focusElement.removeFocusBorder());
|
||
|
a.apply(this,Array.prototype.slice.call(arguments,1))});d.Chart.prototype.callbacks.push(function(a){var b=a.options.accessibility;b.enabled&&b.keyboardNavigation.enabled&&(y=!!a.renderTo.getElementsByTagName("g")[0].focus,a.addKeyboardNavigationModules(),a.keyboardNavigationModuleIndex=0,a.container.hasAttribute&&!a.container.hasAttribute("tabIndex")&&a.container.setAttribute("tabindex","0"),a.tabExitAnchor||(a.unbindExitAnchorFocus=a.addExitAnchor()),a.unbindKeydownHandler=u(a.renderTo,"keydown",
|
||
|
function(b){b=b||k.event;var c=a.keyboardNavigationModules[a.keyboardNavigationModuleIndex];a.keyboardReset=!1;c&&c.run(b)&&b.preventDefault()}),a.unbindBlurHandler=u(r,"mouseup",function(){a.keyboardReset||a.pointer.chartPosition||a.resetKeyboardNavigation()}),u(a,"destroy",function(){a.resetKeyboardNavigation();a.unbindExitAnchorFocus&&a.tabExitAnchor&&a.unbindExitAnchorFocus();a.unbindKeydownHandler&&a.renderTo&&a.unbindKeydownHandler();a.unbindBlurHandler&&a.unbindBlurHandler()}))})})(n)});
|