diff --git a/examples/pie.html b/examples/pie.html new file mode 100644 index 0000000..f835b45 --- /dev/null +++ b/examples/pie.html @@ -0,0 +1,25 @@ + + + + + + + + + + + +

Pie Chart

+
+
+Morris.Donut({
+  element: 'graph',
+  data: [
+    {value: 70, label: 'foo'},
+    {value: 15, label: 'bar'},
+    {value: 10, label: 'baz'},
+    {value: 5, label: 'A really really long label'}
+  ]
+});
+
+ diff --git a/lib/morris.coffee b/lib/morris.coffee index b0fb615..dc8bb60 100644 --- a/lib/morris.coffee +++ b/lib/morris.coffee @@ -3,6 +3,20 @@ $ = jQuery Morris = {} + +class Morris.EventEmitter + on: (name, handler) -> + unless @handlers? + @handlers = {} + unless @handlers[name]? + @handlers[name] = [] + @handlers[name].push(handler) + + fire: (name, args...) -> + if @handlers? and @handlers[name]? + for handler in @handlers[name] + handler(args...) + class Morris.Line # Initialise the graph. # @@ -593,5 +607,149 @@ Morris.AUTO_LABEL_ORDER = [ "30sec", "15sec", "10sec", "5sec", "second" ] +class Morris.Donut + colors: [ + '#0B62A4' + '#3980B5' + '#679DC6' + '#95BBD7' + '#B0CCE1' + '#095791' + '#095085' + '#083E67' + '#052C48' + '#042135' + ] + + constructor: (options) -> + if not (this instanceof Morris.Donut) + return new Morris.Donut(options) + + if typeof options.element is 'string' + @el = $ document.getElementById(options.element) + else + @el = $ options.element + + if options.colors? + @colors = options.colors + + if @el == null || @el.length == 0 + throw new Error("Graph placeholder not found.") + + # bail if there's no data + if options.data is undefined or options.data.length is 0 + return + @data = options.data + + @el.addClass 'graph-initialised' + + # the raphael drawing instance + @r = new Raphael(@el[0]) + + @draw() + + draw: -> + cx = @el.width() / 2 + cy = @el.height() / 2 + w = (Math.min(cx, cy) - 10) / 3 + + total = 0 + total += x.value for x in @data + + min = 5 / (2 * w) + C = 1.9999 * Math.PI - min * @data.length + + last = 0 + idx = 0 + @segments = [] + for d in @data + next = last + min + C * (d.value / total) + seg = new Morris.DonutSegment(cx, cy, w*2, w, last, next, @colors[idx % @colors.length], d) + seg.render @r + @segments.push seg + seg.on 'hover', @select + last = next + idx += 1 + @text1 = @r.text(cx, cy - 10, '').attr('font-size': 15, 'font-weight': 800) + @text2 = @r.text(cx, cy + 10, '').attr('font-size': 14) + max_value = Math.max.apply(null, d.value for d in @data) + idx = 0 + for d in @data + if d.value == max_value + @select @segments[idx] + break + idx += 1 + + select: (segment) => + s.deselect() for s in @segments + segment.select() + @setLabels segment.data.label, Morris.commas(segment.data.value) + + setLabels: (label1, label2) -> + inner = (Math.min(@el.width() / 2, @el.height() / 2) - 10) * 2 / 3 + maxWidth = 1.8 * inner + maxHeightTop = inner / 2 + maxHeightBottom = inner / 3 + @text1.attr(text: label1, transform: '') + text1bbox = @text1.getBBox() + text1scale = Math.min(maxWidth / text1bbox.width, maxHeightTop / text1bbox.height) + @text1.attr(transform: "S#{text1scale},#{text1scale},#{text1bbox.x + text1bbox.width / 2},#{text1bbox.y + text1bbox.height}") + @text2.attr(text: label2, transform: '') + text2bbox = @text2.getBBox() + text2scale = Math.min(maxWidth / text2bbox.width, maxHeightBottom / text2bbox.height) + @text2.attr(transform: "S#{text2scale},#{text2scale},#{text2bbox.x + text2bbox.width / 2},#{text2bbox.y}") + +class Morris.DonutSegment extends Morris.EventEmitter + constructor: (@cx, @cy, @inner, @outer, p0, p1, @color, @data) -> + @sin_p0 = Math.sin(p0) + @cos_p0 = Math.cos(p0) + @sin_p1 = Math.sin(p1) + @cos_p1 = Math.cos(p1) + @long = if (p1 - p0) > Math.PI then 1 else 0 + @path = @calcSegment(@inner + 3, @inner + @outer - 5) + @selectedPath = @calcSegment(@inner + 3, @inner + @outer) + @hilight = @calcArc(@inner) + + calcArcPoints: (r) -> + return [ + @cx + r * @sin_p0, + @cy + r * @cos_p0, + @cx + r * @sin_p1, + @cy + r * @cos_p1] + + calcSegment: (r1, r2) -> + [ix0, iy0, ix1, iy1] = @calcArcPoints(r1) + [ox0, oy0, ox1, oy1] = @calcArcPoints(r2) + return ( + "M#{ix0},#{iy0}" + + "A#{r1},#{r1},0,#{@long},0,#{ix1},#{iy1}" + + "L#{ox1},#{oy1}" + + "A#{r2},#{r2},0,#{@long},1,#{ox0},#{oy0}" + + "Z") + + calcArc: (r) -> + [ix0, iy0, ix1, iy1] = @calcArcPoints(r) + return ( + "M#{ix0},#{iy0}" + + "A#{r},#{r},0,#{@long},0,#{ix1},#{iy1}") + + render: (r) -> + @arc = r.path(@hilight).attr(stroke: @color, 'stroke-width': 2, opacity: 0) + @seg = r.path(@path) + .attr(fill: @color, stroke: 'white', 'stroke-width': 3) + .hover(=> @fire('hover', @)) + + select: => + unless @selected + @seg.animate(path: @selectedPath, 150, '<>') + @arc.animate(opacity: 1, 150, '<>') + @selected = true + + deselect: => + if @selected + @seg.animate(path: @path, 150, '<>') + @arc.animate(opacity: 0, 150, '<>') + @selected = false + window.Morris = Morris # vim: set et ts=2 sw=2 sts=2 diff --git a/morris.js b/morris.js index 8fc6962..5c20c64 100644 --- a/morris.js +++ b/morris.js @@ -1,11 +1,46 @@ (function() { var $, Morris, minutesSpecHelper, secondsSpecHelper, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + __slice = [].slice, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; $ = jQuery; Morris = {}; + Morris.EventEmitter = (function() { + + function EventEmitter() {} + + EventEmitter.prototype.on = function(name, handler) { + if (this.handlers == null) { + this.handlers = {}; + } + if (this.handlers[name] == null) { + this.handlers[name] = []; + } + return this.handlers[name].push(handler); + }; + + EventEmitter.prototype.fire = function() { + var args, handler, name, _i, _len, _ref, _results; + name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if ((this.handlers != null) && (this.handlers[name] != null)) { + _ref = this.handlers[name]; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + handler = _ref[_i]; + _results.push(handler.apply(null, args)); + } + return _results; + } + }; + + return EventEmitter; + + })(); + Morris.Line = (function() { function Line(options) { @@ -707,6 +742,220 @@ Morris.AUTO_LABEL_ORDER = ["year", "month", "day", "hour", "30min", "15min", "10min", "5min", "minute", "30sec", "15sec", "10sec", "5sec", "second"]; + Morris.Donut = (function() { + + Donut.prototype.colors = ['#0B62A4', '#3980B5', '#679DC6', '#95BBD7', '#B0CCE1', '#095791', '#095085', '#083E67', '#052C48', '#042135']; + + function Donut(options) { + this.select = __bind(this.select, this); + if (!(this instanceof Morris.Donut)) { + return new Morris.Donut(options); + } + if (typeof options.element === 'string') { + this.el = $(document.getElementById(options.element)); + } else { + this.el = $(options.element); + } + if (options.colors != null) { + this.colors = options.colors; + } + if (this.el === null || this.el.length === 0) { + throw new Error("Graph placeholder not found."); + } + if (options.data === void 0 || options.data.length === 0) { + return; + } + this.data = options.data; + this.el.addClass('graph-initialised'); + this.r = new Raphael(this.el[0]); + this.draw(); + } + + Donut.prototype.draw = function() { + var C, cx, cy, d, idx, last, max_value, min, next, seg, total, w, x, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results; + cx = this.el.width() / 2; + cy = this.el.height() / 2; + w = (Math.min(cx, cy) - 10) / 3; + total = 0; + _ref = this.data; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + x = _ref[_i]; + total += x.value; + } + min = 5 / (2 * w); + C = 1.9999 * Math.PI - min * this.data.length; + last = 0; + idx = 0; + this.segments = []; + _ref1 = this.data; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + d = _ref1[_j]; + next = last + min + C * (d.value / total); + seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.colors[idx % this.colors.length], d); + seg.render(this.r); + this.segments.push(seg); + seg.on('hover', this.select); + last = next; + idx += 1; + } + this.text1 = this.r.text(cx, cy - 10, '').attr({ + 'font-size': 15, + 'font-weight': 800 + }); + this.text2 = this.r.text(cx, cy + 10, '').attr({ + 'font-size': 14 + }); + max_value = Math.max.apply(null, (function() { + var _k, _len2, _ref2, _results; + _ref2 = this.data; + _results = []; + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + d = _ref2[_k]; + _results.push(d.value); + } + return _results; + }).call(this)); + idx = 0; + _ref2 = this.data; + _results = []; + for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { + d = _ref2[_k]; + if (d.value === max_value) { + this.select(this.segments[idx]); + break; + } + _results.push(idx += 1); + } + return _results; + }; + + Donut.prototype.select = function(segment) { + var s, _i, _len, _ref; + _ref = this.segments; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + s = _ref[_i]; + s.deselect(); + } + segment.select(); + return this.setLabels(segment.data.label, Morris.commas(segment.data.value)); + }; + + Donut.prototype.setLabels = function(label1, label2) { + var inner, maxHeightBottom, maxHeightTop, maxWidth, text1bbox, text1scale, text2bbox, text2scale; + inner = (Math.min(this.el.width() / 2, this.el.height() / 2) - 10) * 2 / 3; + maxWidth = 1.8 * inner; + maxHeightTop = inner / 2; + maxHeightBottom = inner / 3; + this.text1.attr({ + text: label1, + transform: '' + }); + text1bbox = this.text1.getBBox(); + text1scale = Math.min(maxWidth / text1bbox.width, maxHeightTop / text1bbox.height); + this.text1.attr({ + transform: "S" + text1scale + "," + text1scale + "," + (text1bbox.x + text1bbox.width / 2) + "," + (text1bbox.y + text1bbox.height) + }); + this.text2.attr({ + text: label2, + transform: '' + }); + text2bbox = this.text2.getBBox(); + text2scale = Math.min(maxWidth / text2bbox.width, maxHeightBottom / text2bbox.height); + return this.text2.attr({ + transform: "S" + text2scale + "," + text2scale + "," + (text2bbox.x + text2bbox.width / 2) + "," + text2bbox.y + }); + }; + + return Donut; + + })(); + + Morris.DonutSegment = (function(_super) { + + __extends(DonutSegment, _super); + + function DonutSegment(cx, cy, inner, outer, p0, p1, color, data) { + this.cx = cx; + this.cy = cy; + this.inner = inner; + this.outer = outer; + this.color = color; + this.data = data; + this.deselect = __bind(this.deselect, this); + + this.select = __bind(this.select, this); + + this.sin_p0 = Math.sin(p0); + this.cos_p0 = Math.cos(p0); + this.sin_p1 = Math.sin(p1); + this.cos_p1 = Math.cos(p1); + this.long = (p1 - p0) > Math.PI ? 1 : 0; + this.path = this.calcSegment(this.inner + 3, this.inner + this.outer - 5); + this.selectedPath = this.calcSegment(this.inner + 3, this.inner + this.outer); + this.hilight = this.calcArc(this.inner); + } + + DonutSegment.prototype.calcArcPoints = function(r) { + return [this.cx + r * this.sin_p0, this.cy + r * this.cos_p0, this.cx + r * this.sin_p1, this.cy + r * this.cos_p1]; + }; + + DonutSegment.prototype.calcSegment = function(r1, r2) { + var ix0, ix1, iy0, iy1, ox0, ox1, oy0, oy1, _ref, _ref1; + _ref = this.calcArcPoints(r1), ix0 = _ref[0], iy0 = _ref[1], ix1 = _ref[2], iy1 = _ref[3]; + _ref1 = this.calcArcPoints(r2), ox0 = _ref1[0], oy0 = _ref1[1], ox1 = _ref1[2], oy1 = _ref1[3]; + return ("M" + ix0 + "," + iy0) + ("A" + r1 + "," + r1 + ",0," + this.long + ",0," + ix1 + "," + iy1) + ("L" + ox1 + "," + oy1) + ("A" + r2 + "," + r2 + ",0," + this.long + ",1," + ox0 + "," + oy0) + "Z"; + }; + + DonutSegment.prototype.calcArc = function(r) { + var ix0, ix1, iy0, iy1, _ref; + _ref = this.calcArcPoints(r), ix0 = _ref[0], iy0 = _ref[1], ix1 = _ref[2], iy1 = _ref[3]; + return ("M" + ix0 + "," + iy0) + ("A" + r + "," + r + ",0," + this.long + ",0," + ix1 + "," + iy1); + }; + + DonutSegment.prototype.render = function(r) { + var _this = this; + this.arc = r.path(this.hilight).attr({ + stroke: this.color, + 'stroke-width': 2, + opacity: 0 + }); + return this.seg = r.path(this.path).attr({ + fill: this.color, + stroke: 'white', + 'stroke-width': 3 + }).hover(function() { + return _this.fire('hover', _this); + }); + }; + + DonutSegment.prototype.select = function() { + if (!this.selected) { + this.seg.animate({ + path: this.selectedPath + }, 150, '<>'); + this.arc.animate({ + opacity: 1 + }, 150, '<>'); + return this.selected = true; + } + }; + + DonutSegment.prototype.deselect = function() { + if (this.selected) { + this.seg.animate({ + path: this.path + }, 150, '<>'); + this.arc.animate({ + opacity: 0 + }, 150, '<>'); + return this.selected = false; + } + }; + + return DonutSegment; + + })(Morris.EventEmitter); + window.Morris = Morris; }).call(this); diff --git a/morris.min.js b/morris.min.js index 1b5eea9..71110ed 100644 --- a/morris.min.js +++ b/morris.min.js @@ -1 +1 @@ -(function(){var a,b,c,d,e=function(a,b){return function(){return a.apply(b,arguments)}};a=jQuery,b={},b.Line=function(){function c(c){this.updateHilight=e(this.updateHilight,this),this.hilight=e(this.hilight,this),this.updateHover=e(this.updateHover,this),this.transY=e(this.transY,this),this.transX=e(this.transX,this);var d,f=this;if(!(this instanceof b.Line))return new b.Line(c);typeof c.element=="string"?this.el=a(document.getElementById(c.element)):this.el=a(c.element);if(this.el===null||this.el.length===0)throw new Error("Graph placeholder not found.");this.options=a.extend({},this.defaults,c),typeof this.options.units=="string"&&(this.options.postUnits=c.units);if(this.options.data===void 0||this.options.data.length===0)return;this.el.addClass("graph-initialised"),this.r=new Raphael(this.el[0]),this.pointGrow=Raphael.animation({r:this.options.pointSize+3},25,"linear"),this.pointShrink=Raphael.animation({r:this.options.pointSize},25,"linear"),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.prevHilight=null,this.el.mousemove(function(a){return f.updateHilight(a.pageX)}),this.options.hideHover&&this.el.mouseout(function(a){return f.hilight(null)}),d=function(a){var b;return b=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],f.updateHilight(b.pageX),b},this.el.bind("touchstart",d),this.el.bind("touchmove",d),this.el.bind("touchend",d),this.seriesLabels=this.options.labels,this.setData(this.options.data)}return c.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],ymax:"auto",ymin:"auto 0",marginTop:25,marginRight:25,marginBottom:30,marginLeft:25,numLines:5,gridLineColor:"#aaa",gridTextColor:"#888",gridTextSize:12,gridStrokeWidth:.5,hoverPaddingX:10,hoverPaddingY:5,hoverMargin:10,hoverFillColor:"#fff",hoverBorderColor:"#ccc",hoverBorderWidth:2,hoverOpacity:.95,hoverLabelColor:"#444",hoverFontSize:12,smooth:!0,hideHover:!1,parseTime:!0,preUnits:"",postUnits:"",dateFormat:function(a){return(new Date(a)).toString()},xLabels:"auto",xLabelFormat:null},c.prototype.setData=function(c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=this;d==null&&(d=!0),this.options.data=c.slice(0),this.options.data.sort(function(a,b){return(a[s.options.xkey]=0;q<=0?a++:a--)r.push(a);return r}.apply(this),this.options.parseTime&&(this.columnLabels=a.map(this.columnLabels,function(a){return typeof a=="number"?s.options.dateFormat(a):a})),this.xmin=Math.min.apply(null,this.xvals),this.xmax=Math.max.apply(null,this.xvals),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),typeof this.options.ymax=="string"&&this.options.ymax.slice(0,4)==="auto"?(h=Math.max.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymax.length>5?this.ymax=Math.max(parseInt(this.options.ymax.slice(5),10),h):this.ymax=h):typeof this.options.ymax=="string"?this.ymax=parseInt(this.options.ymax,10):this.ymax=this.options.ymax,typeof this.options.ymin=="string"&&this.options.ymin.slice(0,4)==="auto"?(i=Math.min.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymin.length>5?this.ymin=Math.min(parseInt(this.options.ymin.slice(5),10),i):this.ymin=i):typeof this.options.ymin=="string"?this.ymin=parseInt(this.options.ymin,10):this.ymin=this.options.ymin,this.ymin===this.ymax&&(this.ymin-=1,this.ymax+=1),this.yInterval=(this.ymax-this.ymin)/(this.options.numLines-1),this.yInterval>0&&this.yInterval<1?this.precision=-Math.floor(Math.log(this.yInterval)/Math.log(10)):this.precision=0,this.dirty=!0;if(d)return this.redraw()},c.prototype.calc=function(){var b,c,d,e,f,g,h,i,j=this;e=this.el.width(),b=this.el.height();if(this.elementWidth!==e||this.elementHeight!==b||this.dirty){this.elementWidth=e,this.elementHeight=b,this.dirty=!1,this.maxYLabelWidth=Math.max(this.measureText(this.yLabelFormat(this.ymin),this.options.gridTextSize).width,this.measureText(this.yLabelFormat(this.ymax),this.options.gridTextSize).width),this.left=this.maxYLabelWidth+this.options.marginLeft,this.width=this.el.width()-this.left-this.options.marginRight,this.height=this.el.height()-this.options.marginTop-this.options.marginBottom,this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin),this.columns=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a=g;h=n+=r)j=parseFloat(h.toFixed(this.precision)),l=this.transY(j),this.r.text(this.left-this.options.marginLeft/2,l,this.yLabelFormat(j)).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+this.left+","+l+"H"+(this.left+this.width)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);m=this.options.marginTop+this.height+this.options.marginBottom/2,k=50,i=null,a=function(a,b){var c,d;return c=w.r.text(w.transX(b),m,a).attr("font-size",w.options.gridTextSize).attr("fill",w.options.gridTextColor),d=c.getBBox(),(i===null||i<=d.x)&&d.x>=0&&d.x+d.width=t;d=0<=t?++p:--p)f=this.columnLabels[this.columnLabels.length-d-1],v.push(a(f,d));return v},c.prototype.drawSeries=function(){var b,c,d,e,f,g,h,i,j,k;for(e=g=i=this.seriesCoords.length-1;i<=0?g<=0:g>=0;e=i<=0?++g:--g)d=a.map(this.seriesCoords[e],function(a){return a}),d.length>1&&(f=this.createPath(d,this.options.marginTop,this.left,this.options.marginTop+this.height,this.left+this.width),this.r.path(f).attr("stroke",this.options.lineColors[e]).attr("stroke-width",this.options.lineWidth));this.seriesPoints=function(){var a,b,c;c=[];for(e=a=0,b=this.seriesCoords.length-1;0<=b?a<=b:a>=b;e=0<=b?++a:--a)c.push([]);return c}.call(this),k=[];for(e=h=j=this.seriesCoords.length-1;j<=0?h<=0:h>=0;e=j<=0?++h:--h)k.push(function(){var a,d,f,g;f=this.seriesCoords[e],g=[];for(a=0,d=f.length;a=t;j=0<=t?++s:--s)g=b[j],j===0?n+="M"+g.x+","+g.y:(h=i[j],l=b[j-1],m=i[j-1],k=(g.x-l.x)/4,o=l.x+k,q=Math.min(e,l.y+k*m),p=g.x-k,r=Math.min(e,g.y-k*h),n+="C"+o+","+q+","+p+","+r+","+g.x+","+g.y)}else n="M"+a.map(b,function(a){return""+a.x+","+a.y}).join("L");return n},c.prototype.gradients=function(b){return a.map(b,function(a,c){return c===0?(b[1].y-a.y)/(b[1].x-a.x):c===b.length-1?(a.y-b[c-1].y)/(a.x-b[c-1].x):(b[c+1].y-b[c-1].y)/(b[c+1].x-b[c-1].x)})},c.prototype.drawHover=function(){var a,b,c,d,e;this.hoverHeight=this.options.hoverFontSize*1.5*(this.series.length+1),this.hover=this.r.rect(-10,-this.hoverHeight/2-this.options.hoverPaddingY,20,this.hoverHeight+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),this.xLabel=this.r.text(0,this.options.hoverFontSize*.75-this.hoverHeight/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),this.hoverSet=this.r.set(),this.hoverSet.push(this.hover),this.hoverSet.push(this.xLabel),this.yLabels=[],e=[];for(a=c=0,d=this.series.length-1;0<=d?c<=d:c>=d;a=0<=d?++c:--c)b=this.r.text(0,this.options.hoverFontSize*1.5*(a+1.5)-this.hoverHeight/2,"").attr("fill",this.options.lineColors[a]).attr("font-size",this.options.hoverFontSize),this.yLabels.push(b),e.push(this.hoverSet.push(b));return e},c.prototype.updateHover=function(b){var c,d,e,f,g,h,i=this;this.hoverSet.show(),this.xLabel.attr("text",this.columnLabels[b]);for(c=g=0,h=this.series.length-1;0<=h?g<=h:g>=h;c=0<=h?++g:--g)this.yLabels[c].attr("text",""+this.seriesLabels[c]+": "+this.yLabelFormat(this.series[c][b]));return d=Math.max.apply(null,a.map(this.yLabels,function(a){return a.getBBox().width})),d=Math.max(d,this.xLabel.getBBox().width),this.hover.attr("width",d+this.options.hoverPaddingX*2),this.hover.attr("x",-this.options.hoverPaddingX-d/2),f=Math.min.apply(null,a.map(this.series,function(a){return i.transY(a[b])})),f>this.hoverHeight+this.options.hoverPaddingY*2+this.options.hoverMargin+this.options.marginTop?f=f-this.hoverHeight/2-this.options.hoverPaddingY-this.options.hoverMargin:f=f+this.hoverHeight/2+this.options.hoverPaddingY+this.options.hoverMargin,f=Math.max(this.options.marginTop+this.hoverHeight/2+this.options.hoverPaddingY,f),f=Math.min(this.options.marginTop+this.height-this.hoverHeight/2-this.options.hoverPaddingY,f),e=Math.min(this.left+this.width-d/2-this.options.hoverPaddingX,this.columns[b]),e=Math.max(this.left+d/2+this.options.hoverPaddingX,e),this.hoverSet.attr("transform","t"+e+","+f)},c.prototype.hideHover=function(){return this.hoverSet.hide()},c.prototype.hilight=function(a){var b,c,d,e,f;if(this.prevHilight!==null&&this.prevHilight!==a)for(b=c=0,e=this.seriesPoints.length-1;0<=e?c<=e:c>=e;b=0<=e?++c:--c)this.seriesPoints[b][this.prevHilight]&&this.seriesPoints[b][this.prevHilight].animate(this.pointShrink);if(a!==null&&this.prevHilight!==a){for(b=d=0,f=this.seriesPoints.length-1;0<=f?d<=f:d>=f;b=0<=f?++d:--d)this.seriesPoints[b][a]&&this.seriesPoints[b][a].animate(this.pointGrow);this.updateHover(a)}this.prevHilight=a;if(a===null)return this.hideHover()},c.prototype.updateHilight=function(a){var b,c,d,e;a-=this.el.offset().left,e=[];for(b=c=d=this.hoverMargins.length;d<=0?c<=0:c>=0;b=d<=0?++c:--c){if(b===0||this.hoverMargins[b-1]>a){this.hilight(b);break}e.push(void 0)}return e},c.prototype.measureText=function(a,b){var c,d;return b==null&&(b=12),d=this.r.text(100,100,a).attr("font-size",b),c=d.getBBox(),d.remove(),c},c.prototype.yLabelFormat=function(a){return""+this.options.preUnits+b.commas(a)+this.options.postUnits},c}(),b.parseDate=function(a){var b,c,d,e,f,g,h,i,j,k,l;return typeof a=="number"?a:(c=a.match(/^(\d+) Q(\d)$/),e=a.match(/^(\d+)-(\d+)$/),f=a.match(/^(\d+)-(\d+)-(\d+)$/),h=a.match(/^(\d+) W(\d+)$/),i=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),j=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),c?(new Date(parseInt(c[1],10),parseInt(c[2],10)*3-1,1)).getTime():e?(new Date(parseInt(e[1],10),parseInt(e[2],10)-1,1)).getTime():f?(new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10))).getTime():h?(k=new Date(parseInt(h[1],10),0,1),k.getDay()!==4&&k.setMonth(0,1+(4-k.getDay()+7)%7),k.getTime()+parseInt(h[2],10)*6048e5):i?i[6]?(g=0,i[6]!=="Z"&&(g=parseInt(i[8],10)*60+parseInt(i[9],10),i[7]==="+"&&(g=0-g)),Date.UTC(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10)+g)):(new Date(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10))).getTime():j?(l=parseFloat(j[6]),b=Math.floor(l),d=Math.round((l-b)*1e3),j[8]?(g=0,j[8]!=="Z"&&(g=parseInt(j[10],10)*60+parseInt(j[11],10),j[9]==="+"&&(g=0-g)),Date.UTC(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10)+g,b,d)):(new Date(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10),b,d)).getTime()):(new Date(parseInt(a,10),0,1)).getTime())},b.commas=function(a){var b,c,d,e;return a===null?"n/a":(d=a<0?"-":"",b=Math.abs(a),c=Math.floor(b).toFixed(0),d+=c.replace(/(?=(?:\d{3})+$)(?!^)/g,","),e=b.toString(),e.length>c.length&&(d+=e.slice(c.length)),d)},b.pad2=function(a){return(a<10?"0":"")+a},b.labelSeries=function(c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r;j=200*(d-c)/e,i=new Date(c),n=b.LABEL_SPECS[f];if(n===void 0){r=b.AUTO_LABEL_ORDER;for(p=0,q=r.length;p=m.span){n=m;break}}}n===void 0&&(n=b.LABEL_SPECS.second),g&&(n=a.extend({},n,{fmt:g})),h=n.start(i),l=[];while((o=h.getTime())<=d)o>=c&&l.push([n.fmt(h),o]),n.incr(h);return l},c=function(a){return{span:a*60*1e3,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())},incr:function(b){return b.setMinutes(b.getMinutes()+a)}}},d=function(a){return{span:a*1e3,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())+":"+b.pad2(a.getSeconds())},incr:function(b){return b.setSeconds(b.getSeconds()+a)}}},b.LABEL_SPECS={year:{span:1728e7,start:function(a){return new Date(a.getFullYear(),0,1)},fmt:function(a){return""+a.getFullYear()},incr:function(a){return a.setFullYear(a.getFullYear()+1)}},month:{span:24192e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),1)},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)},incr:function(a){return a.setMonth(a.getMonth()+1)}},day:{span:864e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)+"-"+b.pad2(a.getDate())},incr:function(a){return a.setDate(a.getDate()+1)}},hour:c(60),"30min":c(30),"15min":c(15),"10min":c(10),"5min":c(5),minute:c(1),"30sec":d(30),"15sec":d(15),"10sec":d(10),"5sec":d(5),second:d(1)},b.AUTO_LABEL_ORDER=["year","month","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],window.Morris=b}).call(this); \ No newline at end of file +(function(){var a,b,c,d,e=[].slice,f=function(a,b){return function(){return a.apply(b,arguments)}},g={}.hasOwnProperty,h=function(a,b){function d(){this.constructor=a}for(var c in b)g.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};a=jQuery,b={},b.EventEmitter=function(){function a(){}return a.prototype.on=function(a,b){return this.handlers==null&&(this.handlers={}),this.handlers[a]==null&&(this.handlers[a]=[]),this.handlers[a].push(b)},a.prototype.fire=function(){var a,b,c,d,f,g,h;c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[];if(this.handlers!=null&&this.handlers[c]!=null){g=this.handlers[c],h=[];for(d=0,f=g.length;d=0;q<=0?a++:a--)r.push(a);return r}.apply(this),this.options.parseTime&&(this.columnLabels=a.map(this.columnLabels,function(a){return typeof a=="number"?s.options.dateFormat(a):a})),this.xmin=Math.min.apply(null,this.xvals),this.xmax=Math.max.apply(null,this.xvals),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),typeof this.options.ymax=="string"&&this.options.ymax.slice(0,4)==="auto"?(h=Math.max.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymax.length>5?this.ymax=Math.max(parseInt(this.options.ymax.slice(5),10),h):this.ymax=h):typeof this.options.ymax=="string"?this.ymax=parseInt(this.options.ymax,10):this.ymax=this.options.ymax,typeof this.options.ymin=="string"&&this.options.ymin.slice(0,4)==="auto"?(i=Math.min.apply(null,Array.prototype.concat.apply([],this.series)),this.options.ymin.length>5?this.ymin=Math.min(parseInt(this.options.ymin.slice(5),10),i):this.ymin=i):typeof this.options.ymin=="string"?this.ymin=parseInt(this.options.ymin,10):this.ymin=this.options.ymin,this.ymin===this.ymax&&(this.ymin-=1,this.ymax+=1),this.yInterval=(this.ymax-this.ymin)/(this.options.numLines-1),this.yInterval>0&&this.yInterval<1?this.precision=-Math.floor(Math.log(this.yInterval)/Math.log(10)):this.precision=0,this.dirty=!0;if(d)return this.redraw()},c.prototype.calc=function(){var b,c,d,e,f,g,h,i,j=this;e=this.el.width(),b=this.el.height();if(this.elementWidth!==e||this.elementHeight!==b||this.dirty){this.elementWidth=e,this.elementHeight=b,this.dirty=!1,this.maxYLabelWidth=Math.max(this.measureText(this.yLabelFormat(this.ymin),this.options.gridTextSize).width,this.measureText(this.yLabelFormat(this.ymax),this.options.gridTextSize).width),this.left=this.maxYLabelWidth+this.options.marginLeft,this.width=this.el.width()-this.left-this.options.marginRight,this.height=this.el.height()-this.options.marginTop-this.options.marginBottom,this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin),this.columns=function(){var a,b,c,d;c=this.xvals,d=[];for(a=0,b=c.length;a=g;h=n+=r)j=parseFloat(h.toFixed(this.precision)),l=this.transY(j),this.r.text(this.left-this.options.marginLeft/2,l,this.yLabelFormat(j)).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),this.r.path("M"+this.left+","+l+"H"+(this.left+this.width)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth);m=this.options.marginTop+this.height+this.options.marginBottom/2,k=50,i=null,a=function(a,b){var c,d;return c=w.r.text(w.transX(b),m,a).attr("font-size",w.options.gridTextSize).attr("fill",w.options.gridTextColor),d=c.getBBox(),(i===null||i<=d.x)&&d.x>=0&&d.x+d.width=t;d=0<=t?++p:--p)f=this.columnLabels[this.columnLabels.length-d-1],v.push(a(f,d));return v},c.prototype.drawSeries=function(){var b,c,d,e,f,g,h,i,j,k;for(e=g=i=this.seriesCoords.length-1;i<=0?g<=0:g>=0;e=i<=0?++g:--g)d=a.map(this.seriesCoords[e],function(a){return a}),d.length>1&&(f=this.createPath(d,this.options.marginTop,this.left,this.options.marginTop+this.height,this.left+this.width),this.r.path(f).attr("stroke",this.options.lineColors[e]).attr("stroke-width",this.options.lineWidth));this.seriesPoints=function(){var a,b,c;c=[];for(e=a=0,b=this.seriesCoords.length-1;0<=b?a<=b:a>=b;e=0<=b?++a:--a)c.push([]);return c}.call(this),k=[];for(e=h=j=this.seriesCoords.length-1;j<=0?h<=0:h>=0;e=j<=0?++h:--h)k.push(function(){var a,d,f,g;f=this.seriesCoords[e],g=[];for(a=0,d=f.length;a=t;j=0<=t?++s:--s)g=b[j],j===0?n+="M"+g.x+","+g.y:(h=i[j],l=b[j-1],m=i[j-1],k=(g.x-l.x)/4,o=l.x+k,q=Math.min(e,l.y+k*m),p=g.x-k,r=Math.min(e,g.y-k*h),n+="C"+o+","+q+","+p+","+r+","+g.x+","+g.y)}else n="M"+a.map(b,function(a){return""+a.x+","+a.y}).join("L");return n},c.prototype.gradients=function(b){return a.map(b,function(a,c){return c===0?(b[1].y-a.y)/(b[1].x-a.x):c===b.length-1?(a.y-b[c-1].y)/(a.x-b[c-1].x):(b[c+1].y-b[c-1].y)/(b[c+1].x-b[c-1].x)})},c.prototype.drawHover=function(){var a,b,c,d,e;this.hoverHeight=this.options.hoverFontSize*1.5*(this.series.length+1),this.hover=this.r.rect(-10,-this.hoverHeight/2-this.options.hoverPaddingY,20,this.hoverHeight+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),this.xLabel=this.r.text(0,this.options.hoverFontSize*.75-this.hoverHeight/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),this.hoverSet=this.r.set(),this.hoverSet.push(this.hover),this.hoverSet.push(this.xLabel),this.yLabels=[],e=[];for(a=c=0,d=this.series.length-1;0<=d?c<=d:c>=d;a=0<=d?++c:--c)b=this.r.text(0,this.options.hoverFontSize*1.5*(a+1.5)-this.hoverHeight/2,"").attr("fill",this.options.lineColors[a]).attr("font-size",this.options.hoverFontSize),this.yLabels.push(b),e.push(this.hoverSet.push(b));return e},c.prototype.updateHover=function(b){var c,d,e,f,g,h,i=this;this.hoverSet.show(),this.xLabel.attr("text",this.columnLabels[b]);for(c=g=0,h=this.series.length-1;0<=h?g<=h:g>=h;c=0<=h?++g:--g)this.yLabels[c].attr("text",""+this.seriesLabels[c]+": "+this.yLabelFormat(this.series[c][b]));return d=Math.max.apply(null,a.map(this.yLabels,function(a){return a.getBBox().width})),d=Math.max(d,this.xLabel.getBBox().width),this.hover.attr("width",d+this.options.hoverPaddingX*2),this.hover.attr("x",-this.options.hoverPaddingX-d/2),f=Math.min.apply(null,a.map(this.series,function(a){return i.transY(a[b])})),f>this.hoverHeight+this.options.hoverPaddingY*2+this.options.hoverMargin+this.options.marginTop?f=f-this.hoverHeight/2-this.options.hoverPaddingY-this.options.hoverMargin:f=f+this.hoverHeight/2+this.options.hoverPaddingY+this.options.hoverMargin,f=Math.max(this.options.marginTop+this.hoverHeight/2+this.options.hoverPaddingY,f),f=Math.min(this.options.marginTop+this.height-this.hoverHeight/2-this.options.hoverPaddingY,f),e=Math.min(this.left+this.width-d/2-this.options.hoverPaddingX,this.columns[b]),e=Math.max(this.left+d/2+this.options.hoverPaddingX,e),this.hoverSet.attr("transform","t"+e+","+f)},c.prototype.hideHover=function(){return this.hoverSet.hide()},c.prototype.hilight=function(a){var b,c,d,e,f;if(this.prevHilight!==null&&this.prevHilight!==a)for(b=c=0,e=this.seriesPoints.length-1;0<=e?c<=e:c>=e;b=0<=e?++c:--c)this.seriesPoints[b][this.prevHilight]&&this.seriesPoints[b][this.prevHilight].animate(this.pointShrink);if(a!==null&&this.prevHilight!==a){for(b=d=0,f=this.seriesPoints.length-1;0<=f?d<=f:d>=f;b=0<=f?++d:--d)this.seriesPoints[b][a]&&this.seriesPoints[b][a].animate(this.pointGrow);this.updateHover(a)}this.prevHilight=a;if(a===null)return this.hideHover()},c.prototype.updateHilight=function(a){var b,c,d,e;a-=this.el.offset().left,e=[];for(b=c=d=this.hoverMargins.length;d<=0?c<=0:c>=0;b=d<=0?++c:--c){if(b===0||this.hoverMargins[b-1]>a){this.hilight(b);break}e.push(void 0)}return e},c.prototype.measureText=function(a,b){var c,d;return b==null&&(b=12),d=this.r.text(100,100,a).attr("font-size",b),c=d.getBBox(),d.remove(),c},c.prototype.yLabelFormat=function(a){return""+this.options.preUnits+b.commas(a)+this.options.postUnits},c}(),b.parseDate=function(a){var b,c,d,e,f,g,h,i,j,k,l;return typeof a=="number"?a:(c=a.match(/^(\d+) Q(\d)$/),e=a.match(/^(\d+)-(\d+)$/),f=a.match(/^(\d+)-(\d+)-(\d+)$/),h=a.match(/^(\d+) W(\d+)$/),i=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),j=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),c?(new Date(parseInt(c[1],10),parseInt(c[2],10)*3-1,1)).getTime():e?(new Date(parseInt(e[1],10),parseInt(e[2],10)-1,1)).getTime():f?(new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10))).getTime():h?(k=new Date(parseInt(h[1],10),0,1),k.getDay()!==4&&k.setMonth(0,1+(4-k.getDay()+7)%7),k.getTime()+parseInt(h[2],10)*6048e5):i?i[6]?(g=0,i[6]!=="Z"&&(g=parseInt(i[8],10)*60+parseInt(i[9],10),i[7]==="+"&&(g=0-g)),Date.UTC(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10)+g)):(new Date(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10))).getTime():j?(l=parseFloat(j[6]),b=Math.floor(l),d=Math.round((l-b)*1e3),j[8]?(g=0,j[8]!=="Z"&&(g=parseInt(j[10],10)*60+parseInt(j[11],10),j[9]==="+"&&(g=0-g)),Date.UTC(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10)+g,b,d)):(new Date(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10),b,d)).getTime()):(new Date(parseInt(a,10),0,1)).getTime())},b.commas=function(a){var b,c,d,e;return a===null?"n/a":(d=a<0?"-":"",b=Math.abs(a),c=Math.floor(b).toFixed(0),d+=c.replace(/(?=(?:\d{3})+$)(?!^)/g,","),e=b.toString(),e.length>c.length&&(d+=e.slice(c.length)),d)},b.pad2=function(a){return(a<10?"0":"")+a},b.labelSeries=function(c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r;j=200*(d-c)/e,i=new Date(c),n=b.LABEL_SPECS[f];if(n===void 0){r=b.AUTO_LABEL_ORDER;for(p=0,q=r.length;p=m.span){n=m;break}}}n===void 0&&(n=b.LABEL_SPECS.second),g&&(n=a.extend({},n,{fmt:g})),h=n.start(i),l=[];while((o=h.getTime())<=d)o>=c&&l.push([n.fmt(h),o]),n.incr(h);return l},c=function(a){return{span:a*60*1e3,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())},incr:function(b){return b.setMinutes(b.getMinutes()+a)}}},d=function(a){return{span:a*1e3,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())+":"+b.pad2(a.getSeconds())},incr:function(b){return b.setSeconds(b.getSeconds()+a)}}},b.LABEL_SPECS={year:{span:1728e7,start:function(a){return new Date(a.getFullYear(),0,1)},fmt:function(a){return""+a.getFullYear()},incr:function(a){return a.setFullYear(a.getFullYear()+1)}},month:{span:24192e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),1)},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)},incr:function(a){return a.setMonth(a.getMonth()+1)}},day:{span:864e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)+"-"+b.pad2(a.getDate())},incr:function(a){return a.setDate(a.getDate()+1)}},hour:c(60),"30min":c(30),"15min":c(15),"10min":c(10),"5min":c(5),minute:c(1),"30sec":d(30),"15sec":d(15),"10sec":d(10),"5sec":d(5),second:d(1)},b.AUTO_LABEL_ORDER=["year","month","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],b.Donut=function(){function c(c){this.select=f(this.select,this);if(!(this instanceof b.Donut))return new b.Donut(c);typeof c.element=="string"?this.el=a(document.getElementById(c.element)):this.el=a(c.element),c.colors!=null&&(this.colors=c.colors);if(this.el===null||this.el.length===0)throw new Error("Graph placeholder not found.");if(c.data===void 0||c.data.length===0)return;this.data=c.data,this.el.addClass("graph-initialised"),this.r=new Raphael(this.el[0]),this.draw()}return c.prototype.colors=["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],c.prototype.draw=function(){var a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;c=this.el.width()/2,d=this.el.height()/2,m=(Math.min(c,d)-10)/3,l=0,u=this.data;for(o=0,r=u.length;oMath.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],"M"+c+","+e+("A"+a+","+a+",0,"+this.long+",0,"+d+","+f)+("L"+h+","+j)+("A"+b+","+b+",0,"+this.long+",1,"+g+","+i)+"Z"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],"M"+b+","+d+("A"+a+","+a+",0,"+this.long+",0,"+c+","+e)},b.prototype.render=function(a){var b=this;return this.arc=a.path(this.hilight).attr({stroke:this.color,"stroke-width":2,opacity:0}),this.seg=a.path(this.path).attr({fill:this.color,stroke:"white","stroke-width":3}).hover(function(){return b.fire("hover",b)})},b.prototype.select=function(){if(!this.selected)return this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0},b.prototype.deselect=function(){if(this.selected)return this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1},b}(b.EventEmitter),window.Morris=b}).call(this); \ No newline at end of file