/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com jsDate | (c) 2010-2013 Chris Leonello */(function(e) { e.jqplot.DonutRenderer = function() { e.jqplot.LineRenderer.call(this) }; e.jqplot.DonutRenderer.prototype = new e.jqplot.LineRenderer(); e.jqplot.DonutRenderer.prototype.constructor = e.jqplot.DonutRenderer; e.jqplot.DonutRenderer.prototype.init = function(p, t) { this.diameter = null; this.innerDiameter = null; this.thickness = null; this.padding = 20; this.sliceMargin = 0; this.ringMargin = null; this.fill = true; this.shadowOffset = 2; this.shadowAlpha = 0.07; this.shadowDepth = 5; this.highlightMouseOver = true; this.highlightMouseDown = false; this.highlightColors = []; this.dataLabels = "percent"; this.showDataLabels = false; this.dataLabelFormatString = null; this.dataLabelThreshold = 3; this.dataLabelPositionFactor = 0.4; this.dataLabelNudge = 0; this.startAngle = 0; this.tickRenderer = e.jqplot.DonutTickRenderer; this._drawData = true; this._type = "donut"; if (p.highlightMouseDown && p.highlightMouseOver == null) { p.highlightMouseOver = false } e.extend(true, this, p); if (this.diameter != null) { this.diameter = this.diameter - this.sliceMargin } this._diameter = null; this._innerDiameter = null; this._radius = null; this._innerRadius = null; this._thickness = null; this._previousSeries = []; this._numberSeries = 1; this._sliceAngles = []; this._highlightedPoint = null; if (this.highlightColors.length == 0) { for (var r = 0; r < this.seriesColors.length; r++) { var q = e.jqplot.getColorComponents(this.seriesColors[r]); var n = [ q[0], q[1], q[2] ]; var s = n[0] + n[1] + n[2]; for (var o = 0; o < 3; o++) { n[o] = (s > 570) ? n[o] * 0.8 : n[o] + 0.3 * (255 - n[o]); n[o] = parseInt(n[o], 10) } this.highlightColors.push("rgb(" + n[0] + "," + n[1] + "," + n[2] + ")") } } t.postParseOptionsHooks.addOnce(l); t.postInitHooks.addOnce(g); t.eventListenerHooks.addOnce("jqplotMouseMove", b); t.eventListenerHooks.addOnce("jqplotMouseDown", a); t.eventListenerHooks.addOnce("jqplotMouseUp", j); t.eventListenerHooks.addOnce("jqplotClick", f); t.eventListenerHooks.addOnce("jqplotRightClick", m); t.postDrawHooks.addOnce(h) }; e.jqplot.DonutRenderer.prototype.setGridData = function(s) { var o = []; var t = []; var n = this.startAngle / 180 * Math.PI; var r = 0; this._drawData = false; for (var q = 0; q < this.data.length; q++) { if (this.data[q][1] != 0) { this._drawData = true } o.push(this.data[q][1]); t.push([ this.data[q][0] ]); if (q > 0) { o[q] += o[q - 1] } r += this.data[q][1] } var p = Math.PI * 2 / o[o.length - 1]; for (var q = 0; q < o.length; q++) { t[q][1] = o[q] * p; t[q][2] = this.data[q][1] / r } this.gridData = t }; e.jqplot.DonutRenderer.prototype.makeGridData = function(s, t) { var o = []; var u = []; var r = 0; var n = this.startAngle / 180 * Math.PI; this._drawData = false; for (var q = 0; q < s.length; q++) { if (this.data[q][1] != 0) { this._drawData = true } o.push(s[q][1]); u.push([ s[q][0] ]); if (q > 0) { o[q] += o[q - 1] } r += s[q][1] } var p = Math.PI * 2 / o[o.length - 1]; for (var q = 0; q < o.length; q++) { u[q][1] = o[q] * p; u[q][2] = s[q][1] / r } return u }; e.jqplot.DonutRenderer.prototype.drawSlice = function(x, u, t, p, s) { var n = this._diameter / 2; var v = n - this._thickness; var w = this.fill; x.save(); x.translate(this._center[0], this._center[1]); if (s) { for (var q = 0; q < this.shadowDepth; q++) { x.save(); x.translate(this.shadowOffset * Math.cos(this.shadowAngle / 180 * Math.PI), this.shadowOffset * Math.sin(this.shadowAngle / 180 * Math.PI)); o() } } else { o() } function o() { if (t > 6.282 + this.startAngle) { t = 6.282 + this.startAngle; if (u > t) { u = 6.281 + this.startAngle } } if (u >= t) { return } x.beginPath(); x.fillStyle = p; x.strokeStyle = p; x.arc(0, 0, n, u, t, false); x.lineTo(v * Math.cos(t), v * Math.sin(t)); x.arc(0, 0, v, t, u, true); x.closePath(); if (w) { x.fill() } else { x.stroke() } } if (s) { for (var q = 0; q < this.shadowDepth; q++) { x.restore() } } x.restore() }; e.jqplot.DonutRenderer.prototype.draw = function(N, V, t, P) { var Q; var J = (t != undefined) ? t : {}; var q = 0; var p = 0; var u = 1; if (t.legendInfo && t.legendInfo.placement == "insideGrid") { var I = t.legendInfo; switch (I.location) { case "nw": q = I.width + I.xoffset; break; case "w": q = I.width + I.xoffset; break; case "sw": q = I.width + I.xoffset; break; case "ne": q = I.width + I.xoffset; u = -1; break; case "e": q = I.width + I.xoffset; u = -1; break; case "se": q = I.width + I.xoffset; u = -1; break; case "n": p = I.height + I.yoffset; break; case "s": p = I.height + I.yoffset; u = -1; break; default: break } } var B = (J.shadow != undefined) ? J.shadow : this.shadow; var W = (J.showLine != undefined) ? J.showLine : this.showLine; var O = (J.fill != undefined) ? J.fill : this.fill; var s = N.canvas.width; var H = N.canvas.height; var G = s - q - 2 * this.padding; var R = H - p - 2 * this.padding; var v = Math.min(G, R); var T = v; var X = (this.ringMargin == null) ? this.sliceMargin * 2 : this.ringMargin; for (var Q = 0; Q < this._previousSeries.length; Q++) { T -= 2 * this._previousSeries[Q]._thickness + 2 * X } this._diameter = this.diameter || T; if (this.innerDiameter != null) { var M = (this._numberSeries > 1 && this.index > 0) ? this._previousSeries[0]._diameter : this._diameter; this._thickness = this.thickness || (M - this.innerDiameter - 2 * X * this._numberSeries) / this._numberSeries / 2 } else { this._thickness = this.thickness || v / 2 / (this._numberSeries + 1) * 0.85 } var K = this._radius = this._diameter / 2; this._innerRadius = this._radius - this._thickness; var o = this.startAngle / 180 * Math.PI; this._center = [ (s - u * q) / 2 + u * q, (H - u * p) / 2 + u * p ]; if (this.shadow) { var L = "rgba(0,0,0," + this.shadowAlpha + ")"; for (var Q = 0; Q < V.length; Q++) { var A = (Q == 0) ? o : V[Q - 1][1] + o; A += this.sliceMargin / 180 * Math.PI; this.renderer.drawSlice.call(this, N, A, V[Q][1] + o, L, true) } } for (var Q = 0; Q < V.length; Q++) { var A = (Q == 0) ? o : V[Q - 1][1] + o; A += this.sliceMargin / 180 * Math.PI; var z = V[Q][1] + o; this._sliceAngles.push([ A, z ]); this.renderer.drawSlice.call(this, N, A, z, this.seriesColors[Q], false); if (this.showDataLabels && V[Q][2] * 100 >= this.dataLabelThreshold) { var S, U = (A + z) / 2, C; if (this.dataLabels == "label") { S = this.dataLabelFormatString || "%s"; C = e.jqplot.sprintf(S, V[Q][0]) } else { if (this.dataLabels == "value") { S = this.dataLabelFormatString || "%d"; C = e.jqplot.sprintf(S, this.data[Q][1]) } else { if (this.dataLabels == "percent") { S = this.dataLabelFormatString || "%d%%"; C = e.jqplot.sprintf(S, V[Q][2] * 100) } else { if (this.dataLabels.constructor == Array) { S = this.dataLabelFormatString || "%s"; C = e.jqplot.sprintf(S, this.dataLabels[Q]) } } } } var n = this._innerRadius + this._thickness * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge; var F = this._center[0] + Math.cos(U) * n + this.canvas._offsets.left; var E = this._center[1] + Math.sin(U) * n + this.canvas._offsets.top; var D = e( '' + C + "").insertBefore( P.eventCanvas._elem); F -= D.width() / 2; E -= D.height() / 2; F = Math.round(F); E = Math.round(E); D.css({ left : F, top : E }) } } }; e.jqplot.DonutAxisRenderer = function() { e.jqplot.LinearAxisRenderer.call(this) }; e.jqplot.DonutAxisRenderer.prototype = new e.jqplot.LinearAxisRenderer(); e.jqplot.DonutAxisRenderer.prototype.constructor = e.jqplot.DonutAxisRenderer; e.jqplot.DonutAxisRenderer.prototype.init = function(n) { this.tickRenderer = e.jqplot.DonutTickRenderer; e.extend(true, this, n); this._dataBounds = { min : 0, max : 100 }; this.min = 0; this.max = 100; this.showTicks = false; this.ticks = []; this.showMark = false; this.show = false }; e.jqplot.DonutLegendRenderer = function() { e.jqplot.TableLegendRenderer.call(this) }; e.jqplot.DonutLegendRenderer.prototype = new e.jqplot.TableLegendRenderer(); e.jqplot.DonutLegendRenderer.prototype.constructor = e.jqplot.DonutLegendRenderer; e.jqplot.DonutLegendRenderer.prototype.init = function(n) { this.numberRows = null; this.numberColumns = null; e.extend(true, this, n) }; e.jqplot.DonutLegendRenderer.prototype.draw = function() { var q = this; if (this.show) { var y = this._series; var B = "position:absolute;"; B += (this.background) ? "background:" + this.background + ";" : ""; B += (this.border) ? "border:" + this.border + ";" : ""; B += (this.fontSize) ? "font-size:" + this.fontSize + ";" : ""; B += (this.fontFamily) ? "font-family:" + this.fontFamily + ";" : ""; B += (this.textColor) ? "color:" + this.textColor + ";" : ""; B += (this.marginTop != null) ? "margin-top:" + this.marginTop + ";" : ""; B += (this.marginBottom != null) ? "margin-bottom:" + this.marginBottom + ";" : ""; B += (this.marginLeft != null) ? "margin-left:" + this.marginLeft + ";" : ""; B += (this.marginRight != null) ? "margin-right:" + this.marginRight + ";" : ""; this._elem = e('