/* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add("charts-base",function(e,t){function f(){}function l(t){return t.type!=="pie"?new e.CartesianChart(t):new e.PieChart(t)}var n=e.config,r=n.win,i=n.doc,s=e.Lang,o=s.isString,u=e.ClassNameManager.getClassName,a=u("seriesmarker");e.Gridlines=e.Base.create("gridlines",e.Base,[e.Renderer],{_path:null,remove:function(){var e=this._path;e&&e.destroy()},draw:function(){this.get("axis")&&this.get("graph")&&this._drawGridlines()},_drawGridlines:function(){var t,n=this.get("axis"),r=n.get("position"),i,s=0,o,u=this.get("direction"),a=this.get("graph"),f=a.get("width"),l=a.get("height"),c=this.get("styles").line,h=c.color,p=c.weight,d=c.alpha,v=this.get("count"),m,g;if(isFinite(f)&&isFinite(l)&&f>0&&l>0){v&&e.Lang.isNumber(v)?i=this._getPoints(v,f,l):r!=="none"&&n&&n.get("tickPoints")?i=n.get("tickPoints"):i=this._getPoints(n.get("styles").majorUnit.count,f,l),o=i.length,t=a.get("gridlines"),t.set("width",f),t.set("height",l),t.set("stroke",{weight:p,color:h,opacity:d}),u==="vertical"?(g=this._verticalLine,m=l):(g=this._horizontalLine,m=f);for(s=0;se&&(n=t[e]),n},getSeriesByKey:function(e){var t=this._seriesDictionary,n;return t&&t.hasOwnProperty(e)&&(n=t[e]),n},addDispatcher:function(e){this._dispatchers||(this._dispatchers=[]),this._dispatchers.push(e)},_seriesCollection:null,_seriesDictionary:null,_parseSeriesCollection:function(t){if(!t)return;var n=t.length,r=0,i,s;this._seriesCollection=[],this._seriesDictionary={},this.seriesTypes=[];for(;r-1&&this._dispatchers.splice(i,1),this._dispatchers.length<1&&(r=this.get("graphic"),r.get("autoDraw")||r._redraw(),this.fire("chartRendered"))},_getDefaultStyles:function(){var e={background:{shape:"rect",fill:{color:"#faf9f2"},border:{color:"#dad8c9",weight:1}}};return e},destructor:function(){this._graphic&&(this._graphic.destroy(),this._graphic=null),this._background&&(this._background.get("graphic").destroy(),this._background=null),this._gridlines&&(this._gridlines.get("graphic").destroy(),this._gridlines=null)}},{ATTRS:{x:{setter:function(e){return this.get("boundingBox").setStyle("left",e+"px"),e}},y:{setter:function(e){return this.get("boundingBox").setStyle("top",e+"px"),e}},chart:{getter:function(){var e=this._state.chart||this;return e}},seriesCollection:{getter:function(){return this._seriesCollection},setter:function(e){return this._parseSeriesCollection(e),this._seriesCollection}},showBackground:{value:!0},seriesDictionary:{readOnly:!0,getter:function(){return this._seriesDictionary}},horizontalGridlines:{value:null,setter:function(t){var n,r,i=this.get("horizontalGridlines");i&&i instanceof e.Gridlines&&i.remove();if(t instanceof e.Gridlines)return i=t,t.set("graph",this),t;if(t){n={direction:"horizonal",graph:this};for(r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return i=new e.Gridlines(n),i}}},verticalGridlines:{value:null,setter:function(t){var n,r,i=this.get("verticalGridlines");i&&i instanceof e.Gridlines&&i.remove();if(t instanceof e.Gridlines)return i=t,t.set("graph",this),t;if(t){n={direction:"vertical",graph:this};for(r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return i=new e.Gridlines(n),i}}},background:{getter:function(){return this._background||(this._backgroundGraphic=new e.Graphic({render:this.get("contentBox")}),this._backgroundGraphic.get("node").style.zIndex=0,this._background=this._backgroundGraphic.addShape({type:"rect"})),this._background}},gridlines:{readOnly:!0,getter:function(){return this._gridlines||(this._gridlinesGraphic=new e.Graphic({render:this.get("contentBox")}),this._gridlinesGraphic.get("node").style.zIndex=1,this._gridlines=this._gridlinesGraphic.addShape({type:"path"})),this._gridlines}},graphic:{readOnly:!0,getter:function(){return this._graphic||(this._graphic=new e.Graphic({render:this.get("contentBox")}),this._graphic.get("node").style.zIndex=2,this._graphic.set("autoDraw",!1)),this._graphic}},groupMarkers:{value:!1}}}),f.ATTRS={dataProvider:{lazyAdd:!1,valueFn:function(){var e=[];return this._wereSeriesKeysExplicitlySet()||this.set("seriesKeys",this._buildSeriesKeys(e),{src:"internal"}),e},setter:function(e){var t=this._setDataValues(e);return this._wereSeriesKeysExplicitlySet()||this.set("seriesKeys",this._buildSeriesKeys(t),{src:"internal"}),t}},seriesKeys:{lazyAdd:!1,setter:function(e){var t=arguments[2];return!e||t&&t.src&&t.src==="internal"?this._seriesKeysExplicitlySet=!1:this._seriesKeysExplicitlySet=!0,e}},ariaLabel:{value:"Chart Application",setter:function(e){var t=this.get("contentBox");return t&&t.setAttribute("aria-label",e),e}},ariaDescription:{value:"Use the up and down keys to navigate between series. Use the left and right keys to navigate through items in a series.",setter:function(e){return this._description&&this._description.set("text",e),e}},tooltip:{valueFn:"_getTooltip",setter:function(e){return this._updateTooltip(e)}},categoryKey:{value:"category"},categoryType:{value:"category"},interactionType:{value:"marker"},axesCollection:{},graph:{valueFn:"_getGraph"},groupMarkers:{value:!1}},f.prototype={_wereSeriesKeysExplicitlySet:function(){var e=this.get("seriesKeys");return e&&this._seriesKeysExplicitlySet},_groupMarkersChangeHandler:function(e){var t=this.get("graph"),n=e.newVal;t&&t.set("groupMarkers",n)},_itemRendered:function(t){this._itemRenderQueue=this._itemRenderQueue.splice(1+e.Array.indexOf(this._itemRenderQueue,t.currentTarget),1),this._itemRenderQueue.length<1&&this._redraw()},_getGraph:function(){var t=new e.Graph({chart:this,groupMarkers:this.get("groupMarkers")});return t.after("chartRendered",e.bind(function(){this.fire("chartRendered")},this)),t},getSeries:function(e){var t=null,n=this.get("graph");return n&&(s.isNumber(e)?t=n.getSeriesByIndex(e):t=n.getSeriesByKey(e)),t},getAxisByKey:function(e){var t,n=this.get("axes");return n&&n.hasOwnProperty(e)&&(t=n[e]),t},getCategoryAxis:function(){var e,t=this.get("categoryKey"),n=this.get("axes");return n.hasOwnProperty(t)&&(e=n[t]),e},_direction:"horizontal",_dataProvider:null,_setDataValues:function(e){if(s.isArray(e[0])){var t,n=[],r=e[0],i=0,o=r.length,u,a=e.length;for(;i"),n=e.UA. ie,r=n&&n<8?"rect(1px 1px 1px 1px)":"rect(1px, 1px, 1px, 1px)";return t.setStyle("position","absolute"),t.setStyle("height","1px"),t.setStyle("width","1px"),t.setStyle("overflow","hidden"),t.setStyle("clip",r),t},syncUI:function(){this._redraw()},bindUI:function(){this.after("tooltipChange",e.bind(this._tooltipChangeHandler,this)),this.after("widthChange",this._sizeChanged),this.after("heightChange",this._sizeChanged),this.after("groupMarkersChange",this._groupMarkersChangeHandler);var t=this.get("tooltip"),n="mouseout",i="mouseover",o=this.get("contentBox"),u=this.get("interactionType"),f=0,l,c="."+a,h=r&&"ontouchstart"in r&&!(e.UA.chrome&&e.UA.chrome<6);e.on("keydown",e.bind(function(e){var t=e.keyCode,n=parseFloat(t),r;n>36&&n<41&&(e.halt(),r=this._getAriaMessage(n),this._liveRegion.set("text",r))},this),this.get("contentBox")),u==="marker"?(n=t.hideEvent,i=t.showEvent,h?(e.delegate("touchend",e.bind(this._markerEventDispatcher,this),o,c),e.on("touchend",e.bind(function(e){o.contains(e.target)&&e.halt(!0),this._activeMarker&&(this._activeMarker=null,this.hideTooltip(e))},this))):(e.delegate("mouseenter",e.bind(this._markerEventDispatcher,this),o,c),e.delegate("mousedown",e.bind(this._markerEventDispatcher,this),o,c),e.delegate("mouseup",e.bind(this._markerEventDispatcher,this),o,c),e.delegate("mouseleave",e.bind(this._markerEventDispatcher,this),o,c),e.delegate("click",e.bind(this._markerEventDispatcher,this),o,c),e.delegate("mousemove",e.bind(this._positionTooltip,this),o,c))):u==="planar"&&(h?this._overlay.on("touchend",e.bind(this._planarEventDispatcher,this)):(this._overlay.on("mousemove",e.bind(this._planarEventDispatcher,this)),this.on("mouseout",this.hideTooltip)));if(t){this.on("markerEvent:touchend",e.bind(function(e){var n=e.series.get("markers")[e.index];this._activeMarker&&n===this._activeMarker?(this._activeMarker=null,this.hideTooltip(e)):(this._activeMarker=n,t.markerEventHandler.apply(this,[e]))},this));if(n&&i&&n===i)this.on(u+"Event:"+n,this.toggleTooltip);else{i&&this.on(u+"Event:"+i,t[u+"EventHandler"]);if(n){if(s.isArray(n)){l=n.length;for(;f"),this._overlay.set("id",this.get("id")+"_overlay"),this._overlay.setStyle("position","absolute"),this._overlay.setStyle("background","#fff"),this._overlay.setStyle("opacity",0),this._overlay.addClass(i),this._overlay.setStyle("zIndex",4),n.append(this._overlay)),this._setAriaElements(t,n),this._redraw()},_planarEventDispatcher:function(e){var t=this.get("graph"),n=this.get("boundingBox"),r=t.get("contentBox"),i=e&&e.hasOwnProperty("changedTouches"),s=i?e.changedTouches[0].pageX:e.pageX,o=i?e.changedTouches[0].pageY:e.pageY,u=s-n.getX(),a=o-n.getY(),f={x:s-r.getX(),y:o-r.getY()},l=t.get("seriesCollection"),c,h=0,p,d=this._selectedIndex,v,m=[],g=[],y=[],b=this.get("direction"),w,E,S,x,T,N,C;e.halt(!0),b==="horizontal"?(E="x",S="y"):(S="x",E="y"),x=f[E];if(l){N=l.length;while(h=T[h].start){p=h;break}N=l.length;for(h=0;h-1&&c.updateMarkerState("mouseout",d),C&&C[p]>-1&&(w&&!isNaN(p)&&p>-1&&c.updateMarkerState("mouseover",p),v=this.getSeriesItems(c,p),g.push(v.category),y.push(v.value),m.push(c));this._selectedIndex=p,p>-1?this.fire("planarEvent:mouseover",{categoryItem:g,valueItem:y,x:u,y:a,pageX:s,pageY:o,items:m,index:p,originEvent:e}):this.fire("planarEvent:mouseout")}},_type:"combo",_itemRenderQueue:null,_addToAxesRenderQueue:function(t){this._itemRenderQueue||(this._itemRenderQueue=[]),e.Array.indexOf(this._itemRenderQueue,t)<0&&this._itemRenderQueue.push(t)},_addToAxesCollection:function(e,t){var n=this.get(e+"AxesCollection");n||(n=[],this.set(e+"AxesCollection",n)),n.push(t)},_getDefaultSeriesCollection:function(){var e,t=this.get("dataProvider");return t&&(e=this._parseSeriesCollection()),e},_parseSeriesCollection:function(t){var n=this.get("direction"),r=this.get("styles").series,i=r&&s.isArray(r),o,u,a,f=[],l,c,h=[],p,d=this.get("seriesKeys").concat(),v,m,g,y=this.get("type"),b,w,E,S,x=[],T=this.get("categoryKey"),N=this.get("showMarkers"),C=this.get("showAreaFill"),k=this.get("showLines");t=t?t.concat():[],n==="vertical"?(l="yAxis",w="yKey",c="xAxis",E="xKey"):(l="xAxis",w="xKey",c="yAxis",E="yKey"),g=t.length;while(t&&t.length>0)p=t.shift(),b=this._getBaseAttribute(p,E),b?(m=e.Array.indexOf(d,b),m>-1?(d.splice(m,1),h.push(b),f.push(p)):x.push(p)):x.push(p);while(x.length>0)p=x.shift(),d.length>0?(b=d.shift(),this._setBaseAttribute(p,E,b),h.push(b),f.push(p)):p instanceof e.CartesianSeries&&p.destroy(!0);d.length>0&&(h=h.concat(d)),g=h.length;for(v=0;v0&&f.set("overlapGraph",!1),r[u]=f)}return r},_addAxes:function(){var t=this.get("axes"),n,r,i,s=this.get("width"),o=this.get("height"),u=e.Node.one(this._parentNode);this._axesCollection||(this._axesCollection=[]);for(n in t)t.hasOwnProperty(n)&&(r=t[n],r instanceof e.Axis&&(s||(this.set("width",u.get("offsetWidth")),s=this.get("width")),o||(this.set("height",u.get("offsetHeight")),o=this.get("height")),this._addToAxesRenderQueue(r),i=r.get("position"),this.get(i+"AxesCollection")?this.get(i+"AxesCollection").push(r):this.set(i+"AxesCollection",[r]),this._axesCollection.push(r),r.get("keys").hasOwnProperty(this.get("categoryKey"))&&this.set("categoryAxis",r),r.render(this.get("contentBox"))))},_addSeries:function(){var e=this.get("graph");e.render(this.get("contentBox"))},_addGridlines:function(){var t=this.get("graph"),n=this.get("horizontalGridlines"),r=this.get("verticalGridlines"),i=this.get("direction"),s=this.get("leftAxesCollection"),o=this.get("rightAxesCollection"),u=this.get("bottomAxesCollection"),a=this.get("topAxesCollection"),f,l=this.get("categoryAxis"),c,h;this._axesCollection&&(f=this._axesCollection.concat(),f.splice(e.Array.indexOf(f,l),1)),n&&(s&&s[0]?c=s[0]:o&&o[0]?c=o[0]:c=i==="horizontal"?l:f[0],!this._getBaseAttribute(n,"axis")&&c&&this._setBaseAttribute(n,"axis",c),this._getBaseAttribute(n,"axis")&&t.set("horizontalGridlines",n)),r&&(u&&u[0]?h=u[0]:a&&a[0]?h=a[0]:h=i==="vertical"?l:f[0],!this._getBaseAttribute(r,"axis")&&h&&this._setBaseAttribute(r,"axis",h),this._getBaseAttribute(r,"axis")&&t.set("verticalGridlines",r))},_getDefaultAxes:function(){var e;return this.get("dataProvider")&&(e=this._parseAxes()),e},_parseAxes:function(t){var n=this.get("categoryKey"),r,i,o,u={},a=[],f=[],l=this.get("categoryAxisName")||this.get("categoryKey"),c=this.get("valueAxisName"),h=this.get("seriesKeys").concat(),p,d,v,m,g,y=this.get("direction"),b,w,E=[],S=this.get("stacked")?"stacked":"numeric";y==="vertical"?(b="bottom",w="left"):(b="left",w="bottom");if(t)for(p in t)if(t.hasOwnProperty(p)){r=t[p],o=this._getBaseAttribute(r,"keys"),i=this._getBaseAttribute(r,"type");if(i==="time"||i==="category")l=p,this.set("categoryAxisName",p),s.isArray(o)&&o.length>0&&(n=o[0],this.set("categoryKey",n)),u[p]=r;else if(p===l)u[p]=r;else{u[p]=r;if(p!==c&&o&&s.isArray(o)){m=o.length;for(v=0;v-1&&h.splice(g,1),d=h.length;for(p=0;p-1&&(f=f.concat(a.splice(g,1)));a=f.concat(a),d=a.length;for(p=0;p-1&&h.splice(g,1);return u.hasOwnProperty(l)||(u[l]={}),this._getBaseAttribute(u[l],"keys")||this._setBaseAttribute(u[l],"keys",[n]),this._getBaseAttribute(u[l],"position")||this._setBaseAttribute(u[l],"position",w),this._getBaseAttribute(u[l],"type")||this._setBaseAttribute(u[l],"type",this.get("categoryType")),!u.hasOwnProperty(c)&&h&&h.length>0&&(u[c]={keys:h},E.push(u[c])),a.length>0&&(h.length>0?h=a.concat(h):h=a),u.hasOwnProperty(c)&&(this._getBaseAttribute(u[c],"position")||this._setBaseAttribute(u[c],"position",this._getDefaultAxisPosition(u[c],E,b)),this._setBaseAttribute(u[c],"type",S),this._setBaseAttribute(u[c],"keys",h)),this._wereSeriesKeysExplicitlySet()||this.set("seriesKeys",h,{src:"internal"}),u},_getDefaultAxisPosition:function(t,n,r){var i=this.get("direction"),s=e.Array.indexOf(n,t);return n[s-1]&&n[s-1].position&&(i==="horizontal"?n[s-1].position==="left"?r="right":n[s-1].position==="right"&&(r="left"):n[s-1].position==="bottom"?r="top":r="bottom"),r},getSeriesItems:function(e,t){var n=e.get("xAxis"),r=e.get("yAxis"),i=e.get("xKey"),s=e.get("yKey"),o,u;return this.get("direction")==="vertical"?(o={axis:r,key:s,value:r.getKeyValueAt(s,t)},u={axis:n,key:i,value:n.getKeyValueAt(i,t)}):(u={axis:r,key:s,value:r.getKeyValueAt(s,t)},o={axis:n,key:i,value:n.getKeyValueAt(i,t)}),o.displayName=e.get("categoryDisplayName"),u.displayName=e.get("valueDisplayName"),o.value=o.axis.getKeyValueAt(o.key,t),u.value=u.axis.getKeyValueAt(u.key,t),{category:o,value:u}},_sizeChanged:function(){if(this._axesCollection){var e=this._axesCollection,t=0,n=e.length;for(;t-1;--l)C.unshift(n),n+=o[l].get("width")}if(u){N=[],c=u.length,l=0;for(l=c-1;l>-1;--l)r+=u[l].get("width"),N.unshift(e-r)}if(a){k=[],c=a.length;for(l=c-1;l>-1;--l)k.unshift(i),i+=a[l].get("height")}if(f){L=[],c=f.length;for(l=c-1;l>-1;--l)s+=f[l].get("height"),L.unshift(t-s)}b=e-(n+r),w=t-(s+i),A.left=n,A.top=i,A.bottom=t-s,A.right=e-r;if(!x){v=this._getTopOverflow(o,u),m=this._getBottomOverflow(o,u),g=this._getLeftOverflow(f,a),y=this._getRightOverflow(f,a),T=v-i;if(T>0){A.top=v;if(k){l=0,c=k.length;for(;l0){A.bottom=t-m;if(L){l=0,c=L.length;for(;l0){A.left=g;if(C){l=0,c=C.length;for(;l0){A.right=e-y;if(N){l=0,c=N.length;for(;l1?(e===38?o=o<1?f-1:o-1:e===40&&(o=o>=f-1?0:o+1),this._itemIndex=-1):o=0,this._seriesIndex=o,n=this.getSeries(parseInt(o,10)),t=n.get("valueDisplayName")+" series."):(o>-1?(t="",n=this.getSeries(parseInt(o,10))):(o=0,this._seriesIndex=o,n=this.getSeries(parseInt(o,10)),t=n.get("valueDisplayName")+" series."),l=n._dataLength?n._dataLength:0,e===37?u=u>0?u-1:l-1:e===39&&(u=u>=l-1?0:u+1),this._itemIndex=u,r=this.getSeriesItems(n,u),i=r.category,s=r.value,i&&s&&i.value&&s.value?(t+=i.displayName+": "+i.axis.formatLabel.apply(this,[i.value,i.axis.get("labelFormat")])+", ",t+=s.displayName+": "+s.axis.formatLabel.apply(this,[s.value,s.axis.get("labelFormat")])+", "):t+="No data available.",t+=u+1+" of "+l+". "),t}},{ATTRS:{allowContentOverflow:{value:!1},axesStyles:{lazyAdd:!1,getter:function(){var t=this.get("axes"),n,r=this._axesStyles;if(t)for(n in t)t.hasOwnProperty(n)&&t[n]instanceof e.Axis&&(r||(r={}),r[n]=t[n].get("styles"));return r},setter:function(e){var t=this.get("axes"),n;for(n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&this._setBaseAttribute(t[n],"styles",e[n]);return e}},seriesStyles:{lazyAdd:!1,getter:function(){var e=this._seriesStyles,t=this.get("graph"),n,r;if(t){n=t.get("seriesDictionary");if(n){e={};for(r in n)n.hasOwnProperty(r)&&(e[r]=n[r].get("styles"))}}return e},setter:function(e){var t,n,r;if(s.isArray(e)){r=this.get("seriesCollection"),t=0,n=e.length;for(;t0?u-1:a-1:e===39&&(u=u>=a-1?0:u+1),this._itemIndex=u,r=this.getSeriesItems(i,u),n=r.category,s=r.value,f=i.getTotalValues(),l=Math.round(s.value/f*1e4)/100,n&&s?(t+=n.displayName+": "+n.axis.formatLabel.apply(this,[n.value,n.axis.get("labelFormat")])+", ",t+=s.displayName+": "+s.axis.formatLabel.apply(this,[s.value,s.axis.get("labelFormat")])+", ",t+="Percent of total "+s.displayName+": "+l+"%,"):t+="No data available,",t+=u+1+" of "+a+". ",t},destructor:function(){var t,n,r=this. get("tooltip"),i=r.node,s=this.get("graph"),o=this._axesCollection,u=this.get("seriesCollection");while(u.length>0)t=u.shift(),t.destroy(!0);while(o.length>0)n=o.shift(),n instanceof e.Axis&&n.destroy(!0);this._description&&(this._description.empty(),this._description.remove(!0)),this._liveRegion&&(this._liveRegion.empty(),this._liveRegion.remove(!0)),s&&s.destroy(!0),i&&(i.empty(),i.remove(!0))}},{ATTRS:{ariaDescription:{value:"Use the left and right keys to navigate through items.",setter:function(e){return this._description&&this._description.set("text",e),e}},axes:{getter:function(){return this._axes},setter:function(e){this._parseAxes(e)}},seriesCollection:{lazyAdd:!1,getter:function(){return this._getSeriesCollection()},setter:function(e){return this._setSeriesCollection(e)}},type:{value:"pie"}}}),e.Chart=l},"3.17.2",{requires:["dom","event-mouseenter","event-touch","graphics-group","axes","series-pie","series-line","series-marker","series-area","series-spline","series-column","series-bar","series-areaspline","series-combo","series-combospline","series-line-stacked","series-marker-stacked","series-area-stacked","series-spline-stacked","series-column-stacked","series-bar-stacked","series-areaspline-stacked","series-combo-stacked","series-combospline-stacked"]});