diff --git a/adhoc/adhoc_playground.html b/adhoc/adhoc_playground.html new file mode 100644 index 0000000..7078bfb --- /dev/null +++ b/adhoc/adhoc_playground.html @@ -0,0 +1,25 @@ +
+ + + +
\ No newline at end of file diff --git a/dist/dimple.v2.0.2.js b/dist/dimple.v2.0.2.js index e0957d7..1995536 100644 --- a/dist/dimple.v2.0.2.js +++ b/dist/dimple.v2.0.2.js @@ -3991,7 +3991,7 @@ i; for (i = 0; i < array.length; i += 1) { if (isNaN(array[i])) { - total = 0; + total = undefined; break; } else { total += parseFloat(array[i]); @@ -4003,7 +4003,7 @@ var result = 0, sumA = sum(a), sumB = sum(b); - if (!isNaN(sumA) && sumA !== 0 && !isNaN(sumB) && sumB !== 0) { + if (!isNaN(sumA) && !isNaN(sumB)) { result = parseFloat(sumA) - parseFloat(sumB); } else if (!isNaN(Date.parse(a[0])) && !isNaN(Date.parse(b[0]))) { result = Date.parse(a[0]) - Date.parse(b[0]); diff --git a/dist/dimple.v2.0.2.min.js b/dist/dimple.v2.0.2.min.js index ba99e34..5f13af7 100644 --- a/dist/dimple.v2.0.2.min.js +++ b/dist/dimple.v2.0.2.min.js @@ -1,3 +1,3 @@ !function(a,b){"use strict";if("object"==typeof exports)module.exports=b(require("d3"));else if("function"==typeof define&&define.amd)define(["d3"],function(c){return a.dimple=b(c),a.dimple});else if(a.d3)a.dimple=b(a.d3);else{if(!console||!console.warn)throw"dimple requires d3 to run. Are you missing a reference to the d3 library?";console.warn("dimple requires d3 to run. Are you missing a reference to the d3 library?")}}(this,function(a){"use strict";var b={version:"2.0.1",plot:{},aggregateMethod:{}};return b.axis=function(c,d,e,f,g){this.chart=c,this.position=d,this.categoryFields=null===g||void 0===g?e:[].concat(g),this.measure=f,this.timeField=g,this.floatingBarWidth=5,this.hidden=!1,this.showPercent=!1,this.colors=null,this.overrideMin=null,this.overrideMax=null,this.shapes=null,this.showGridlines=null,this.gridlineShapes=null,this.titleShape=null,this.dateParseFormat=null,this.tickFormat=null,this.timePeriod=null,this.timeInterval=1,this.useLog=!1,this.logBase=10,this.title=void 0,this.clamp=!0,this.ticks=null,this.fontSize="10px",this.fontFamily="sans-serif",this._slaves=[],this._scale=null,this._min=0,this._max=0,this._previousOrigin=null,this._origin=null,this._orderRules=[],this._groupOrderRules=[],this._draw=null,this._getAxisData=function(){var a,b,c=[],d=!1;if(this.chart&&this.chart.series){for(a=0;a0?c=c.concat(b.data):d=!0);d&&this.chart.data&&(c=c.concat(this.chart.data))}return c},this._getFontSize=function(){var a;return a=this.fontSize&&"auto"!==this.fontSize.toString().toLowerCase()?isNaN(this.fontSize)?this.fontSize:this.fontSize+"px":(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)+"px"},this._getFormat=function(){var b,c,d,e,f,g,h;return null!==this.tickFormat&&void 0!==this.tickFormat?b=this._hasTimeField()?a.time.format(this.tickFormat):a.format(this.tickFormat):this.showPercent?b=a.format("%"):this.useLog&&null!==this.measure?b=function(b){var c=Math.floor(Math.abs(b),0).toString().length,d=Math.min(Math.floor((c-1)/3),4),e="kmBT".substring(d-1,d),f="0"===Math.round(10*(b/Math.pow(1e3,d))).toString().slice(-1)?0:1;return 0===b?0:a.format(",."+f+"f")(b/Math.pow(1e3,d))+e}:null!==this.measure?(c=Math.floor(Math.abs(this._max),0).toString(),d=Math.floor(Math.abs(this._min),0).toString(),e=Math.max(d.length,c.length),e>3?(f=Math.min(Math.floor((e-1)/3),4),g="kmBT".substring(f-1,f),h=1>=e-3*f?1:0,b=function(b){return 0===b?0:a.format(",."+h+"f")(b/Math.pow(1e3,f))+g}):(h=1>=e?1:0,b=a.format(",."+h+"f"))):b=function(a){return a},b},this._getTimePeriod=function(){var b=this.timePeriod,c=30,d=this._max-this._min;return this._hasTimeField()&&!this.timePeriod&&(b=c>=d/1e3?a.time.seconds:c>=d/6e4?a.time.minutes:c>=d/36e5?a.time.hours:c>=d/864e5?a.time.days:c>=d/6048e5?a.time.weeks:c>=d/26298e5?a.time.months:a.time.years),b},this._getTooltipText=function(a,b){if(this._hasTimeField())b[this.position+"Field"][0]&&a.push(this.timeField+": "+this._getFormat()(b[this.position+"Field"][0]));else if(this._hasCategories())this.categoryFields.forEach(function(c,d){null!==c&&void 0!==c&&b[this.position+"Field"][d]&&a.push(c+(b[this.position+"Field"][d]!==c?": "+b[this.position+"Field"][d]:""))},this);else if(this._hasMeasure())switch(this.position){case"x":a.push(this.measure+": "+this._getFormat()(b.width));break;case"y":a.push(this.measure+": "+this._getFormat()(b.height));break;case"z":a.push(this.measure+": "+this._getFormat()(b.zValue));break;case"c":a.push(this.measure+": "+this._getFormat()(b.cValue))}},this._getTopMaster=function(){var a=this;return null!==this.master&&void 0!==this.master&&(a=this.master._getTopMaster()),a},this._hasCategories=function(){return null!==this.categoryFields&&void 0!==this.categoryFields&&this.categoryFields.length>0},this._hasMeasure=function(){return null!==this.measure&&void 0!==this.measure},this._hasTimeField=function(){return null!==this.timeField&&void 0!==this.timeField},this._parseDate=function(b){var c;return c=null===this.dateParseFormat||void 0===this.dateParseFormat?isNaN(b)?Date.parse(b):new Date(b):a.time.format(this.dateParseFormat).parse(b)},this._update=function(c){var d,e,f,g,h=[],i=this.ticks||10,j=function(a,c,d){var e,f,g=a.categoryFields[0],h=a._getAxisData(),i=g,j=!1,k=!0,l=null;for(e=0;e1?1:this._max,this._min=null!==this.overrideMin?this.overrideMin:this._min,this._max=null!==this.overrideMax?this.overrideMax:this._max,"x"!==this.position||null!==this._scale&&!c){if("y"!==this.position||null!==this._scale&&!c)this.position.length>0&&"z"===this.position[0]&&null===this._scale?this._scale=this.useLog?a.scale.log().range([this.chart._heightPixels()/300,this.chart._heightPixels()/10]).domain([0===this._min?Math.pow(this.logBase,-1):this._min,0===this._max?-1*Math.pow(this.logBase,-1):this._max]).clamp(this.clamp).base(this.logBase):a.scale.linear().range([1,this.chart._heightPixels()/10]).domain([this._min,this._max]).clamp(this.clamp):this.position.length>0&&"c"===this.position[0]&&null===this._scale&&(this._scale=a.scale.linear().range([0,null===this.colors||1===this.colors.length?1:this.colors.length-1]).domain([this._min,this._max]).clamp(this.clamp));else if(this._hasTimeField()?this._scale=a.time.scale().rangeRound([this.chart._yPixels()+this.chart._heightPixels(),this.chart._yPixels()]).domain([this._min,this._max]).clamp(this.clamp):this.useLog?this._scale=a.scale.log().range([this.chart._yPixels()+this.chart._heightPixels(),this.chart._yPixels()]).domain([0===this._min?Math.pow(this.logBase,-1):this._min,0===this._max?-1*Math.pow(this.logBase,-1):this._max]).clamp(this.clamp).base(this.logBase).nice():null===this.measure||void 0===this.measure?(h=j(this,"y","x"),null!==this._slaves&&void 0!==this._slaves&&this._slaves.forEach(function(a){h=h.concat(j(a,"y","x"))},this),this._scale=a.scale.ordinal().rangePoints([this.chart._yPixels()+this.chart._heightPixels(),this.chart._yPixels()]).domain(h.concat([""]))):this._scale=a.scale.linear().range([this.chart._yPixels()+this.chart._heightPixels(),this.chart._yPixels()]).domain([this._min,this._max]).clamp(this.clamp).nice(),!this.hidden)switch(this.chart._axisIndex(this,"y")){case 0:this._draw=a.svg.axis().orient("left").scale(this._scale),this.ticks&&this._draw.ticks(i);break;case 1:this._draw=a.svg.axis().orient("right").scale(this._scale),this.ticks&&this._draw.ticks(i)}}else if(this._hasTimeField()?this._scale=a.time.scale().rangeRound([this.chart._xPixels(),this.chart._xPixels()+this.chart._widthPixels()]).domain([this._min,this._max]).clamp(this.clamp):this.useLog?this._scale=a.scale.log().range([this.chart._xPixels(),this.chart._xPixels()+this.chart._widthPixels()]).domain([0===this._min?Math.pow(this.logBase,-1):this._min,0===this._max?-1*Math.pow(this.logBase,-1):this._max]).clamp(this.clamp).base(this.logBase).nice():null===this.measure||void 0===this.measure?(h=j(this,"x","y"),null!==this._slaves&&void 0!==this._slaves&&this._slaves.forEach(function(a){h=h.concat(j(a,"x","y"))},this),this._scale=a.scale.ordinal().rangePoints([this.chart._xPixels(),this.chart._xPixels()+this.chart._widthPixels()]).domain(h.concat([""]))):this._scale=a.scale.linear().range([this.chart._xPixels(),this.chart._xPixels()+this.chart._widthPixels()]).domain([this._min,this._max]).clamp(this.clamp).nice(),!this.hidden)switch(this.chart._axisIndex(this,"x")){case 0:this._draw=a.svg.axis().orient("bottom").scale(this._scale),this.ticks&&this._draw.ticks(i);break;case 1:this._draw=a.svg.axis().orient("top").scale(this._scale),this.ticks&&this._draw.ticks(i)}return null!==this._slaves&&void 0!==this._slaves&&this._slaves.length>0&&this._slaves.forEach(function(a){a._scale=this._scale},this),null!==c&&void 0!==c&&c!==!1||this._hasTimeField()||null===this._scale||null===this._scale.ticks||void 0===this._scale.ticks||!(this._scale.ticks(i).length>0)||"x"!==this.position&&"y"!==this.position||(d=this._scale.ticks(i),e=d[1]-d[0],f=((this._max-this._min)%e).toFixed(0),0!==f&&(this._max=Math.ceil(this._max/e)*e,this._min=Math.floor(this._min/e)*e,this._update(!0))),g=null!==h&&void 0!==h&&h.length>0?this._scale.copy()(h[0]):this._min>0?this._scale.copy()(this._min):this._max<0?this._scale.copy()(this._max):this._scale.copy()(0),this._origin!==g&&(this._previousOrigin=null===this._origin?g:this._origin,this._origin=g),this},this.addGroupOrderRule=function(a,b){this._groupOrderRules.push({ordering:a,desc:b})},this.addOrderRule=function(a,b){this._orderRules.push({ordering:a,desc:b})}},b.chart=function(c,d){this.svg=c,this.x="10%",this.y="10%",this.width="80%",this.height="80%",this.data=d,this.noFormats=!1,this.axes=[],this.series=[],this.legends=[],this.storyboard=null,this.titleShape=null,this.shapes=null,this.ease="cubic-in-out",this.staggerDraw=!1,this._group=c.append("g"),this._tooltipGroup=null,this._assignedColors={},this._nextColor=0,this._axisIndex=function(a,b){var c=0,d=0,e=-1;for(c=0;c0&&(a=a.concat(this.data)),null!==this.series&&void 0!==this.series&&this.series.length>0&&this.series.forEach(function(b){null!==b.data&&void 0!==b.data&&b.data.length>0&&(a=a.concat(b.data))}),a},this._getDelay=function(a,c,d){return function(e){var f=0;return d&&c.staggerDraw&&(d.x._hasCategories()?f=b._helpers.cx(e,c,d)/c._widthPixels()*a:d.y._hasCategories()&&(f=(1-b._helpers.cy(e,c,d)/c._heightPixels())*a)),f}},this._getSeriesData=function(){null!==this.series&&void 0!==this.series&&this.series.forEach(function(c){var d,e,f=[],g=function(a,b){var c=[];return null!==a&&(a._hasTimeField()?c.push(a._parseDate(b[a.timeField])):a._hasCategories()&&a.categoryFields.forEach(function(a){c.push(b[a])},this)),c},h={x:!1,y:!1,z:!1,c:!1},i={x:[],y:[]},j={x:[],y:[],z:[]},k={min:null,max:null},l={x:[],y:[],z:[]},m=[],n={},o={x:0,y:0,z:0},p="",q=[],r=[],s=[],t="",u=[],v="",w=[],x=[],y=c.data||this.data||[],z=[];null!==this.storyboard&&void 0!==this.storyboard&&this.storyboard.categoryFields.length>0&&(p=this.storyboard.categoryFields[0],q=b._getOrderedList(y,p,this.storyboard._orderRules)),c.x._hasCategories()&&c.x._hasMeasure()&&(t=c.x.categoryFields[0],u=b._getOrderedList(y,t,c.x._orderRules.concat([{ordering:c.x.measure,desc:!0}]))),c.y._hasCategories()&&c.y._hasMeasure()&&(v=c.y.categoryFields[0],w=b._getOrderedList(y,v,c.y._orderRules.concat([{ordering:c.y.measure,desc:!0}]))),y.length>0&&null!==c.categoryFields&&void 0!==c.categoryFields&&c.categoryFields.length>0&&(x=[].concat(c._orderRules),r=[],c.categoryFields.forEach(function(a){void 0!==y[0][a]&&r.push(a)},this),null!==c.c&&void 0!==c.c&&c.c._hasMeasure()?x.push({ordering:c.c.measure,desc:!0}):null!==c.z&&void 0!==c.z&&c.z._hasMeasure()?x.push({ordering:c.z.measure,desc:!0}):c.x._hasMeasure()?x.push({ordering:c.x.measure,desc:!0}):c.y._hasMeasure()&&x.push({ordering:c.y.measure,desc:!0}),s=b._getOrderedList(y,r,x)),y.sort(function(a,b){var c,d,e,f,g,h,i=0;if(""!==p&&(i=q.indexOf(a[p])-q.indexOf(b[p])),""!==t&&0===i&&(i=u.indexOf(a[t])-u.indexOf(b[t])),""!==v&&0===i&&(i=w.indexOf(a[v])-w.indexOf(b[v])),r&&r.length>0&&0===i)for(c=[].concat(r),i=0,e=0;e0&&(m+="/"),m+=a[b],i=m===e},this)),null!==b&&void 0!==b&&i&&(g=f[k],b._hasMeasure()&&null!==a[b.measure]&&void 0!==a[b.measure]&&(-1===g[b.position+"ValueList"].indexOf(a[b.measure])&&g[b.position+"ValueList"].push(a[b.measure]),isNaN(parseFloat(a[b.measure]))&&(h[b.position]=!0),j.value=g[b.position+"Value"],j.count=g[b.position+"Count"],l.value=a[b.measure],g[b.position+"Value"]=c.aggregate(j,l),g[b.position+"Count"]+=1))},j(c.x,this.storyboard),j(c.y,this.storyboard),j(c.z,this.storyboard),j(c.c,this.storyboard)},this),null!==c.x&&void 0!==c.x&&c.x._hasCategories()&&c.x.categoryFields.length>1&&void 0!==i.x&&(z=[],c.y._hasMeasure()&&z.push({ordering:c.y.measure,desc:!0}),i.x=b._getOrderedList(y,c.x.categoryFields[1],c.x._groupOrderRules.concat(z))),null!==c.y&&void 0!==c.y&&c.y._hasCategories()&&c.y.categoryFields.length>1&&void 0!==i.y&&(z=[],c.x._hasMeasure()&&z.push({ordering:c.x.measure,desc:!0}),i.y=b._getOrderedList(y,c.y.categoryFields[1],c.y._groupOrderRules.concat(z)),i.y.reverse()),f.forEach(function(a){null!==c.x&&(h.x===!0&&(a.xValue=a.xValueList.length),d=(null===j.x[a.xField.join("/")]||void 0===j.x[a.xField.join("/")]?0:j.x[a.xField.join("/")])+(c.y._hasMeasure()?Math.abs(a.yValue):0),j.x[a.xField.join("/")]=d),null!==c.y&&(h.y===!0&&(a.yValue=a.yValueList.length),d=(null===j.y[a.yField.join("/")]||void 0===j.y[a.yField.join("/")]?0:j.y[a.yField.join("/")])+(c.x._hasMeasure()?Math.abs(a.xValue):0),j.y[a.yField.join("/")]=d),null!==c.z&&(h.z===!0&&(a.zValue=a.zValueList.length),d=(null===j.z[a.zField.join("/")]||void 0===j.z[a.zField.join("/")]?0:j.z[a.zField.join("/")])+(c.z._hasMeasure()?Math.abs(a.zValue):0),j.z[a.zField.join("/")]=d),null!==c.c&&((null===k.min||a.cValuek.max)&&(k.max=a.cValue))},this);for(e in j.x)j.x.hasOwnProperty(e)&&(o.x+=j.x[e]);for(e in j.y)j.y.hasOwnProperty(e)&&(o.y+=j.y[e]);for(e in j.z)j.z.hasOwnProperty(e)&&(o.z+=j.z[e]);f.forEach(function(b){var d,e,f,g,h,p=function(a,d,e){var f,g,h,k,p;null!==a&&void 0!==a&&(k=a.position,a._hasCategories()?a._hasMeasure()?(f=b[a.position+"Field"].join("/"),g=a.showPercent?j[a.position][f]/o[a.position]:j[a.position][f],-1===m.indexOf(f)&&(n[f]=g+(m.length>0?n[m[m.length-1]]:0),m.push(f)),h=b[k+"Bound"]=b["c"+k]="x"!==k&&"y"!==k||!c._isStacked()?g:n[f],b[e]=g,b[k]=h-("x"===k&&g>=0||"y"===k&&0>=g?g:0)):(b[k]=b["c"+k]=b[k+"Field"][0],b[e]=1,void 0!==i[k]&&null!==i[k]&&i[k].length>=2&&(b[k+"Offset"]=i[k].indexOf(b[k+"Field"][1]),b[e]=1/i[k].length)):(g=a.showPercent?b[k+"Value"]/j[d][b[d+"Field"].join("/")]:b[k+"Value"],f=b[d+"Field"].join("/")+(b[k+"Value"]>=0),p=l[k][f]=(null===l[k][f]||void 0===l[k][f]||"z"===k?0:l[k][f])+g,h=b[k+"Bound"]=b["c"+k]="x"!==k&&"y"!==k||!c._isStacked()?g:p,b[e]=g,b[k]=h-("x"===k&&g>=0||"y"===k&&0>=g?g:0)))};p(c.x,"y","width"),p(c.y,"x","height"),p(c.z,"z","r"),null!==c.c&&null!==k.min&&null!==k.max&&(k.min===k.max&&(k.min-=.5,k.max+=.5),k.min=null!==c.c.overrideMin&&void 0!==c.c.overrideMin?c.c.overrideMin:k.min,k.max=null!==c.c.overrideMax&&void 0!==c.c.overrideMax?c.c.overrideMax:k.max,b.cValue=b.cValue>k.max?k.max:b.cValue1?(d=a.rgb(c.c.colors[Math.floor(g)]),e=a.rgb(c.c.colors[Math.ceil(g)])):(d=a.rgb("white"),e=a.rgb(this.getColor(b.aggField.slice(-1)[0]).fill)),d.r=Math.floor(d.r+(e.r-d.r)*h),d.g=Math.floor(d.g+(e.g-d.g)*h),d.b=Math.floor(d.b+(e.b-d.b)*h),b.fill=d.toString(),b.stroke=d.darker(.5).toString())},this),c._positionData=f},this)},this._handleTransition=function(a,b,c,d){var e=null;return e=0===b?a:a.transition().duration(b).delay(c._getDelay(b,c,d)).ease(c.ease)},this._heightPixels=function(){return b._parseYPosition(this.height,this.svg.node())},this._registerEventHandlers=function(c){null!==c._eventHandlers&&c._eventHandlers.length>0&&c._eventHandlers.forEach(function(d){var e=null;null!==d.handler&&"function"==typeof d.handler&&(e=null!==c._markers&&void 0!==c._markers?c._markers:c.shapes,e.on(d.event,function(e){var f=new b.eventArgs;null!==c.chart.storyboard&&(f.frameValue=c.chart.storyboard.getFrameValue()),f.seriesValue=e.aggField,f.xValue=e.x,f.yValue=e.y,f.zValue=e.z,f.colorValue=e.cValue,f.seriesShapes=c.shapes,f.selectedShape=a.select(this),d.handler(f)}))},this)},this._widthPixels=function(){return b._parseXPosition(this.width,this.svg.node())},this._xPixels=function(){return b._parseXPosition(this.x,this.svg.node())},this._yPixels=function(){return b._parseYPosition(this.y,this.svg.node())},this.addAxis=function(a,c,d,e){var f=null,g=null;if(null!==c&&void 0!==c&&(c=[].concat(c)),"string"==typeof a||a instanceof String)f=new b.axis(this,a,c,d,e),this.axes.push(f);else{if(g=a,f=new b.axis(this,g.position,c,d,e),f._hasMeasure()!==g._hasMeasure())throw"You have specified a composite axis where some but not all axes have a measure - this is not supported, all axes must be of the same type.";if(f._hasTimeField()!==g._hasTimeField())throw"You have specified a composite axis where some but not all axes have a time field - this is not supported, all axes must be of the same type.";if((null===f.categoryFields||void 0===f.categoryFields?0:f.categoryFields.length)!==(null===g.categoryFields||void 0===g.categoryFields?0:g.categoryFields.length))throw"You have specified a composite axis where axes have differing numbers of category fields - this is not supported, all axes must be of the same type.";g._slaves.push(f)}return f},this.addCategoryAxis=function(a,b){return this.addAxis(a,b,null)},this.addColorAxis=function(a,b){var c=this.addAxis("c",null,a);return c.colors=null===b||void 0===b?null:[].concat(b),c},this.addLegend=function(a,c,d,e,f,g){g=null===g||void 0===g?this.series:[].concat(g),f=null===f||void 0===f?"left":f;var h=new b.legend(this,a,c,d,e,f,g);return this.legends.push(h),h},this.addLogAxis=function(a,b,c){var d=this.addAxis(a,null,b,null);return null!==c&&void 0!==c&&(d.logBase=c),d.useLog=!0,d},this.addMeasureAxis=function(a,b){return this.addAxis(a,null,b)},this.addPctAxis=function(a,b,c){var d=null;return d=null!==c&&void 0!==c?this.addAxis(a,c,b):this.addMeasureAxis(a,b),d.showPercent=!0,d},this.addSeries=function(a,c,d){(null===d||void 0===d)&&(d=this.axes),(null===c||void 0===c)&&(c=b.plot.bubble);var e,f=null,g=null,h=null,i=null;return d.forEach(function(a){null!==a&&c.supportedAxes.indexOf(a.position)>-1&&(null===f&&"x"===a.position[0]?f=a:null===g&&"y"===a.position[0]?g=a:null===h&&"z"===a.position[0]?h=a:null===i&&"c"===a.position[0]&&(i=a))},this),null!==a&&void 0!==a&&(a=[].concat(a)),e=new b.series(this,a,f,g,h,i,c,b.aggregateMethod.sum,c.stacked),this.series.push(e),e},this.addTimeAxis=function(a,b,c,d){var e=this.addAxis(a,null,null,b);return e.tickFormat=d,e.dateParseFormat=c,e},this.assignColor=function(a,c,d,e){return this._assignedColors[a]=new b.color(c,d,e),this._assignedColors[a]},this.defaultColors=[new b.color("#80B1D3"),new b.color("#FB8072"),new b.color("#FDB462"),new b.color("#B3DE69"),new b.color("#FFED6F"),new b.color("#BC80BD"),new b.color("#8DD3C7"),new b.color("#CCEBC5"),new b.color("#FFFFB3"),new b.color("#BEBADA"),new b.color("#FCCDE5"),new b.color("#D9D9D9")],this.draw=function(b,c){b=null===b||void 0===b?0:b;var d,e,f=null,g=null,h=!1,i=!1,j=this._xPixels(),k=this._yPixels(),l=this._widthPixels(),m=this._heightPixels();return(void 0===c||null===c||c===!1)&&this._getSeriesData(),this.axes.forEach(function(a){a._scale=null},this),this.axes.forEach(function(a){if(a._min=0,a._max=0,e=[],a._hasMeasure()){var b=!1;this.series.forEach(function(c){if(c._deepMatch(a)){var d=c._axisBounds(a.position);a._min>d.min&&(a._min=d.min),a._maxb[a.measure]&&(a._min=b[a.measure]),a._maxa._max)&&(a._max=d)},this)},this)):a._hasCategories()&&(a._min=0,d=[],this.series.forEach(function(b){b._deepMatch(a)&&null!==b[a.position].categoryFields[0]&&void 0!==b[a.position].categoryFields[0]&&-1===e.indexOf(b[a.position].categoryFields[0])&&e.push(b[a.position].categoryFields[0])},this),a._getAxisData().forEach(function(a){e.forEach(function(b){-1===d.indexOf(a[b])&&d.push(a[b])},this)},this),a._max=d.length);null!==a._slaves&&void 0!==a._slaves&&a._slaves.length>0&&a._slaves.forEach(function(b){b._min=a._min,b._max=a._max},this),a._update(),null===f&&"x"===a.position?f=a:null===g&&"y"===a.position&&(g=a)},this),this.axes.forEach(function(c){var d=!1,e=null,n=0,o=null,p=!1,q=0,r={l:null,t:null,r:null,b:null},s=0,t=0,u="",v=this,w=function(a){var c;return c=null===e||0===b||d?a:v._handleTransition(a,b,v)},x=function(){c.measure||("x"===c.position?a.select(this).selectAll("text").attr("x",l/c._max/2):"y"===c.position&&a.select(this).selectAll("text").attr("y",-1*(m/c._max)/2)),c.categoryFields&&c.categoryFields.length>0&&(c!==f||null!==g.categoryFields&&0!==g.categoryFields.length||a.select(this).selectAll("text").attr("y",k+m-g._scale(0)+9),c!==g||null!==f.categoryFields&&0!==f.categoryFields.length||a.select(this).selectAll("text").attr("x",-1*(f._scale(0)-j)-9))};null===c.gridlineShapes?(c.showGridlines||null===c.showGridlines&&!c._hasCategories()&&(!h&&"x"===c.position||!i&&"y"===c.position))&&(c.gridlineShapes=this._group.append("g").attr("class","dimple-gridline"),"x"===c.position?h=!0:i=!0):"x"===c.position?h=!0:i=!0,null===c.shapes&&(c.shapes=this._group.append("g").attr("class","dimple-axis").each(function(){v.noFormats||a.select(this).style("font-family",c.fontFamily).style("font-size",c._getFontSize())}),d=!0),c===f&&null!==g?(e="translate(0, "+(null===g.categoryFields||0===g.categoryFields.length?g._scale(0):k+m)+")",o="translate(0, "+(c===f?k+m:k)+")",n=-m):c===g&&null!==f?(e="translate("+(null===f.categoryFields||0===f.categoryFields.length?f._scale(0):j)+", 0)",o="translate("+(c===g?j:j+l)+", 0)",n=-l):"x"===c.position?(o=e="translate(0, "+(c===f?k+m:k)+")",n=-m):"y"===c.position&&(o=e="translate("+(c===g?j:j+l)+", 0)",n=-l),null!==e&&null!==c._draw&&(c._hasTimeField()?w(c.shapes).call(c._draw.ticks(c._getTimePeriod(),c.timeInterval).tickFormat(c._getFormat())).attr("transform",e).each(x):c.useLog?w(c.shapes).call(c._draw.ticks(4,c._getFormat())).attr("transform",e).each(x):w(c.shapes).call(c._draw.tickFormat(c._getFormat())).attr("transform",e).each(x),null!==c.gridlineShapes&&w(c.gridlineShapes).call(c._draw.tickSize(n,0,0).tickFormat("")).attr("transform",o)),this.noFormats||(w(c.shapes.selectAll("text")).style("font-family",c.fontFamily).style("font-size",c._getFontSize()),w(c.shapes.selectAll("path, line")).style("fill","none").style("stroke","black").style("shape-rendering","crispEdges"),null!==c.gridlineShapes&&w(c.gridlineShapes.selectAll("line")).style("fill","none").style("stroke","lightgray").style("opacity",.8)),(null===c.measure||void 0===c.measure)&&(c===f?(q=0,c.shapes.selectAll("text").each(function(){var a=this.getComputedTextLength();q=a>q?a:q}),q>l/c.shapes.selectAll("text")[0].length?(p=!0,c.shapes.selectAll("text").style("text-anchor","start").each(function(){var b=this.getBBox();a.select(this).attr("transform","rotate(90,"+b.x+","+(b.y+b.height/2)+") translate(-5, 0)")})):(p=!1,c.shapes.selectAll("text").style("text-anchor","middle").attr("transform",""))):"x"===c.position&&(q=0,c.shapes.selectAll("text").each(function(){var a=this.getComputedTextLength();q=a>q?a:q}),q>l/c.shapes.selectAll("text")[0].length?(p=!0,c.shapes.selectAll("text").style("text-anchor","end").each(function(){var b=this.getBBox();a.select(this).attr("transform","rotate(90,"+(b.x+b.width)+","+(b.y+b.height/2)+") translate(5, 0)")})):(p=!1,c.shapes.selectAll("text").style("text-anchor","middle").attr("transform","")))),null!==c.titleShape&&void 0!==c.titleShape&&c.titleShape.remove(),c.shapes.selectAll("text").each(function(){var a=this.getBBox();(null===r.l||-9-a.widthr.r)&&(r.r=a.x+a.width),p?((null===r.t||a.y+a.height-a.widthr.b)&&(r.b=a.height+a.width)):((null===r.t||a.yr.b)&&(r.b=9+a.height))}),"x"===c.position?(t=c===f?k+m+r.b+5:k+r.t-10,s=j+l/2):"y"===c.position&&(s=c===g?j+r.l-10:j+l+r.r+20,t=k+m/2,u="rotate(270, "+s+", "+t+")"),c.hidden||"x"!==c.position&&"y"!==c.position||null===c.title||(c.titleShape=this._group.append("text").attr("class","dimple-axis dimple-title"),c.titleShape.attr("x",s).attr("y",t).attr("text-anchor","middle").attr("transform",u).text(void 0!==c.title?c.title:null===c.categoryFields||void 0===c.categoryFields||0===c.categoryFields.length?c.measure:c.categoryFields.join("/")).each(function(){v.noFormats||a.select(this).style("font-family",c.fontFamily).style("font-size",c._getFontSize())}),c===f?c.titleShape.each(function(){a.select(this).attr("y",t+this.getBBox().height/1.65)}):c===g&&c.titleShape.each(function(){a.select(this).attr("x",s+this.getBBox().height/1.65)}))},this),this.series.forEach(function(a){a.plot.draw(this,a,b),this._registerEventHandlers(a)},this),this.legends.forEach(function(a){a._draw(b)},this),null!==this.storyboard&&void 0!==this.storyboard&&(this.storyboard._drawText(),this.storyboard.autoplay&&this.storyboard.startAnimation()),this},this.getColor=function(a){return(null===this._assignedColors[a]||void 0===this._assignedColors[a])&&(this._assignedColors[a]=this.defaultColors[this._nextColor],this._nextColor=(this._nextColor+1)%this.defaultColors.length),this._assignedColors[a]},this.setBounds=function(a,c,d,e){return this.x=a,this.y=c,this.width=d,this.height=e,this._xPixels=function(){return b._parseXPosition(this.x,this.svg.node())},this._yPixels=function(){return b._parseYPosition(this.y,this.svg.node())},this._widthPixels=function(){return b._parseXPosition(this.width,this.svg.node())},this._heightPixels=function(){return b._parseYPosition(this.height,this.svg.node())},this.draw(0,!0),this},this.setMargins=function(a,c,d,e){return this.x=a,this.y=c,this.width=0,this.height=0,this._xPixels=function(){return b._parseXPosition(this.x,this.svg.node())},this._yPixels=function(){return b._parseYPosition(this.y,this.svg.node())},this._widthPixels=function(){return b._parentWidth(this.svg.node())-this._xPixels()-b._parseXPosition(d,this.svg.node())},this._heightPixels=function(){return b._parentHeight(this.svg.node())-this._yPixels()-b._parseYPosition(e,this.svg.node())},this.draw(0,!0),this},this.setStoryboard=function(a,c){return this.storyboard=new b.storyboard(this,a),null!==c&&void 0!==c&&(this.storyboard.onTick=c),this.storyboard}},b.color=function(b,c,d){this.fill=b,this.stroke=null===c||void 0===c?a.rgb(b).darker(.5).toString():c,this.opacity=null===d||void 0===d?.8:d},b.eventArgs=function(){this.seriesValue=null,this.xValue=null,this.yValue=null,this.zValue=null,this.colorValue=null,this.frameValue=null,this.seriesShapes=null,this.selectedShape=null},b.legend=function(c,d,e,f,g,h,i){this.chart=c,this.series=i,this.x=d,this.y=e,this.width=f,this.height=g,this.horizontalAlign=h,this.shapes=null,this.fontSize="10px",this.fontFamily="sans-serif",this._draw=function(c){var d,e=this._getEntries(),f=0,g=0,h=0,i=0,j=15,k=9,l=this;null!==this.shapes&&void 0!==this.shapes&&this.shapes.transition().duration(.2*c).attr("opacity",0).remove(),d=this.chart._group.selectAll(".dimple-dont-select-any").data(e).enter().append("g").attr("class",function(a){return"dimple-legend "+b._createClass(a.aggField)}).attr("opacity",0),d.append("text").attr("class",function(a){return"dimple-legend dimple-legend-text "+b._createClass(a.aggField)}).text(function(a){return a.key}).call(function(){l.chart.noFormats||this.style("font-family",l.fontFamily).style("font-size",l._getFontSize()).style("shape-rendering","crispEdges")}).each(function(){var a=this.getBBox();a.width>f&&(f=a.width),a.height>g&&(g=a.height)}),d.append("rect").attr("class",function(a){return"dimple-legend dimple-legend-key "+b._createClass(a.aggField)}).attr("height",k).attr("width",j),g=(k>g?k:g)+2,f+=j+20,d.each(function(c){h+f>l._widthPixels()&&(h=0,i+=g),i>l._heightPixels()?a.select(this).remove():(a.select(this).select("text").attr("x","left"===l.horizontalAlign?l._xPixels()+j+5+h:l._xPixels()+(l._widthPixels()-h-f)+j+5).attr("y",function(){return l._yPixels()+i+this.getBBox().height/1.65}).attr("width",l._widthPixels()).attr("height",l._heightPixels()),a.select(this).select("rect").attr("class",function(a){return"dimple-legend dimple-legend-key "+b._createClass(a.aggField)}).attr("x","left"===l.horizontalAlign?l._xPixels()+h:l._xPixels()+(l._widthPixels()-h-f)).attr("y",l._yPixels()+i).attr("height",k).attr("width",j).style("fill",c.fill).style("stroke",c.stroke).style("opacity",c.opacity).style("shape-rendering","crispEdges"),h+=f)}),d.transition().delay(.2*c).duration(.8*c).attr("opacity",1),this.shapes=d},this._getEntries=function(){var a=[];return this.series&&this.series.forEach(function(b){var c=b._positionData;c.forEach(function(c){var d,e=-1,f=b.plot.grouped&&!b.x._hasCategories()&&!b.y._hasCategories()&&c.aggField.length<2?"All":c.aggField.slice(-1)[0];for(d=0;d10?this.chart._heightPixels()/35:10)+"px"},this._heightPixels=function(){return b._parseYPosition(this.height,this.chart.svg.node())},this._widthPixels=function(){return b._parseXPosition(this.width,this.chart.svg.node())},this._xPixels=function(){return b._parseXPosition(this.x,this.chart.svg.node())},this._yPixels=function(){return b._parseYPosition(this.y,this.chart.svg.node())}},b.series=function(a,b,c,d,e,f,g,h,i){this.chart=a,this.x=c,this.y=d,this.z=e,this.c=f,this.plot=g,this.categoryFields=b,this.aggregate=h,this.stacked=i,this.barGap=.2,this.clusterBarGap=.1,this.lineWeight=2,this.lineMarkers=!1,this.afterDraw=null,this.interpolation="linear",this.tooltipFontSize="10px",this.tooltipFontFamily="sans-serif",this.radius="auto",this._eventHandlers=[],this._positionData=[],this._orderRules=[],this._axisBounds=function(a){var b,c,d,e={min:0,max:0},f=null,g=null,h=[],i=0,j=this._positionData;return"x"===a?(f=this.x,g=this.y):"y"===a?(f=this.y,g=this.x):"z"===a?f=this.z:"c"===a&&(f=this.c),f.showPercent?j.forEach(function(a){a[f.position+"Bound"]e.max&&(e.max=a[f.position+"Bound"]) -},this):null===g||null===g.categoryFields||0===g.categoryFields.length?j.forEach(function(a){!this._isStacked()||"x"!==f.position&&"y"!==f.position?(a[f.position+"Value"]e.max&&(e.max=a[f.position+"Value"])):a[f.position+"Value"]<0?e.min=e.min+a[f.position+"Value"]:e.max=e.max+a[f.position+"Value"]},this):(b=f.position+"Value",c=g.position+"Field",d=[],j.forEach(function(a){var e=a[c].join("/"),f=d.indexOf(e);-1===f&&(d.push(e),f=d.length-1),void 0===h[f]&&(h[f]={min:0,max:0},f>=i&&(i=f+1)),this.stacked?a[b]<0?h[f].min=h[f].min+a[b]:h[f].max=h[f].max+a[b]:(a[b]h[f].max&&(h[f].max=a[b]))},this),h.forEach(function(a){void 0!==a&&(a.mine.max&&(e.max=a.max))},this)),e},this._deepMatch=function(a){var b=!1;return this[a.position]===a?b=!0:void 0!==a._slaves&&null!==a._slaves&&a._slaves.length>0&&a._slaves.forEach(function(a){b=b||this._deepMatch(a)},this),b},this._dropLineOrigin=function(){var a=0,b=0,c={x:null,y:null},d={x:null,y:null};return this.chart.axes.forEach(function(a){"x"===a.position&&null===d.x?d.x=a._hasTimeField()?this.chart._xPixels():a._origin:"y"===a.position&&null===d.y&&(d.y=a._hasTimeField()?this.chart._yPixels()+this.chart._heightPixels():a._origin)},this),this.chart.axes.forEach(function(e){"x"!==e.position||this.x.hidden?"y"!==e.position||this.y.hidden||(this._deepMatch(e)&&(0===b?c.x=d.x:1===b&&(c.x=this.chart._xPixels()+this.chart._widthPixels())),b+=1):(this._deepMatch(e)&&(0===a?c.y=d.y:1===a&&(c.y=this.chart._yPixels())),a+=1)},this),c},this._getTooltipFontSize=function(){var a;return a=this.tooltipFontSize&&"auto"!==this.tooltipFontSize.toString().toLowerCase()?isNaN(this.tooltipFontSize)?this.tooltipFontSize:this.tooltipFontSize+"px":(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)+"px"},this._isStacked=function(){return this.stacked&&(this.x._hasCategories()||this.y._hasCategories())},this.addEventHandler=function(a,b){this._eventHandlers.push({event:a,handler:b})},this.addOrderRule=function(a,b){this._orderRules.push({ordering:a,desc:b})},this.getTooltipText=function(a){var b=[];return null!==this.categoryFields&&void 0!==this.categoryFields&&this.categoryFields.length>0&&this.categoryFields.forEach(function(c,d){null!==c&&void 0!==c&&null!==a.aggField[d]&&void 0!==a.aggField[d]&&b.push(c+(a.aggField[d]!==c?": "+a.aggField[d]:""))},this),this.x&&this.x._getTooltipText(b,a),this.y&&this.y._getTooltipText(b,a),this.z&&this.z._getTooltipText(b,a),this.c&&this.c._getTooltipText(b,a),b.filter(function(a,c){return b.indexOf(a)===c})}},b.storyboard=function(a,b){null!==b&&void 0!==b&&(b=[].concat(b)),this.chart=a,this.categoryFields=b,this.autoplay=!0,this.frameDuration=3e3,this.storyLabel=null,this.onTick=null,this.fontSize="10px",this.fontFamily="sans-serif",this._frame=0,this._animationTimer=null,this._categories=[],this._cachedCategoryFields=[],this._orderRules=[],this._drawText=function(a){if(null===this.storyLabel||void 0===this.storyLabel){var b=this.chart,c=this,d=0;this.chart.axes.forEach(function(a){"x"===a.position&&(d+=1)},this),this.storyLabel=this.chart._group.append("text").attr("x",this.chart._xPixels()+.01*this.chart._widthPixels()).attr("y",this.chart._yPixels()+(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)*(d>1?1.25:-1)).call(function(){b.noFormats||this.style("font-family",c.fontFamily).style("font-size",c._getFontSize())})}this.storyLabel.transition().duration(.2*a).ease(this.chart.ease).attr("opacity",0),this.storyLabel.transition().delay(.2*a).ease(this.chart.ease).attr("class","dimple-storyboard-label").text(this.categoryFields.join("\\")+": "+this.getFrameValue()).transition().duration(.8*a).attr("opacity",1)},this._getCategories=function(){return this._categoryFields!==this._cachedCategoryFields&&(this._categories=[],this.chart._getAllData().forEach(function(a){var b=-1,c="";null!==this.categoryFields&&(this.categoryFields.forEach(function(b,d){d>0&&(c+="/"),c+=a[b]},this),b=this._categories.indexOf(c),-1===b&&(this._categories.push(c),b=this._categories.length-1))},this),this._cachedCategoryFields=this._categoryFields),this._categories},this._getFontSize=function(){var a;return a=this.fontSize&&"auto"!==this.fontSize.toString().toLowerCase()?isNaN(this.fontSize)?this.fontSize:this.fontSize+"px":(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)+"px"},this._goToFrameIndex=function(a){this._frame=a%this._getCategories().length,this.chart.draw(this.frameDuration/2)},this.addOrderRule=function(a,b){this._orderRules.push({ordering:a,desc:b})},this.getFrameValue=function(){var a=null;return this._frame>=0&&this._getCategories().length>this._frame&&(a=this._getCategories()[this._frame]),a},this.goToFrame=function(a){if(this._getCategories().length>0){var b=this._getCategories().indexOf(a);this._goToFrameIndex(b)}},this.pauseAnimation=function(){null!==this._animationTimer&&(window.clearInterval(this._animationTimer),this._animationTimer=null)},this.startAnimation=function(){null===this._animationTimer&&(null!==this.onTick&&this.onTick(this.getFrameValue()),this._animationTimer=window.setInterval(function(a){return function(){a._goToFrameIndex(a._frame+1),null!==a.onTick&&a.onTick(a.getFrameValue()),a._drawText(a.frameDuration/2)}}(this),this.frameDuration))},this.stopAnimation=function(){null!==this._animationTimer&&(window.clearInterval(this._animationTimer),this._animationTimer=null,this._frame=0)}},b.aggregateMethod.avg=function(a,b){return a.value=null===a.value||void 0===a.value?0:parseFloat(a.value),a.count=null===a.count||void 0===a.count?1:parseFloat(a.count),b.value=null===b.value||void 0===b.value?0:parseFloat(b.value),b.count=null===b.count||void 0===b.count?1:parseFloat(b.count),(a.value*a.count+b.value*b.count)/(a.count+b.count)},b.aggregateMethod.count=function(a,b){return a.count=null===a.count||void 0===a.count?0:parseFloat(a.count),b.count=null===b.count||void 0===b.count?0:parseFloat(b.count),a.count+b.count},b.aggregateMethod.max=function(a,b){return a.value=null===a.value||void 0===a.value?0:parseFloat(a.value),b.value=null===b.value||void 0===b.value?0:parseFloat(b.value),a.value>b.value?a.value:b.value},b.aggregateMethod.min=function(a,b){return null===a.value?parseFloat(b.value):parseFloat(a.value)c&&g>e&&(h=a[d],g=e));return b.push(h),g};for(f="step"===d.interpolation?"step-after":d.interpolation,o=b._getSeriesOrder(d.data||c.data,d),d.c&&(d.x._hasCategories()&&d.y._hasMeasure()||d.y._hasCategories()&&d.x._hasMeasure())&&(G=!0),d.x._hasCategories()?(z="x",A="y"):d.y._hasCategories()&&(z="y",A="x"),g=0;g=2?B[g][z+"Field"][0]:"All"})),C[l].data.push(B[g])}for(o&&C.sort(function(a,c){return b._arrayIndexCompare(o,a.key,c.key)}),g=0;g1&&z&&(d.x._hasCategories()?(p.push({x:2*p[p.length-1].x-p[p.length-2].x,y:p[p.length-1].y}),H[C[g].group][p[p.length-1][z]]=d[A]._origin):d.y._hasCategories()&&(p=[{x:p[0].x,y:2*p[0].y-p[1].y}].concat(p),H[C[g].group][p[0][z]]=d[A]._origin,C[g].points=p))}for(s in H)if(H.hasOwnProperty(s)){I[s]=[];for(t in H[s])H[s].hasOwnProperty(t)&&I[s].push(parseFloat(t));I[s].sort(P)}for(g=0;g0)for(h=0,i=0;h=p[0][z]&&I[u][h]<=p[p.length-1][z]&&(r={},r[z]=I[u][h],r[A]=H[u][I[u][h]],q.push(r),p[i][z]>I[u][h]?J.push(r):(J.push(p[i]),H[C[g].group][I[u][h]]=p[i][A],i+=1));else if(d._orderRules&&d._orderRules.length>0)J=p.concat(p[0]);else{p=p.sort(Q),J.push(p[0]),y=0;do y=R(p,J,y);while(J.length<=p.length&&(J[0].x!==J[J.length-1].x||J[0].y!==J[J.length-1].y))}q=q.reverse(),v=O(f,"_previousOrigin")(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f,"_previousOrigin")(q),x=O("linear","_previousOrigin")(J),C[g].entry=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),v=O(f)(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f)(q),x=O("linear")(J),C[g].update=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),v=O(f,"_origin")(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f,"_origin")(q),x=O("linear","_origin")(J),C[g].exit=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),C[g].color=c.getColor(C[g].key.length>0?C[g].key[C[g].key.length-1]:"All")}null!==c._tooltipGroup&&void 0!==c._tooltipGroup&&c._tooltipGroup.remove(),D=null===d.shapes||void 0===d.shapes?c._group.selectAll("."+E).data(C):d.shapes.data(C,function(a){return a.key}),D.enter().append("path").attr("id",function(a){return a.key}).attr("class",function(a){return E+" dimple-line "+a.keyString}).attr("d",function(a){return a.entry}).call(function(){c.noFormats||this.attr("opacity",function(a){return G?1:a.color.opacity}).attr("fill",function(a){return G?"url(#fill-area-gradient-"+a.keyString+")":a.color.fill}).attr("stroke",function(a){return G?"url(#stroke-area-gradient-"+a.keyString+")":a.color.stroke}).attr("stroke-width",d.lineWeight)}).each(function(a){a.markerData=a.data,M(a)}),m=c._handleTransition(D,e,c).attr("d",function(a){return a.update}).each(function(a){a.markerData=a.data,M(a)}),n=c._handleTransition(D.exit(),e,c).attr("d",function(a){return a.exit}).each(function(a){a.markerData=[],M(a)}),b._postDrawHandling(d,m,n,e),d.shapes=D}},b.plot.bar={stacked:!0,grouped:!1,supportedAxes:["x","y","c"],draw:function(a,c,d){var e,f,g=c._positionData,h=null,i=["dimple-series-"+a.series.indexOf(c),"dimple-bar"],j=!c._isStacked()&&c.x._hasMeasure(),k=!c._isStacked()&&c.y._hasMeasure(),l="none";c.x._hasCategories()&&c.y._hasCategories()?l="both":c.x._hasCategories()?l="x":c.y._hasCategories()&&(l="y"),null!==a._tooltipGroup&&void 0!==a._tooltipGroup&&a._tooltipGroup.remove(),h=null===c.shapes||void 0===c.shapes?a._group.selectAll("."+i.join(".")).data(g):c.shapes.data(g,function(a){return a.key}),h.enter().append("rect").attr("id",function(a){return a.key}).attr("class",function(a){var c=[];return c=c.concat(a.aggField),c=c.concat(a.xField),c=c.concat(a.yField),i.join(" ")+" "+b._createClass(c)}).attr("x",function(d){var e=c.x._previousOrigin;return"x"===l?e=b._helpers.x(d,a,c):"both"===l&&(e=b._helpers.cx(d,a,c)),e}).attr("y",function(d){var e=c.y._previousOrigin;return"y"===l?e=b._helpers.y(d,a,c):"both"===l&&(e=b._helpers.cy(d,a,c)),e}).attr("width",function(d){return"x"===l?b._helpers.width(d,a,c):0}).attr("height",function(d){return"y"===l?b._helpers.height(d,a,c):0}).attr("opacity",function(d){return b._helpers.opacity(d,a,c)}).on("mouseover",function(d){b._showBarTooltip(d,this,a,c)}).on("mouseleave",function(d){b._removeTooltip(d,this,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),e=a._handleTransition(h,d,a,c).attr("x",function(d){return j?b._helpers.cx(d,a,c)-c.x.floatingBarWidth/2:b._helpers.x(d,a,c)}).attr("y",function(d){return k?b._helpers.cy(d,a,c)-c.y.floatingBarWidth/2:b._helpers.y(d,a,c)}).attr("width",function(d){return j?c.x.floatingBarWidth:b._helpers.width(d,a,c)}).attr("height",function(d){return k?c.y.floatingBarWidth:b._helpers.height(d,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),f=a._handleTransition(h.exit(),d,a,c).attr("x",function(d){var e=c.x._origin;return"x"===l?e=b._helpers.x(d,a,c):"both"===l&&(e=b._helpers.cx(d,a,c)),e}).attr("y",function(d){var e=c.y._origin;return"y"===l?e=b._helpers.y(d,a,c):"both"===l&&(e=b._helpers.cy(d,a,c)),e}).attr("width",function(d){return"x"===l?b._helpers.width(d,a,c):0}).attr("height",function(d){return"y"===l?b._helpers.height(d,a,c):0}),b._postDrawHandling(c,e,f,d),c.shapes=h}},b.plot.bubble={stacked:!1,grouped:!1,supportedAxes:["x","y","z","c"],draw:function(a,c,d){var e,f,g=c._positionData,h=null,i=["dimple-series-"+a.series.indexOf(c),"dimple-bubble"];null!==a._tooltipGroup&&void 0!==a._tooltipGroup&&a._tooltipGroup.remove(),h=null===c.shapes||void 0===c.shapes?a._group.selectAll("."+i.join(".")).data(g):c.shapes.data(g,function(a){return a.key}),h.enter().append("circle").attr("id",function(a){return a.key}).attr("class",function(a){var c=[];return c=c.concat(a.aggField),c=c.concat(a.xField),c=c.concat(a.yField),c=c.concat(a.zField),i.join(" ")+" "+b._createClass(c)}).attr("cx",function(d){return c.x._hasCategories()?b._helpers.cx(d,a,c):c.x._previousOrigin}).attr("cy",function(d){return c.y._hasCategories()?b._helpers.cy(d,a,c):c.y._previousOrigin}).attr("r",0).attr("opacity",function(d){return b._helpers.opacity(d,a,c)}).on("mouseover",function(d){b._showPointTooltip(d,this,a,c)}).on("mouseleave",function(d){b._removeTooltip(d,this,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),e=a._handleTransition(h,d,a,c).attr("cx",function(d){return b._helpers.cx(d,a,c)}).attr("cy",function(d){return b._helpers.cy(d,a,c)}).attr("r",function(d){return b._helpers.r(d,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),f=a._handleTransition(h.exit(),d,a,c).attr("r",0).attr("cx",function(d){return c.x._hasCategories()?b._helpers.cx(d,a,c):c.x._origin}).attr("cy",function(d){return c.y._hasCategories()?b._helpers.cy(d,a,c):c.y._origin}),b._postDrawHandling(c,e,f,d),c.shapes=h}},b.plot.line={stacked:!1,grouped:!0,supportedAxes:["x","y","c"],draw:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p=d._positionData,q=[],r=null,s="dimple-series-"+c.series.indexOf(d),t=d.x._hasCategories()||d.y._hasCategories()?0:1,u=!1,v=function(){return function(c,d,e,f){a.select(d).style("opacity",1),b._showPointTooltip(c,d,e,f)}},w=function(c){return function(d,e,f,g){a.select(e).style("opacity",g.lineMarkers||c.data.length<2?b._helpers.opacity(d,f,g):0),b._removeTooltip(d,e,f,g)}},x=function(a){b._drawMarkers(a,c,d,e,s,u,v(a),w(a))},y=function(a,e){var f;return"step"===d.interpolation&&d[a]._hasCategories()?(d.barGap=0,d.clusterBarGap=0,f=b._helpers[a](e,c,d)+("y"===a?b._helpers.height(e,c,d):0)):f=b._helpers["c"+a](e,c,d),parseFloat(f.toFixed(1))},z=function(b,c){return a.svg.line().x(function(a){return d.x._hasCategories()||!c?a.x:d.x[c]}).y(function(a){return d.y._hasCategories()||!c?a.y:d.y[c]}).interpolate(b)};for(f="step"===d.interpolation?"step-after":d.interpolation,o=b._getSeriesOrder(d.data||c.data,d),d.c&&(d.x._hasCategories()&&d.y._hasMeasure()||d.y._hasCategories()&&d.x._hasMeasure())&&(u=!0),g=0;g1&&(d.x._hasCategories()?q[g].points.push({x:2*q[g].points[q[g].points.length-1].x-q[g].points[q[g].points.length-2].x,y:q[g].points[q[g].points.length-1].y}):d.y._hasCategories()&&(q[g].points=[{x:q[g].points[0].x,y:2*q[g].points[0].y-q[g].points[1].y}].concat(q[g].points))),q[g].entry=z(f,"_previousOrigin")(q[g].points),q[g].update=z(f)(q[g].points),q[g].exit=z(f,"_origin")(q[g].points),q[g].color=c.getColor(q[g].key.length>0?q[g].key[q[g].key.length-1]:"All")}null!==c._tooltipGroup&&void 0!==c._tooltipGroup&&c._tooltipGroup.remove(),r=null===d.shapes||void 0===d.shapes?c._group.selectAll("."+s).data(q):d.shapes.data(q,function(a){return a.key}),r.enter().append("path").attr("id",function(a){return a.key}).attr("class",function(a){return s+" dimple-line "+a.keyString}).attr("d",function(a){return a.entry}).call(function(){c.noFormats||this.attr("opacity",function(a){return u?1:a.color.opacity}).attr("fill","none").attr("stroke",function(a){return u?"url(#fill-line-gradient-"+a.keyString+")":a.color.stroke}).attr("stroke-width",d.lineWeight)}).each(function(a){a.markerData=a.data,x(a)}),m=c._handleTransition(r,e,c).attr("d",function(a){return a.update}).each(function(a){a.markerData=a.data,x(a)}),n=c._handleTransition(r.exit(),e,c).attr("d",function(a){return a.exit}).each(function(a){a.markerData=[],x(a)}),b._postDrawHandling(d,m,n,e),d.shapes=r}},b._addGradient=function(a,b,c,d,e,f,g){var h=[].concat(a),i=e._group.select("#"+b),j=[],k=c.position+"Field",l=!0,m=[];d.forEach(function(a){-1===j.indexOf(a[k])&&a.aggField.join("_")===h.join("_")&&j.push(a[k])},this),j=j.sort(function(a,b){return c._scale(a)-c._scale(b)}),null===i.node()&&(l=!1,i=e._group.append("linearGradient").attr("id",b).attr("gradientUnits","userSpaceOnUse").attr("x1","x"===c.position?c._scale(j[0])+e._widthPixels()/j.length/2:0).attr("y1","y"===c.position?c._scale(j[0])-e._heightPixels()/j.length/2:0).attr("x2","x"===c.position?c._scale(j[j.length-1])+e._widthPixels()/j.length/2:0).attr("y2","y"===c.position?c._scale(j[j.length-1])-e._heightPixels()/j.length/2:0)),j.forEach(function(a,b){var c={},e=0;for(e=0;e=65&&90>=b&&(c=a.toLowerCase()),c};if(a.length>0)for(b=0;bd.length/2?i.concat(e):b.values=d}else i.push(b.ordering)},this),e=b._rollUp(a,h,i),j.length>=1&&(j.forEach(function(a){var b=null===a.desc||void 0===a.desc?!1:a.desc,c=a.ordering,d=[],e=function(a){var b,c=0;for(b=0;bb[0]&&(c=1):c=Date.parse(a[0])-Date.parse(b[0]):c=parseFloat(d)-parseFloat(f),c};"function"==typeof c?f.push(function(a,d){return(b?-1:1)*c(a,d)}):a.values&&a.values.length>0?(a.values.forEach(function(a){d.push([].concat(a).join("|"))},this),f.push(function(a,c){var e,f,g,i="",j="";for(g=0;g0&&(i+="|",j+="|"),i+=a[h[g]],j+=c[h[g]];return e=d.indexOf(i),f=d.indexOf(j),e=0>e?b?-1:d.length:e,f=0>f?b?-1:d.length:f,(b?-1:1)*(e-f)})):[].concat(a.ordering).forEach(function(a){f.push(function(c,d){var e=0;return void 0!==c[a]&&void 0!==d[a]&&(e=g([].concat(c[a]),[].concat(d[a]))),(b?-1:1)*e})})}),e.sort(function(a,b){for(var c=0,d=0;c0&&(null!==c.c&&void 0!==c.c&&c.c._hasMeasure()&&d.push({ordering:c.c.measure,desc:!0}),c.x._hasMeasure()&&d.push({ordering:c.x.measure,desc:!0}),c.y._hasMeasure()&&d.push({ordering:c.y.measure,desc:!0}),f=b._getOrderedList(a,e,d)),f},b._getSeriesSortPredicate=function(a,c,d){return function(e,f){var g=0;return c.x._hasCategories()&&(g=b._helpers.cx(e,a,c)-b._helpers.cx(f,a,c)),0===g&&c.y._hasCategories()&&(g=b._helpers.cy(e,a,c)-b._helpers.cy(f,a,c)),0===g&&d&&(g=b._arrayIndexCompare(d,e.aggField,f.aggField)),g}},b._helpers={cx:function(a,c,d){var e=0;return e=null!==d.x.measure&&void 0!==d.x.measure?d.x._scale(a.cx):d.x._hasCategories()&&d.x.categoryFields.length>=2?d.x._scale(a.cx)+b._helpers.xGap(c,d)+(a.xOffset+.5)*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))*a.width:d.x._scale(a.cx)+c._widthPixels()/d.x._max/2},cy:function(a,c,d){var e=0;return e=null!==d.y.measure&&void 0!==d.y.measure?d.y._scale(a.cy):null!==d.y.categoryFields&&void 0!==d.y.categoryFields&&d.y.categoryFields.length>=2?d.y._scale(a.cy)-c._heightPixels()/d.y._max+b._helpers.yGap(c,d)+(a.yOffset+.5)*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))*a.height:d.y._scale(a.cy)-c._heightPixels()/d.y._max/2},r:function(a,b,c){var d=0,e=1;return null===c.z||void 0===c.z?d=c.radius&&"auto"!==c.radius?c.radius:5:(c.radius&&"auto"!==c.radius&&c.radius>1&&(e=c.radius/c.z._scale(c.z._max)),d=c.z._hasMeasure()?c.z._scale(a.r)*e:c.z._scale(b._heightPixels()/100)*e),d},xGap:function(a,b){var c=0;return(null===b.x.measure||void 0===b.x.measure)&&b.barGap>0&&(c=a._widthPixels()/b.x._max*(b.barGap>.99?.99:b.barGap)/2),c},xClusterGap:function(a,c,d){var e=0;return null!==d.x.categoryFields&&void 0!==d.x.categoryFields&&d.x.categoryFields.length>=2&&d.clusterBarGap>0&&!d.x._hasMeasure()&&(e=a.width*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))*(d.clusterBarGap>.99?.99:d.clusterBarGap)/2),e},yGap:function(a,b){var c=0;return(null===b.y.measure||void 0===b.y.measure)&&b.barGap>0&&(c=a._heightPixels()/b.y._max*(b.barGap>.99?.99:b.barGap)/2),c},yClusterGap:function(a,c,d){var e=0;return null!==d.y.categoryFields&&void 0!==d.y.categoryFields&&d.y.categoryFields.length>=2&&d.clusterBarGap>0&&!d.y._hasMeasure()&&(e=a.height*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))*(d.clusterBarGap>.99?.99:d.clusterBarGap)/2),e},x:function(a,c,d){var e=0;return e=d.x._hasTimeField()?d.x._scale(a.x)-b._helpers.width(a,c,d)/2:null!==d.x.measure&&void 0!==d.x.measure?d.x._scale(a.x):d.x._scale(a.x)+b._helpers.xGap(c,d)+a.xOffset*(b._helpers.width(a,c,d)+2*b._helpers.xClusterGap(a,c,d))+b._helpers.xClusterGap(a,c,d)},y:function(a,c,d){var e=0;return e=d.y._hasTimeField()?d.y._scale(a.y)-b._helpers.height(a,c,d)/2:null!==d.y.measure&&void 0!==d.y.measure?d.y._scale(a.y):d.y._scale(a.y)-c._heightPixels()/d.y._max+b._helpers.yGap(c,d)+a.yOffset*(b._helpers.height(a,c,d)+2*b._helpers.yClusterGap(a,c,d))+b._helpers.yClusterGap(a,c,d)},width:function(a,c,d){var e=0;return e=null!==d.x.measure&&void 0!==d.x.measure?Math.abs(d.x._scale(a.x<0?a.x-a.width:a.x+a.width)-d.x._scale(a.x)):d.x._hasTimeField()?d.x.floatingBarWidth:a.width*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))-2*b._helpers.xClusterGap(a,c,d)},height:function(a,c,d){var e=0;return e=d.y._hasTimeField()?d.y.floatingBarWidth:null!==d.y.measure&&void 0!==d.y.measure?Math.abs(d.y._scale(a.y)-d.y._scale(a.y<=0?a.y+a.height:a.y-a.height)):a.height*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))-2*b._helpers.yClusterGap(a,c,d)},opacity:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.opacity:b.getColor(a.aggField.slice(-1)[0]).opacity},fill:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.fill:b.getColor(a.aggField.slice(-1)[0]).fill},stroke:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.stroke:b.getColor(a.aggField.slice(-1)[0]).stroke}},b._parentHeight=function(a){var c=a.offsetHeight;return(0>=c||null===c||void 0===c)&&(c=a.clientHeight),(0>=c||null===c||void 0===c)&&(c=null===a.parentNode||void 0===a.parentNode?0:b._parentHeight(a.parentNode)),c},b._parentWidth=function(a){var c=a.offsetWidth;return(0>=c||null===c||void 0===c)&&(c=a.clientWidth),(0>=c||null===c||void 0===c)&&(c=null===a.parentNode||void 0===a.parentNode?0:b._parentWidth(a.parentNode)),c},b._parseXPosition=function(a,c){var d,e=0;return null!==a&&void 0!==a&&(d=a.toString().split(","),d.forEach(function(d){void 0!==d&&null!==d&&(isNaN(d)?"%"===d.slice(-1)?e+=b._parentWidth(c)*(parseFloat(d.slice(0,d.length-1))/100):"px"===d.slice(-2)?e+=parseFloat(d.slice(0,d.length-2)):e=a:e+=parseFloat(d))},this)),0>e&&(e=b._parentWidth(c)+e),e},b._parseYPosition=function(a,c){var d,e=0;return null!==a&&void 0!==a&&(d=a.toString().split(","),d.forEach(function(d){void 0!==d&&null!==d&&(isNaN(d)?"%"===d.slice(-1)?e+=b._parentHeight(c)*(parseFloat(d.slice(0,d.length-1))/100):"px"===d.slice(-2)?e+=parseFloat(d.slice(0,d.length-2)):e=a:e+=parseFloat(d))},this)),0>e&&(e=b._parentHeight(c)+e),e},b._postDrawHandling=function(b,c,d,e){0===e?(c.each(function(a,c){null!==b.afterDraw&&void 0!==b.afterDraw&&b.afterDraw(this,a,c)}),d.remove()):(c.each("end",function(a,c){null!==b.afterDraw&&void 0!==b.afterDraw&&b.afterDraw(this,a,c)}),d.each("end",function(){a.select(this).remove()}))},b._removeTooltip=function(a,b,c){c._tooltipGroup&&c._tooltipGroup.remove()},b._rollUp=function(a,b,c){var d=[];return b=null!==b&&void 0!==b?[].concat(b):[],a.forEach(function(a){var e=-1,f={},g=!0;d.forEach(function(c,d){-1===e&&(g=!0,b.forEach(function(b){g=g&&a[b]===c[b]},this),g&&(e=d))},this),-1!==e?f=d[e]:(b.forEach(function(b){f[b]=a[b]},this),d.push(f),e=d.length-1),c.forEach(function(c){-1===b.indexOf(c)&&(void 0===f[c]&&(f[c]=[]),f[c]=f[c].concat(a[c]))},this),d[e]=f},this),d},b._showBarTooltip=function(b,c,d,e){var f,g,h,i,j,k=5,l=10,m=750,n=a.select(c),o=parseFloat(n.attr("x")),p=parseFloat(n.attr("y")),q=parseFloat(n.attr("width")),r=parseFloat(n.attr("height")),s=n.attr("opacity"),t=n.attr("fill"),u=e._dropLineOrigin(),v=a.rgb(a.rgb(t).r+.6*(255-a.rgb(t).r),a.rgb(t).g+.6*(255-a.rgb(t).g),a.rgb(t).b+.6*(255-a.rgb(t).b)),w=a.rgb(a.rgb(t).r+.8*(255-a.rgb(t).r),a.rgb(t).g+.8*(255-a.rgb(t).g),a.rgb(t).b+.8*(255-a.rgb(t).b)),x=e.getTooltipText(b),y=0,z=0,A=0;null!==d._tooltipGroup&&void 0!==d._tooltipGroup&&d._tooltipGroup.remove(),d._tooltipGroup=d.svg.append("g"),j=e._isStacked()?1:q/2,e.x._hasCategories()||null===u.y||d._tooltipGroup.append("line").attr("x1",oe.max&&(e.max=a[f.position+"Value"])):a[f.position+"Value"]<0?e.min=e.min+a[f.position+"Value"]:e.max=e.max+a[f.position+"Value"]},this):(b=f.position+"Value",c=g.position+"Field",d=[],j.forEach(function(a){var e=a[c].join("/"),f=d.indexOf(e);-1===f&&(d.push(e),f=d.length-1),void 0===h[f]&&(h[f]={min:0,max:0},f>=i&&(i=f+1)),this.stacked?a[b]<0?h[f].min=h[f].min+a[b]:h[f].max=h[f].max+a[b]:(a[b]h[f].max&&(h[f].max=a[b]))},this),h.forEach(function(a){void 0!==a&&(a.mine.max&&(e.max=a.max))},this)),e},this._deepMatch=function(a){var b=!1;return this[a.position]===a?b=!0:void 0!==a._slaves&&null!==a._slaves&&a._slaves.length>0&&a._slaves.forEach(function(a){b=b||this._deepMatch(a)},this),b},this._dropLineOrigin=function(){var a=0,b=0,c={x:null,y:null},d={x:null,y:null};return this.chart.axes.forEach(function(a){"x"===a.position&&null===d.x?d.x=a._hasTimeField()?this.chart._xPixels():a._origin:"y"===a.position&&null===d.y&&(d.y=a._hasTimeField()?this.chart._yPixels()+this.chart._heightPixels():a._origin)},this),this.chart.axes.forEach(function(e){"x"!==e.position||this.x.hidden?"y"!==e.position||this.y.hidden||(this._deepMatch(e)&&(0===b?c.x=d.x:1===b&&(c.x=this.chart._xPixels()+this.chart._widthPixels())),b+=1):(this._deepMatch(e)&&(0===a?c.y=d.y:1===a&&(c.y=this.chart._yPixels())),a+=1)},this),c},this._getTooltipFontSize=function(){var a;return a=this.tooltipFontSize&&"auto"!==this.tooltipFontSize.toString().toLowerCase()?isNaN(this.tooltipFontSize)?this.tooltipFontSize:this.tooltipFontSize+"px":(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)+"px"},this._isStacked=function(){return this.stacked&&(this.x._hasCategories()||this.y._hasCategories())},this.addEventHandler=function(a,b){this._eventHandlers.push({event:a,handler:b})},this.addOrderRule=function(a,b){this._orderRules.push({ordering:a,desc:b})},this.getTooltipText=function(a){var b=[];return null!==this.categoryFields&&void 0!==this.categoryFields&&this.categoryFields.length>0&&this.categoryFields.forEach(function(c,d){null!==c&&void 0!==c&&null!==a.aggField[d]&&void 0!==a.aggField[d]&&b.push(c+(a.aggField[d]!==c?": "+a.aggField[d]:""))},this),this.x&&this.x._getTooltipText(b,a),this.y&&this.y._getTooltipText(b,a),this.z&&this.z._getTooltipText(b,a),this.c&&this.c._getTooltipText(b,a),b.filter(function(a,c){return b.indexOf(a)===c})}},b.storyboard=function(a,b){null!==b&&void 0!==b&&(b=[].concat(b)),this.chart=a,this.categoryFields=b,this.autoplay=!0,this.frameDuration=3e3,this.storyLabel=null,this.onTick=null,this.fontSize="10px",this.fontFamily="sans-serif",this._frame=0,this._animationTimer=null,this._categories=[],this._cachedCategoryFields=[],this._orderRules=[],this._drawText=function(a){if(null===this.storyLabel||void 0===this.storyLabel){var b=this.chart,c=this,d=0;this.chart.axes.forEach(function(a){"x"===a.position&&(d+=1)},this),this.storyLabel=this.chart._group.append("text").attr("x",this.chart._xPixels()+.01*this.chart._widthPixels()).attr("y",this.chart._yPixels()+(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)*(d>1?1.25:-1)).call(function(){b.noFormats||this.style("font-family",c.fontFamily).style("font-size",c._getFontSize())})}this.storyLabel.transition().duration(.2*a).ease(this.chart.ease).attr("opacity",0),this.storyLabel.transition().delay(.2*a).ease(this.chart.ease).attr("class","dimple-storyboard-label").text(this.categoryFields.join("\\")+": "+this.getFrameValue()).transition().duration(.8*a).attr("opacity",1)},this._getCategories=function(){return this._categoryFields!==this._cachedCategoryFields&&(this._categories=[],this.chart._getAllData().forEach(function(a){var b=-1,c="";null!==this.categoryFields&&(this.categoryFields.forEach(function(b,d){d>0&&(c+="/"),c+=a[b]},this),b=this._categories.indexOf(c),-1===b&&(this._categories.push(c),b=this._categories.length-1))},this),this._cachedCategoryFields=this._categoryFields),this._categories},this._getFontSize=function(){var a;return a=this.fontSize&&"auto"!==this.fontSize.toString().toLowerCase()?isNaN(this.fontSize)?this.fontSize:this.fontSize+"px":(this.chart._heightPixels()/35>10?this.chart._heightPixels()/35:10)+"px"},this._goToFrameIndex=function(a){this._frame=a%this._getCategories().length,this.chart.draw(this.frameDuration/2)},this.addOrderRule=function(a,b){this._orderRules.push({ordering:a,desc:b})},this.getFrameValue=function(){var a=null;return this._frame>=0&&this._getCategories().length>this._frame&&(a=this._getCategories()[this._frame]),a},this.goToFrame=function(a){if(this._getCategories().length>0){var b=this._getCategories().indexOf(a);this._goToFrameIndex(b)}},this.pauseAnimation=function(){null!==this._animationTimer&&(window.clearInterval(this._animationTimer),this._animationTimer=null)},this.startAnimation=function(){null===this._animationTimer&&(null!==this.onTick&&this.onTick(this.getFrameValue()),this._animationTimer=window.setInterval(function(a){return function(){a._goToFrameIndex(a._frame+1),null!==a.onTick&&a.onTick(a.getFrameValue()),a._drawText(a.frameDuration/2)}}(this),this.frameDuration))},this.stopAnimation=function(){null!==this._animationTimer&&(window.clearInterval(this._animationTimer),this._animationTimer=null,this._frame=0)}},b.aggregateMethod.avg=function(a,b){return a.value=null===a.value||void 0===a.value?0:parseFloat(a.value),a.count=null===a.count||void 0===a.count?1:parseFloat(a.count),b.value=null===b.value||void 0===b.value?0:parseFloat(b.value),b.count=null===b.count||void 0===b.count?1:parseFloat(b.count),(a.value*a.count+b.value*b.count)/(a.count+b.count)},b.aggregateMethod.count=function(a,b){return a.count=null===a.count||void 0===a.count?0:parseFloat(a.count),b.count=null===b.count||void 0===b.count?0:parseFloat(b.count),a.count+b.count},b.aggregateMethod.max=function(a,b){return a.value=null===a.value||void 0===a.value?0:parseFloat(a.value),b.value=null===b.value||void 0===b.value?0:parseFloat(b.value),a.value>b.value?a.value:b.value},b.aggregateMethod.min=function(a,b){return null===a.value?parseFloat(b.value):parseFloat(a.value)c&&g>e&&(h=a[d],g=e));return b.push(h),g};for(f="step"===d.interpolation?"step-after":d.interpolation,o=b._getSeriesOrder(d.data||c.data,d),d.c&&(d.x._hasCategories()&&d.y._hasMeasure()||d.y._hasCategories()&&d.x._hasMeasure())&&(G=!0),d.x._hasCategories()?(z="x",A="y"):d.y._hasCategories()&&(z="y",A="x"),g=0;g=2?B[g][z+"Field"][0]:"All"})),C[l].data.push(B[g])}for(o&&C.sort(function(a,c){return b._arrayIndexCompare(o,a.key,c.key)}),g=0;g1&&z&&(d.x._hasCategories()?(p.push({x:2*p[p.length-1].x-p[p.length-2].x,y:p[p.length-1].y}),H[C[g].group][p[p.length-1][z]]=d[A]._origin):d.y._hasCategories()&&(p=[{x:p[0].x,y:2*p[0].y-p[1].y}].concat(p),H[C[g].group][p[0][z]]=d[A]._origin,C[g].points=p))}for(s in H)if(H.hasOwnProperty(s)){I[s]=[];for(t in H[s])H[s].hasOwnProperty(t)&&I[s].push(parseFloat(t));I[s].sort(P)}for(g=0;g0)for(h=0,i=0;h=p[0][z]&&I[u][h]<=p[p.length-1][z]&&(r={},r[z]=I[u][h],r[A]=H[u][I[u][h]],q.push(r),p[i][z]>I[u][h]?J.push(r):(J.push(p[i]),H[C[g].group][I[u][h]]=p[i][A],i+=1));else if(d._orderRules&&d._orderRules.length>0)J=p.concat(p[0]);else{p=p.sort(Q),J.push(p[0]),y=0;do y=R(p,J,y);while(J.length<=p.length&&(J[0].x!==J[J.length-1].x||J[0].y!==J[J.length-1].y))}q=q.reverse(),v=O(f,"_previousOrigin")(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f,"_previousOrigin")(q),x=O("linear","_previousOrigin")(J),C[g].entry=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),v=O(f)(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f)(q),x=O("linear")(J),C[g].update=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),v=O(f,"_origin")(J),w=O("step-after"===f?"step-before":"step-before"===f?"step-after":f,"_origin")(q),x=O("linear","_origin")(J),C[g].exit=v+(w&&w.length>0?"L"+w.substring(1):"")+(x&&x.length>0?"L"+x.substring(1,x.indexOf("L")):0),C[g].color=c.getColor(C[g].key.length>0?C[g].key[C[g].key.length-1]:"All")}null!==c._tooltipGroup&&void 0!==c._tooltipGroup&&c._tooltipGroup.remove(),D=null===d.shapes||void 0===d.shapes?c._group.selectAll("."+E).data(C):d.shapes.data(C,function(a){return a.key}),D.enter().append("path").attr("id",function(a){return a.key}).attr("class",function(a){return E+" dimple-line "+a.keyString}).attr("d",function(a){return a.entry}).call(function(){c.noFormats||this.attr("opacity",function(a){return G?1:a.color.opacity}).attr("fill",function(a){return G?"url(#fill-area-gradient-"+a.keyString+")":a.color.fill}).attr("stroke",function(a){return G?"url(#stroke-area-gradient-"+a.keyString+")":a.color.stroke}).attr("stroke-width",d.lineWeight)}).each(function(a){a.markerData=a.data,M(a)}),m=c._handleTransition(D,e,c).attr("d",function(a){return a.update}).each(function(a){a.markerData=a.data,M(a)}),n=c._handleTransition(D.exit(),e,c).attr("d",function(a){return a.exit}).each(function(a){a.markerData=[],M(a)}),b._postDrawHandling(d,m,n,e),d.shapes=D}},b.plot.bar={stacked:!0,grouped:!1,supportedAxes:["x","y","c"],draw:function(a,c,d){var e,f,g=c._positionData,h=null,i=["dimple-series-"+a.series.indexOf(c),"dimple-bar"],j=!c._isStacked()&&c.x._hasMeasure(),k=!c._isStacked()&&c.y._hasMeasure(),l="none";c.x._hasCategories()&&c.y._hasCategories()?l="both":c.x._hasCategories()?l="x":c.y._hasCategories()&&(l="y"),null!==a._tooltipGroup&&void 0!==a._tooltipGroup&&a._tooltipGroup.remove(),h=null===c.shapes||void 0===c.shapes?a._group.selectAll("."+i.join(".")).data(g):c.shapes.data(g,function(a){return a.key}),h.enter().append("rect").attr("id",function(a){return a.key}).attr("class",function(a){var c=[];return c=c.concat(a.aggField),c=c.concat(a.xField),c=c.concat(a.yField),i.join(" ")+" "+b._createClass(c)}).attr("x",function(d){var e=c.x._previousOrigin;return"x"===l?e=b._helpers.x(d,a,c):"both"===l&&(e=b._helpers.cx(d,a,c)),e}).attr("y",function(d){var e=c.y._previousOrigin;return"y"===l?e=b._helpers.y(d,a,c):"both"===l&&(e=b._helpers.cy(d,a,c)),e}).attr("width",function(d){return"x"===l?b._helpers.width(d,a,c):0}).attr("height",function(d){return"y"===l?b._helpers.height(d,a,c):0}).attr("opacity",function(d){return b._helpers.opacity(d,a,c)}).on("mouseover",function(d){b._showBarTooltip(d,this,a,c)}).on("mouseleave",function(d){b._removeTooltip(d,this,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),e=a._handleTransition(h,d,a,c).attr("x",function(d){return j?b._helpers.cx(d,a,c)-c.x.floatingBarWidth/2:b._helpers.x(d,a,c)}).attr("y",function(d){return k?b._helpers.cy(d,a,c)-c.y.floatingBarWidth/2:b._helpers.y(d,a,c)}).attr("width",function(d){return j?c.x.floatingBarWidth:b._helpers.width(d,a,c)}).attr("height",function(d){return k?c.y.floatingBarWidth:b._helpers.height(d,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),f=a._handleTransition(h.exit(),d,a,c).attr("x",function(d){var e=c.x._origin;return"x"===l?e=b._helpers.x(d,a,c):"both"===l&&(e=b._helpers.cx(d,a,c)),e}).attr("y",function(d){var e=c.y._origin;return"y"===l?e=b._helpers.y(d,a,c):"both"===l&&(e=b._helpers.cy(d,a,c)),e}).attr("width",function(d){return"x"===l?b._helpers.width(d,a,c):0}).attr("height",function(d){return"y"===l?b._helpers.height(d,a,c):0}),b._postDrawHandling(c,e,f,d),c.shapes=h}},b.plot.bubble={stacked:!1,grouped:!1,supportedAxes:["x","y","z","c"],draw:function(a,c,d){var e,f,g=c._positionData,h=null,i=["dimple-series-"+a.series.indexOf(c),"dimple-bubble"];null!==a._tooltipGroup&&void 0!==a._tooltipGroup&&a._tooltipGroup.remove(),h=null===c.shapes||void 0===c.shapes?a._group.selectAll("."+i.join(".")).data(g):c.shapes.data(g,function(a){return a.key}),h.enter().append("circle").attr("id",function(a){return a.key}).attr("class",function(a){var c=[];return c=c.concat(a.aggField),c=c.concat(a.xField),c=c.concat(a.yField),c=c.concat(a.zField),i.join(" ")+" "+b._createClass(c)}).attr("cx",function(d){return c.x._hasCategories()?b._helpers.cx(d,a,c):c.x._previousOrigin}).attr("cy",function(d){return c.y._hasCategories()?b._helpers.cy(d,a,c):c.y._previousOrigin}).attr("r",0).attr("opacity",function(d){return b._helpers.opacity(d,a,c)}).on("mouseover",function(d){b._showPointTooltip(d,this,a,c)}).on("mouseleave",function(d){b._removeTooltip(d,this,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),e=a._handleTransition(h,d,a,c).attr("cx",function(d){return b._helpers.cx(d,a,c)}).attr("cy",function(d){return b._helpers.cy(d,a,c)}).attr("r",function(d){return b._helpers.r(d,a,c)}).call(function(){a.noFormats||this.attr("fill",function(d){return b._helpers.fill(d,a,c)}).attr("stroke",function(d){return b._helpers.stroke(d,a,c)})}),f=a._handleTransition(h.exit(),d,a,c).attr("r",0).attr("cx",function(d){return c.x._hasCategories()?b._helpers.cx(d,a,c):c.x._origin}).attr("cy",function(d){return c.y._hasCategories()?b._helpers.cy(d,a,c):c.y._origin}),b._postDrawHandling(c,e,f,d),c.shapes=h}},b.plot.line={stacked:!1,grouped:!0,supportedAxes:["x","y","c"],draw:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p=d._positionData,q=[],r=null,s="dimple-series-"+c.series.indexOf(d),t=d.x._hasCategories()||d.y._hasCategories()?0:1,u=!1,v=function(){return function(c,d,e,f){a.select(d).style("opacity",1),b._showPointTooltip(c,d,e,f)}},w=function(c){return function(d,e,f,g){a.select(e).style("opacity",g.lineMarkers||c.data.length<2?b._helpers.opacity(d,f,g):0),b._removeTooltip(d,e,f,g)}},x=function(a){b._drawMarkers(a,c,d,e,s,u,v(a),w(a))},y=function(a,e){var f;return"step"===d.interpolation&&d[a]._hasCategories()?(d.barGap=0,d.clusterBarGap=0,f=b._helpers[a](e,c,d)+("y"===a?b._helpers.height(e,c,d):0)):f=b._helpers["c"+a](e,c,d),parseFloat(f.toFixed(1))},z=function(b,c){return a.svg.line().x(function(a){return d.x._hasCategories()||!c?a.x:d.x[c]}).y(function(a){return d.y._hasCategories()||!c?a.y:d.y[c]}).interpolate(b)};for(f="step"===d.interpolation?"step-after":d.interpolation,o=b._getSeriesOrder(d.data||c.data,d),d.c&&(d.x._hasCategories()&&d.y._hasMeasure()||d.y._hasCategories()&&d.x._hasMeasure())&&(u=!0),g=0;g1&&(d.x._hasCategories()?q[g].points.push({x:2*q[g].points[q[g].points.length-1].x-q[g].points[q[g].points.length-2].x,y:q[g].points[q[g].points.length-1].y}):d.y._hasCategories()&&(q[g].points=[{x:q[g].points[0].x,y:2*q[g].points[0].y-q[g].points[1].y}].concat(q[g].points))),q[g].entry=z(f,"_previousOrigin")(q[g].points),q[g].update=z(f)(q[g].points),q[g].exit=z(f,"_origin")(q[g].points),q[g].color=c.getColor(q[g].key.length>0?q[g].key[q[g].key.length-1]:"All")}null!==c._tooltipGroup&&void 0!==c._tooltipGroup&&c._tooltipGroup.remove(),r=null===d.shapes||void 0===d.shapes?c._group.selectAll("."+s).data(q):d.shapes.data(q,function(a){return a.key}),r.enter().append("path").attr("id",function(a){return a.key}).attr("class",function(a){return s+" dimple-line "+a.keyString}).attr("d",function(a){return a.entry}).call(function(){c.noFormats||this.attr("opacity",function(a){return u?1:a.color.opacity}).attr("fill","none").attr("stroke",function(a){return u?"url(#fill-line-gradient-"+a.keyString+")":a.color.stroke}).attr("stroke-width",d.lineWeight)}).each(function(a){a.markerData=a.data,x(a)}),m=c._handleTransition(r,e,c).attr("d",function(a){return a.update}).each(function(a){a.markerData=a.data,x(a)}),n=c._handleTransition(r.exit(),e,c).attr("d",function(a){return a.exit}).each(function(a){a.markerData=[],x(a)}),b._postDrawHandling(d,m,n,e),d.shapes=r}},b._addGradient=function(a,b,c,d,e,f,g){var h=[].concat(a),i=e._group.select("#"+b),j=[],k=c.position+"Field",l=!0,m=[];d.forEach(function(a){-1===j.indexOf(a[k])&&a.aggField.join("_")===h.join("_")&&j.push(a[k])},this),j=j.sort(function(a,b){return c._scale(a)-c._scale(b)}),null===i.node()&&(l=!1,i=e._group.append("linearGradient").attr("id",b).attr("gradientUnits","userSpaceOnUse").attr("x1","x"===c.position?c._scale(j[0])+e._widthPixels()/j.length/2:0).attr("y1","y"===c.position?c._scale(j[0])-e._heightPixels()/j.length/2:0).attr("x2","x"===c.position?c._scale(j[j.length-1])+e._widthPixels()/j.length/2:0).attr("y2","y"===c.position?c._scale(j[j.length-1])-e._heightPixels()/j.length/2:0)),j.forEach(function(a,b){var c={},e=0;for(e=0;e=65&&90>=b&&(c=a.toLowerCase()),c};if(a.length>0)for(b=0;bd.length/2?i.concat(e):b.values=d}else i.push(b.ordering)},this),e=b._rollUp(a,h,i),j.length>=1&&(j.forEach(function(a){var b=null===a.desc||void 0===a.desc?!1:a.desc,c=a.ordering,d=[],e=function(a){var b,c=0;for(b=0;bb[0]&&(c=1):c=Date.parse(a[0])-Date.parse(b[0]):c=parseFloat(d)-parseFloat(f),c};"function"==typeof c?f.push(function(a,d){return(b?-1:1)*c(a,d)}):a.values&&a.values.length>0?(a.values.forEach(function(a){d.push([].concat(a).join("|"))},this),f.push(function(a,c){var e,f,g,i="",j="";for(g=0;g0&&(i+="|",j+="|"),i+=a[h[g]],j+=c[h[g]];return e=d.indexOf(i),f=d.indexOf(j),e=0>e?b?-1:d.length:e,f=0>f?b?-1:d.length:f,(b?-1:1)*(e-f)})):[].concat(a.ordering).forEach(function(a){f.push(function(c,d){var e=0;return void 0!==c[a]&&void 0!==d[a]&&(e=g([].concat(c[a]),[].concat(d[a]))),(b?-1:1)*e})})}),e.sort(function(a,b){for(var c=0,d=0;c0&&(null!==c.c&&void 0!==c.c&&c.c._hasMeasure()&&d.push({ordering:c.c.measure,desc:!0}),c.x._hasMeasure()&&d.push({ordering:c.x.measure,desc:!0}),c.y._hasMeasure()&&d.push({ordering:c.y.measure,desc:!0}),f=b._getOrderedList(a,e,d)),f},b._getSeriesSortPredicate=function(a,c,d){return function(e,f){var g=0;return c.x._hasCategories()&&(g=b._helpers.cx(e,a,c)-b._helpers.cx(f,a,c)),0===g&&c.y._hasCategories()&&(g=b._helpers.cy(e,a,c)-b._helpers.cy(f,a,c)),0===g&&d&&(g=b._arrayIndexCompare(d,e.aggField,f.aggField)),g}},b._helpers={cx:function(a,c,d){var e=0;return e=null!==d.x.measure&&void 0!==d.x.measure?d.x._scale(a.cx):d.x._hasCategories()&&d.x.categoryFields.length>=2?d.x._scale(a.cx)+b._helpers.xGap(c,d)+(a.xOffset+.5)*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))*a.width:d.x._scale(a.cx)+c._widthPixels()/d.x._max/2},cy:function(a,c,d){var e=0;return e=null!==d.y.measure&&void 0!==d.y.measure?d.y._scale(a.cy):null!==d.y.categoryFields&&void 0!==d.y.categoryFields&&d.y.categoryFields.length>=2?d.y._scale(a.cy)-c._heightPixels()/d.y._max+b._helpers.yGap(c,d)+(a.yOffset+.5)*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))*a.height:d.y._scale(a.cy)-c._heightPixels()/d.y._max/2},r:function(a,b,c){var d=0,e=1;return null===c.z||void 0===c.z?d=c.radius&&"auto"!==c.radius?c.radius:5:(c.radius&&"auto"!==c.radius&&c.radius>1&&(e=c.radius/c.z._scale(c.z._max)),d=c.z._hasMeasure()?c.z._scale(a.r)*e:c.z._scale(b._heightPixels()/100)*e),d},xGap:function(a,b){var c=0;return(null===b.x.measure||void 0===b.x.measure)&&b.barGap>0&&(c=a._widthPixels()/b.x._max*(b.barGap>.99?.99:b.barGap)/2),c},xClusterGap:function(a,c,d){var e=0;return null!==d.x.categoryFields&&void 0!==d.x.categoryFields&&d.x.categoryFields.length>=2&&d.clusterBarGap>0&&!d.x._hasMeasure()&&(e=a.width*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))*(d.clusterBarGap>.99?.99:d.clusterBarGap)/2),e},yGap:function(a,b){var c=0;return(null===b.y.measure||void 0===b.y.measure)&&b.barGap>0&&(c=a._heightPixels()/b.y._max*(b.barGap>.99?.99:b.barGap)/2),c},yClusterGap:function(a,c,d){var e=0;return null!==d.y.categoryFields&&void 0!==d.y.categoryFields&&d.y.categoryFields.length>=2&&d.clusterBarGap>0&&!d.y._hasMeasure()&&(e=a.height*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))*(d.clusterBarGap>.99?.99:d.clusterBarGap)/2),e},x:function(a,c,d){var e=0;return e=d.x._hasTimeField()?d.x._scale(a.x)-b._helpers.width(a,c,d)/2:null!==d.x.measure&&void 0!==d.x.measure?d.x._scale(a.x):d.x._scale(a.x)+b._helpers.xGap(c,d)+a.xOffset*(b._helpers.width(a,c,d)+2*b._helpers.xClusterGap(a,c,d))+b._helpers.xClusterGap(a,c,d)},y:function(a,c,d){var e=0;return e=d.y._hasTimeField()?d.y._scale(a.y)-b._helpers.height(a,c,d)/2:null!==d.y.measure&&void 0!==d.y.measure?d.y._scale(a.y):d.y._scale(a.y)-c._heightPixels()/d.y._max+b._helpers.yGap(c,d)+a.yOffset*(b._helpers.height(a,c,d)+2*b._helpers.yClusterGap(a,c,d))+b._helpers.yClusterGap(a,c,d)},width:function(a,c,d){var e=0;return e=null!==d.x.measure&&void 0!==d.x.measure?Math.abs(d.x._scale(a.x<0?a.x-a.width:a.x+a.width)-d.x._scale(a.x)):d.x._hasTimeField()?d.x.floatingBarWidth:a.width*(c._widthPixels()/d.x._max-2*b._helpers.xGap(c,d))-2*b._helpers.xClusterGap(a,c,d)},height:function(a,c,d){var e=0;return e=d.y._hasTimeField()?d.y.floatingBarWidth:null!==d.y.measure&&void 0!==d.y.measure?Math.abs(d.y._scale(a.y)-d.y._scale(a.y<=0?a.y+a.height:a.y-a.height)):a.height*(c._heightPixels()/d.y._max-2*b._helpers.yGap(c,d))-2*b._helpers.yClusterGap(a,c,d)},opacity:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.opacity:b.getColor(a.aggField.slice(-1)[0]).opacity},fill:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.fill:b.getColor(a.aggField.slice(-1)[0]).fill},stroke:function(a,b,c){var d=0;return d=null!==c.c&&void 0!==c.c?a.stroke:b.getColor(a.aggField.slice(-1)[0]).stroke}},b._parentHeight=function(a){var c=a.offsetHeight;return(0>=c||null===c||void 0===c)&&(c=a.clientHeight),(0>=c||null===c||void 0===c)&&(c=null===a.parentNode||void 0===a.parentNode?0:b._parentHeight(a.parentNode)),c},b._parentWidth=function(a){var c=a.offsetWidth;return(0>=c||null===c||void 0===c)&&(c=a.clientWidth),(0>=c||null===c||void 0===c)&&(c=null===a.parentNode||void 0===a.parentNode?0:b._parentWidth(a.parentNode)),c},b._parseXPosition=function(a,c){var d,e=0;return null!==a&&void 0!==a&&(d=a.toString().split(","),d.forEach(function(d){void 0!==d&&null!==d&&(isNaN(d)?"%"===d.slice(-1)?e+=b._parentWidth(c)*(parseFloat(d.slice(0,d.length-1))/100):"px"===d.slice(-2)?e+=parseFloat(d.slice(0,d.length-2)):e=a:e+=parseFloat(d))},this)),0>e&&(e=b._parentWidth(c)+e),e},b._parseYPosition=function(a,c){var d,e=0;return null!==a&&void 0!==a&&(d=a.toString().split(","),d.forEach(function(d){void 0!==d&&null!==d&&(isNaN(d)?"%"===d.slice(-1)?e+=b._parentHeight(c)*(parseFloat(d.slice(0,d.length-1))/100):"px"===d.slice(-2)?e+=parseFloat(d.slice(0,d.length-2)):e=a:e+=parseFloat(d))},this)),0>e&&(e=b._parentHeight(c)+e),e},b._postDrawHandling=function(b,c,d,e){0===e?(c.each(function(a,c){null!==b.afterDraw&&void 0!==b.afterDraw&&b.afterDraw(this,a,c)}),d.remove()):(c.each("end",function(a,c){null!==b.afterDraw&&void 0!==b.afterDraw&&b.afterDraw(this,a,c)}),d.each("end",function(){a.select(this).remove()}))},b._removeTooltip=function(a,b,c){c._tooltipGroup&&c._tooltipGroup.remove()},b._rollUp=function(a,b,c){var d=[];return b=null!==b&&void 0!==b?[].concat(b):[],a.forEach(function(a){var e=-1,f={},g=!0;d.forEach(function(c,d){-1===e&&(g=!0,b.forEach(function(b){g=g&&a[b]===c[b]},this),g&&(e=d))},this),-1!==e?f=d[e]:(b.forEach(function(b){f[b]=a[b]},this),d.push(f),e=d.length-1),c.forEach(function(c){-1===b.indexOf(c)&&(void 0===f[c]&&(f[c]=[]),f[c]=f[c].concat(a[c]))},this),d[e]=f},this),d},b._showBarTooltip=function(b,c,d,e){var f,g,h,i,j,k=5,l=10,m=750,n=a.select(c),o=parseFloat(n.attr("x")),p=parseFloat(n.attr("y")),q=parseFloat(n.attr("width")),r=parseFloat(n.attr("height")),s=n.attr("opacity"),t=n.attr("fill"),u=e._dropLineOrigin(),v=a.rgb(a.rgb(t).r+.6*(255-a.rgb(t).r),a.rgb(t).g+.6*(255-a.rgb(t).g),a.rgb(t).b+.6*(255-a.rgb(t).b)),w=a.rgb(a.rgb(t).r+.8*(255-a.rgb(t).r),a.rgb(t).g+.8*(255-a.rgb(t).g),a.rgb(t).b+.8*(255-a.rgb(t).b)),x=e.getTooltipText(b),y=0,z=0,A=0;null!==d._tooltipGroup&&void 0!==d._tooltipGroup&&d._tooltipGroup.remove(),d._tooltipGroup=d.svg.append("g"),j=e._isStacked()?1:q/2,e.x._hasCategories()||null===u.y||d._tooltipGroup.append("line").attr("x1",oz?this.getBBox().width:z,A=this.getBBox().width>A?this.getBBox().height:A}),f.selectAll("text").attr("x",0).attr("y",function(){return y+=this.getBBox().height,y-this.getBBox().height/2}),g.attr("x",-k).attr("y",-k).attr("height",Math.floor(y+k)-.5).attr("width",z+2*k).attr("rx",5).attr("ry",5).style("fill",w).style("stroke",v).style("stroke-width",2).style("opacity",.95),o+q+k+l+z0?(h=o-(k+l+z),i=p+r/2-(y-(A-k))/2):p+r+y+l+k0?h:l,h=h+z0?h:l,h=h+zx?this.getBBox().width:x,y=this.getBBox().width>y?this.getBBox().height:y}),g.selectAll("text").attr("x",0).attr("y",function(){return w+=this.getBBox().height,w-this.getBBox().height/2}),h.attr("x",-k).attr("y",-k).attr("height",Math.floor(w+k)-.5).attr("width",x+2*k).attr("rx",5).attr("ry",5).style("fill",v).style("stroke",u).style("stroke-width",2).style("opacity",.95),o+q+k+l+x0?(i=o-q-(k+l+x),j=p-(w-(y-k))/2):p+q+w+l+k0?i:l,i=i+x0?i:l,i=i+x-1&&d.push(a)},this)),d},b.getUniqueValues=function(a,b){var c=[];return null!==b&&void 0!==b&&(b=[].concat(b),a.forEach(function(a){var d="";b.forEach(function(b,c){c>0&&(d+="/"),d+=a[b]},this),-1===c.indexOf(d)&&c.push(d)},this)),c},b.newSvg=function(b,c,d){var e=null;if((null===b||void 0===b)&&(b="body"),e=a.select(b),e.empty())throw"The '"+b+"' selector did not match any elements. Please prefix with '#' to select by id or '.' to select by class";return e.append("svg").attr("width",c).attr("height",d)},b}); \ No newline at end of file diff --git a/src/methods/_getOrderedList.js b/src/methods/_getOrderedList.js index 2de505b..8411d1d 100644 --- a/src/methods/_getOrderedList.js +++ b/src/methods/_getOrderedList.js @@ -60,7 +60,7 @@ i; for (i = 0; i < array.length; i += 1) { if (isNaN(array[i])) { - total = 0; + total = undefined; break; } else { total += parseFloat(array[i]); @@ -72,7 +72,7 @@ var result = 0, sumA = sum(a), sumB = sum(b); - if (!isNaN(sumA) && sumA !== 0 && !isNaN(sumB) && sumB !== 0) { + if (!isNaN(sumA) && !isNaN(sumB)) { result = parseFloat(sumA) - parseFloat(sumB); } else if (!isNaN(Date.parse(a[0])) && !isNaN(Date.parse(b[0]))) { result = Date.parse(a[0]) - Date.parse(b[0]); diff --git a/test/methods/_getOrderList.spec.js b/test/methods/_getOrderList.spec.js index 368da61..f99363a 100644 --- a/test/methods/_getOrderList.spec.js +++ b/test/methods/_getOrderList.spec.js @@ -12,7 +12,7 @@ define(["dimple"], function (dimple) { { "Int": 1, "Float": 234, "Text": "XFBGR", "Date": "12/5/99", "Group": "A"}, { "Int": 2, "Float": 54.35, "Text": "YTREB", "Date": "1/1/00", "Group": "A"}, { "Int": 3, "Float": -453, "Text": "XGFDY", "Date": "2 February 2007", "Group": "B"}, - { "Int": 4, "Float": 5436546, "Text": "XGFDE", "Date": "2000-03-01", "Group": "B"}, + { "Int": 0, "Float": 5436546, "Text": "XGFDE", "Date": "2000-03-01", "Group": "B"}, { "Int": 5, "Float": 4323, "Text": "YTREB", "Date": "10/10/2000", "Group": "C"}, { "Int": 6, "Float": 0, "Text": "GFDHN", "Date": "11/10/2000", "Group": "C"}, { "Int": 7, "Float": -453, "Text": "TRET", "Date": "10/9/2000", "Group": "D"}, @@ -31,7 +31,7 @@ define(["dimple"], function (dimple) { it("Implicitly orders by a single dimension", function () { expect(getResults(data, "Int")) - .toEqual("1, 2, 3, 4, 5, 6, 7"); + .toEqual("0, 1, 2, 3, 5, 6, 7"); expect(getResults(data, "Float")) .toEqual("-453, 0, 54.35, 234, 4323, 5436546"); expect(getResults(data, "Text")) @@ -42,7 +42,7 @@ define(["dimple"], function (dimple) { it("Explicitly orders by a single dimension", function () { expect(getResults(data, "Int", { ordering : "Int" })) - .toEqual("1, 2, 3, 4, 5, 6, 7"); + .toEqual("0, 1, 2, 3, 5, 6, 7"); expect(getResults(data, "Float", { ordering : "Float" })) .toEqual("-453, 0, 54.35, 234, 4323, 5436546"); expect(getResults(data, "Text", { ordering : "Text" })) @@ -53,7 +53,7 @@ define(["dimple"], function (dimple) { it("Orders descending by a single dimension", function () { expect(getResults(data, "Int", { ordering : "Int", desc : true })) - .toEqual("7, 6, 5, 4, 3, 2, 1"); + .toEqual("7, 6, 5, 3, 2, 1, 0"); expect(getResults(data, "Float", { ordering : "Float", desc : true })) .toEqual("5436546, 4323, 234, 54.35, 0, -453"); expect(getResults(data, "Text", { ordering : "Text", desc : true })) @@ -63,22 +63,22 @@ define(["dimple"], function (dimple) { }); it("Orders by a passed array", function () { - expect(getResults(data, "Int", { ordering : [3, 7, 4, 5, 2, 1, 6] })) - .toEqual("3, 7, 4, 5, 2, 1, 6"); - expect(getResults(data, "Int", { ordering : [3, 7, 4, 5, 2, 1, 6], desc : true })) - .toEqual("6, 1, 2, 5, 4, 7, 3"); - expect(getResults(data, "Int", { ordering : [3, 7, 4] })) - .toEqual("3, 7, 4, 1, 2, 5, 6"); - expect(getResults(data, "Int", { ordering : [3, 7, 4], desc : true })) - .toEqual("4, 7, 3, 1, 2, 5, 6"); - expect(getResults(data, "Int", { ordering : ["3", "7", "4", "5", "2", "1", "6"] })) - .toEqual("3, 7, 4, 5, 2, 1, 6"); - expect(getResults(data, "Int", { ordering : ["3", "7", "4", "5", "2", "1", "6"], desc : true })) - .toEqual("6, 1, 2, 5, 4, 7, 3"); - expect(getResults(data, "Int", { ordering : ["3", "7", "4"] })) - .toEqual("3, 7, 4, 1, 2, 5, 6"); - expect(getResults(data, "Int", { ordering : ["3", "7", "4"], desc : true })) - .toEqual("4, 7, 3, 1, 2, 5, 6"); + expect(getResults(data, "Int", { ordering : [3, 7, 0, 5, 2, 1, 6] })) + .toEqual("3, 7, 0, 5, 2, 1, 6"); + expect(getResults(data, "Int", { ordering : [3, 7, 0, 5, 2, 1, 6], desc : true })) + .toEqual("6, 1, 2, 5, 0, 7, 3"); + expect(getResults(data, "Int", { ordering : [3, 7, 0] })) + .toEqual("3, 7, 0, 1, 2, 5, 6"); + expect(getResults(data, "Int", { ordering : [3, 7, 0], desc : true })) + .toEqual("0, 7, 3, 1, 2, 5, 6"); + expect(getResults(data, "Int", { ordering : ["3", "7", "0", "5", "2", "1", "6"] })) + .toEqual("3, 7, 0, 5, 2, 1, 6"); + expect(getResults(data, "Int", { ordering : ["3", "7", "0", "5", "2", "1", "6"], desc : true })) + .toEqual("6, 1, 2, 5, 0, 7, 3"); + expect(getResults(data, "Int", { ordering : ["3", "7", "0"] })) + .toEqual("3, 7, 0, 1, 2, 5, 6"); + expect(getResults(data, "Int", { ordering : ["3", "7", "0"], desc : true })) + .toEqual("0, 7, 3, 1, 2, 5, 6"); }); it("Orders by a custom function", function () { @@ -90,9 +90,9 @@ define(["dimple"], function (dimple) { it("Orders by a second category", function () { expect(getResults(data, "Int", { ordering : "Text" })) - .toEqual("6, 7, 1, 4, 3, 2, 5"); + .toEqual("6, 7, 1, 0, 3, 2, 5"); expect(getResults(data, "Int", { ordering : "Text", desc : true })) - .toEqual("2, 5, 3, 4, 1, 7, 6"); + .toEqual("2, 5, 3, 0, 1, 7, 6"); expect(getResults(data, "Group", { ordering : "Float" })) .toEqual("D, A, C, B, E"); expect(getResults(data, "Group", { ordering : "Float", desc : true })) @@ -101,13 +101,13 @@ define(["dimple"], function (dimple) { it("Orders by a third category", function () { expect(getResults(data, "Int", [{ ordering : "Group" }, { ordering : "Float" }])) - .toEqual("2, 1, 3, 4, 6, 5, 7"); + .toEqual("2, 1, 3, 0, 6, 5, 7"); expect(getResults(data, "Int", [{ ordering : "Group", desc : true}, { ordering : "Float" }])) - .toEqual("7, 6, 5, 3, 4, 2, 1"); + .toEqual("7, 6, 5, 3, 0, 2, 1"); expect(getResults(data, "Int", [{ ordering : "Group"}, { ordering : "Float", desc : true }])) - .toEqual("1, 2, 4, 3, 5, 6, 7"); + .toEqual("1, 2, 0, 3, 5, 6, 7"); expect(getResults(data, "Int", [{ ordering : "Group", desc : true}, { ordering : "Float", desc : true }])) - .toEqual("7, 5, 6, 4, 3, 1, 2"); + .toEqual("7, 5, 6, 0, 3, 1, 2"); }); }); }); \ No newline at end of file