2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
typeof RGraph == "undefined" && (RGraph = {}), RGraph.Rose = function (n, t) { var r, i; for (this.id = n, this.canvas = document.getElementById(n), this.context = this.canvas.getContext("2d"), this.data = t, this.canvas.__object__ = this, this.type = "rose", this.isRGraph = !0, this.uid = RGraph.CreateUID(), this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID(), this.colorsParsed = !1, RGraph.OldBrowserCompat(this.context), this.centerx = 0, this.centery = 0, this.radius = 0, this.max = 0, this.angles = [], this.properties = { "chart.background.axes": !0, "chart.background.axes.color": "black", "chart.background.grid": !0, "chart.background.grid.color": "#ccc", "chart.background.grid.size": null, "chart.background.grid.spokes": null, "chart.background.grid.count": 5, "chart.centerx": null, "chart.centery": null, "chart.radius": null, "chart.colors": ["rgba(255,0,0,0.5)", "rgba(255,255,0,0.5)", "rgba(0,255,255,0.5)", "rgb(0,255,0)", "gray", "blue", "rgb(255,128,255)", "green", "pink", "gray", "aqua"], "chart.colors.sequential": !1, "chart.colors.alpha": null, "chart.margin": 0, "chart.strokestyle": "#aaa", "chart.gutter.left": 25, "chart.gutter.right": 25, "chart.gutter.top": 25, "chart.gutter.bottom": 25, "chart.title": "", "chart.title.background": null, "chart.title.hpos": null, "chart.title.vpos": null, "chart.title.bold": !0, "chart.title.font": null, "chart.title.x": null, "chart.title.y": null, "chart.title.halign": null, "chart.title.valign": null, "chart.labels": null, "chart.labels.position": "center", "chart.labels.axes": "nsew", "chart.labels.offset": 0, "chart.text.color": "black", "chart.text.font": "Arial", "chart.text.size": 10, "chart.key": null, "chart.key.background": "white", "chart.key.position": "graph", "chart.key.halign": "right", "chart.key.shadow": !1, "chart.key.shadow.color": "#666", "chart.key.shadow.blur": 3, "chart.key.shadow.offsetx": 2, "chart.key.shadow.offsety": 2, "chart.key.position.gutter.boxed": !0, "chart.key.position.x": null, "chart.key.position.y": null, "chart.key.color.shape": "square", "chart.key.rounded": !0, "chart.key.linewidth": 1, "chart.key.colors": null, "chart.contextmenu": null, "chart.tooltips": null, "chart.tooltips.event": "onclick", "chart.tooltips.effect": "fade", "chart.tooltips.css.class": "RGraph_tooltip", "chart.tooltips.highlight": !0, "chart.highlight.stroke": "rgba(0,0,0,0)", "chart.highlight.fill": "rgba(255,255,255,0.7)", "chart.annotatable": !1, "chart.annotate.color": "black", "chart.zoom.factor": 1.5, "chart.zoom.fade.in": !0, "chart.zoom.fade.out": !0, "chart.zoom.hdir": "right", "chart.zoom.vdir": "down", "chart.zoom.frames": 25, "chart.zoom.delay": 16.666, "chart.zoom.shadow": !0, "chart.zoom.background": !0, "chart.zoom.action": "zoom", "chart.resizable": !1, "chart.resize.handle.adjust": [0, 0], "chart.resize.handle.background": null, "chart.adjustable": !1, "chart.ymax": null, "chart.ymin": 0, "chart.scale.decimals": null, "chart.scale.point": ".", "chart.scale.thousand": ",", "chart.variant": "stacked", "chart.exploded": 0, "chart.events.mousemove": null, "chart.events.click": null, "chart.animation.roundrobin.factor": 1, "chart.animation.roundrobin.radius": !0, "chart.animation.grow.multiplier": 1 }, r = RGraph.array_linearize(this.data), i = 0; i < r.length; ++i)this["$" + i] = {}; this.canvas.__rgraph_aa_translated__ || (this.context.translate(.5, .5), this.canvas.__rgraph_aa_translated__ = !0), RGraph.Register(this) }, RGraph.Rose.prototype.Set = function (n, t) { n.substr(0, 6) != "chart." && (n = "chart." + n), this.properties[n.toLowerCase()] = t }, RGraph.Rose.prototype.Get = function (n) { return n.substr(0, 6) != "chart." && (n = "chart." + n), this.properties[n.toLowerCase()] }, RGraph.Rose.prototype.Draw = function () { RGraph.FireCustomEvent(this, "onbeforedraw"), this.gutterLeft = this.Get("chart.gutter.left"), this.gutterRight = this.Get("chart.gutter.right"), this.gutterTop = this.Get("chart.gutter.top"), this.gutterBottom = this.Get("chart.gutter.bottom"), this.radius = Math.min(this.canvas.width - this.gutterLeft - this.gutterRight, this.canvas.height - this.gutterTop - this.gutterBottom) / 2, this.centerx = (this.canvas.width - this.gutterLeft - this.gutterRight) / 2 + this.gutterLeft, this.centery = (this.canvas.height - this.gutterTop - this.gutterBottom) / 2 + this.gutterTop, this.angles = [], this.total = 0, this.startRadians = 0, this.Get("chart.key") && this.Get("chart.key").length > 0 && this.Get("chart.key").length >= 3 && (this.centerx = this.centerx - this.Get("chart.gutter.right") + 5), typeof this.Get("chart.centerx") == "number" && (this.centerx = this.Get("chart.centerx")), typeof this.Get("chart.centery") == "number" && (this.centery = this.Get("chart.centery")), typeof this.Get("chart.radius") == "number" && (this.radius = this.Get("chart.radius")), this.colorsParsed || (this.parseColors(), this.colorsParsed = !0), this.DrawBackground(), this.DrawRose(), this.DrawLabels(), this.Get("chart.contextmenu") && RGraph.ShowContext(this), this.Get("chart.resizable") && RGraph.AllowResizing(this), this.Get("chart.adjustable") && RGraph.AllowAdjusting(this), RGraph.InstallEventListeners(this), RGraph.FireCustomEvent(this, "ondraw") }, RGraph.Rose.prototype.DrawBackground = function () { var t, n; if (this.context.lineWidth = 1, this.properties["chart.background.grid"]) { for (typeof this.properties["chart.background.grid.count"] == "number" && (this.properties["chart.background.grid.size"] = this.radius / this.properties["chart.background.grid.count"]), this.context.beginPath(), this.context.strokeStyle = this.properties["chart.background.grid.color"], n = this.properties["chart.background.grid.size"]; n <= this.radius; n += this.properties["chart.background.grid.size"])this.context.arc(this.centerx, this.centery, n, 0, TWOPI, !1); if (this.context.stroke(), this.context.beginPath(), typeof this.properties["chart.background.grid.spokes"] == "number") for (t = 360 / this.properties["chart.background.grid.spokes"], n = t; n <= 360; n += t)this.context.arc(this.centerx, this.centery, this.radius, n / (180 / PI) - HALFPI, (n + .0001) / (180 / PI) - HALFPI, 0), this.context.lineTo(this.centerx, this.centery); else for (n = 15; n <= 360; n += 15)this.context.arc(this.centerx, this.centery, this.radius, n / (180 / PI) - HALFPI, (n + .0001) / (180 / PI) - HALFPI, !1), this.context.lineTo(this.centerx, this.centery); this.context.stroke() } if (this.Get("chart.background.axes")) { for (this.context.beginPath(), this.context.strokeStyle = this.Get("chart.background.axes.color"), this.context.moveTo(this.centerx - this.radius, Math.round(this.centery)), this.context.lineTo(this.centerx + this.radius, Math.round(this.centery)), this.context.moveTo(Math.round(this.centerx - this.radius), this.centery - 5), this.context.lineTo(Math.round(this.centerx - this.radius), this.centery + 5), this.context.moveTo(Math.round(this.centerx + this.radius), this.centery - 5), this.context.lineTo(Math.round(this.centerx + this.radius), this.centery + 5), n = this.centerx - this.radius; n < this.centerx + this.radius; n += this.radius / 5)this.context.moveTo(Math.round(n), this.centery - 3), this.context.lineTo(Math.round(n), this.centery + 3.5); for (n = this.centery - this.radius; n < this.centery + this.radius; n += this.radius / 5)this.context.moveTo(this.centerx - 3, Math.round(n)), this.context.lineTo(this.centerx + 3, Math.round(n)); this.context.moveTo(Math.round(this.centerx), this.centery - this.radius), this.context.lineTo(Math.round(this.centerx), this.centery + this.radius), this.context.moveTo(this.centerx - 5, Math.round(this.centery - this.radius)), this.context.lineTo(this.centerx + 5, Math.round(this.centery - this.radius)), this.context.moveTo(this.centerx - 5, Math.round(this.centery + this.radius)), this.context.lineTo(this.centerx + 5, Math.round(this.centery + this.radius)), this.context.closePath(), this.context.stroke() } }, RGraph.Rose.prototype.DrawRose = function () { var p = 0, h = this.data, c = RGraph.degrees2Radians(this.Get("chart.margin")), v, s, w, b, n, o, f, a, y, e; if (this.Get("chart.ymax")) v = this.Get("chart.ymax"), s = this.Get("chart.ymin"), this.scale = [(v - s) * .2 + s, (v - s) * .4 + s, (v - s) * .6 + s, (v - s) * .8 + s, (v - s) * 1 + s], this.max = this.scale[4]; else { for (n = 0; n < h.length; ++n)p = typeof h[n] == "number" ? Math.max(p, h[n]) : typeof h[n] == "object" && this.Get("chart.variant") == "non-equi-angular" ? Math.max(p, h[n][0]) : Math.max(p, RGraph.array_sum(h[n])); this.scale = RGraph.getScale(p, this), this.max = this.scale[4] } if (this.sum = RGraph.array_sum(h), this.context.moveTo(this.centerx, this.centery), this.context.stroke(), this.Get("chart.colors.alpha") && (this.context.globalAlpha = this.Get("chart.colors.alpha")), typeof this.Get("chart.variant") == "string" && this.Get("chart.variant") == "non-equi-angular") { for (w = 0, n = 0; n < h.length; ++n)w += h[n][1]; for (n = 0; n < this.data.length; ++n) { o = this.data[n][1] / w * TWOPI, f = (this.data[n][0] - this.Get("chart.ymin")) / (this.max - this.Get("chart.ymin")) * this.radius, f = f * this.properties["chart.animation.grow.multiplier"], this.context.strokeStyle = this.Get("chart.strokestyle"), this.context.fillStyle = this.Get("chart.colors")[0], this.Get("chart.colors.sequential") && (this.context.fillStyle = this.Get("chart.colors")[n]), this.context.beginPath(); var i = this.startRadians * this.Get("chart.animation.roundrobin.factor") - HALFPI + c - o / 2, t = (this.startRadians + o) * this.Get("chart.animation.roundrobin.factor") - HALFPI - c - o / 2, l = this.getexploded(n, i, t, this.Get("chart.exploded")), r = l[0], u = l[1]; this.context.arc(this.centerx + r, this.centery + u, this.Get("chart.animation.roundrobin.radius") ? f * this.Get("chart.animation.roundrobin.factor") : f, i, t, 0), this.context.lineTo(this.centerx + r, this.centery + u), this.context.closePath(), this.context.stroke(), this.context.fill(), this.angles.push(gg = [i, t, 0, f, this.centerx + r, this.centery + u]), this.startRadians += o } } else for (b = 0, n = 0; n < this.data.length; ++n) { if (this.context.strokeStyle = this.Get("chart.strokestyle"), this.context.fillStyle = this.Get("chart.colors")[0], this.Get("chart.colors.sequential") && (this.context.fillStyle = this.Get("chart.colors")[n]), o = 1 / this.data.length * TWOPI, typeof this.data[n] == "number") { this.context.beginPath(), f = (this.data[n] - this.Get("chart.ymin")) / (this.max - this.Get("chart.ymin")) * this.radius, f = f * this.properties["chart.animation.grow.multiplier"]; var i = this.startRadians * this.Get("chart.animation.roundrobin.factor") - HALFPI + c - o / 2, t = this.startRadians * this.Get("chart.animation.roundrobin.factor") + o * this.Get("chart.animation.roundrobin.factor") - HALFPI - c - o / 2, l = this.getexploded(n, i, t, this.Get("chart.exploded")), r = l[0], u = l[1]; this.context.arc(this.centerx + r, this.centery + u, this.Get("chart.animation.roundrobin.radius") ? f * this.Get("chart.animation.roundrobin.factor") : f, i, t, 0), this.context.lineTo(this.centerx + r, this.centery + u), this.context.closePath(), this.context.stroke(), this.context.fill(), t == 0, this.angles.push([i, t, 0, f * this.Get("chart.animation.roundrobin.factor"), this.centerx + r, this.centery + u]) } else if (typeof this.data[n] == "object") for (c = this.Get("chart.margin") / (180 / PI), a = 0; a < this.data[n].length; ++a) { var i = this.startRadians * this.Get("chart.animation.roundrobin.factor") - HALFPI + c, t = this.startRadians * this.Get("chart.animation.roundrobin.factor") + o * this.Get("chart.animation.roundrobin.factor") - HALFPI - c, l = this.getexploded(n, i, t, this.Get("chart.exploded")), r = l[0], u = l[1]; this.context.fillStyle = this.Get("chart.colors")[a], this.Get("chart.colors.sequential") && (this.context.fillStyle = this.Get("chart.colors")[b++]), a == 0 ? (this.context.beginPath(), y = 0, e = (this.data[n][a] - this.Get("chart.ymin")) / (this.max - this.Get("chart.ymin")) * this.radius, e = e * this.properties["chart.animation.grow.multiplier"], this.context.arc(this.centerx + r, this.centery + u, this.Get("chart.animation.roundrobin.radius") ? e * this.Get("chart.animation.roundrobin.factor") : e, i, t, 0), this.context.lineTo(this.centerx + r, this.centery + u), this.context.closePath(), this.context.stroke(), this.context.fill(), this.angles.push([i, t, 0, e * this.Get("chart.animation.roundrobin.factor"), this.centerx + r, this.centery + u])) : (this.context.beginPath(), y = e, e = (this.data[n][a] - this.Get("chart.ymin")) / (this.max - this.Get("chart.ymin")) * this.radius + y, e = e * this.properties["chart.animation.grow.multiplier"], this.context.arc(this.centerx + r, this.centery + u, y * this.Get("chart.animation.roundrobin.factor"), i, t, 0), this.context.arc(this.centerx + r, this.centery + u, e * this.Get("chart.animation.roundrobin.factor"), t, i, !0), this.context.closePath(), this.context.stroke(), this.context.fill(), this.angles.push([i, t, y * this.Get("chart.animation.roundrobin.factor"), e * this.Get("chart.animation.roundrobin.factor"), this.centerx + r, this.centery + u])) } this.startRadians += o } this.Get("chart.colors.alpha") && (this.context.globalAlpha = 1), this.Get("chart.title") && RGraph.DrawTitle(this, this.Get("chart.title"), this.canvas.height / 2 - this.radius, this.centerx, this.Get("chart.title.size") ? this.Get("chart.title.size") : this.Get("chart.text.size") + 2) }, RGraph.Rose.prototype.DrawLabels = function () { var h, r; this.context.lineWidth = 1, h = this.Get("chart.key"), h && h.length && RGraph.DrawKey(this, h, this.Get("chart.colors")), this.context.fillStyle = this.properties["chart.text.color"], this.context.strokeStyle = "black"; var u = this.radius, t = this.Get("chart.text.font"), n = this.Get("chart.text.size"), i = this.context, s = this.Get("chart.labels.axes").toLowerCase(), o = this.Get("chart.scale.decimals"), f = this.Get("chart.units.pre"), e = this.Get("chart.units.post"); typeof this.Get("chart.labels") == "object" && this.Get("chart.labels") && this.DrawCircularLabels(i, this.Get("chart.labels"), t, n, u + 10), typeof this.properties["chart.text.size.scale"] == "number" && (n = this.properties["chart.text.size.scale"]), r = "rgba(255,255,255,0.8)", s.indexOf("n") > -1 && (RGraph.Text(i, t, n, this.centerx, this.centery - u * .2, RGraph.number_format(this, Number(this.scale[0]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery - u * .4, RGraph.number_format(this, Number(this.scale[1]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery - u * .6, RGraph.number_format(this, Number(this.scale[2]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery - u * .8, RGraph.number_format(this, Number(this.scale[3]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery - u, RGraph.number_format(this, Number(this.scale[4]).toFixed(o), f, e), "center", "center", !0, !1, r)), s.indexOf("s") > -1 && (RGraph.Text(i, t, n, this.centerx, this.centery + u * .2, RGraph.number_format(this, Number(this.scale[0]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery + u * .4, RGraph.number_format(this, Number(this.scale[1]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery + u * .6, RGraph.number_format(this, Number(this.scale[2]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery + u * .8, RGraph.number_format(this, Number(this.scale[3]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx, this.centery + u, RGraph.number_format(this, Number(this.scale[4]).toFixed(o), f, e), "center", "center", !0, !1, r)), s.indexOf("e") > -1 && (RGraph.Text(i, t, n, this.centerx + u * .2, this.centery, RGraph.number_format(this, Number(this.scale[0]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx + u * .4, this.centery, RGraph.number_format(this, Number(this.scale[1]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx + u * .6, this.centery, RGraph.number_format(this, Number(this.scale[2]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx + u * .8, this.centery, RGraph.number_format(this, Number(this.scale[3]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx + u, this.centery, RGraph.number_format(this, Number(this.scale[4]).toFixed(o), f, e), "center", "center", !0, !1, r)), s.indexOf("w") > -1 && (RGraph.Text(i, t, n, this.centerx - u * .2, this.centery, RGraph.number_format(this, Number(this.scale[0]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx - u * .4, this.centery, RGraph.number_format(this, Number(this.scale[1]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx - u * .6, this.centery, RGraph.number_format(this, Number(this.scale[2]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx - u * .8, this.centery, RGraph.number_format(this, Number(this.scale[3]).toFixed(o), f, e), "center", "center", !0, !1, r), RGraph.Text(i, t, n, this.centerx - u, this.centery, RGraph.number_format(this, Number(this.scale[4]).toFixed(o), f, e), "center", "center", !0, !1, r)), s.length > 0 && RGraph.Text(i, t, n, this.centerx, this.centery, typeof this.Get("chart.ymin") == "number" ? RGraph.number_format(this, Number(this.Get("chart.ymin")).toFixed(this.Get("chart.scale.decimals")), f, e) : "0", "center", "center", !0, !1, r) }, RGraph.Rose.prototype.DrawCircularLabels = function (n, t, i, r, u) { for (var s = this.Get("chart.variant"), c = this.Get("chart.labels.position"), u = u + 5 + this.Get("chart.labels.offset"), e, o, h, f = 0; f < this.angles.length; ++f)typeof s == "string" && s == "non-equi-angular" ? e = Number(this.angles[f][0]) + (this.angles[f][1] - this.angles[f][0]) / 2 : (e = TWOPI / t.length * (f + 1) - TWOPI / (t.length * 2), e = e - HALFPI + (this.Get("chart.labels.position") == "edge" ? TWOPI / t.length / 2 : 0)), o = this.centerx + Math.cos(e) * u, h = this.centery + Math.sin(e) * u, halign = o > this.centerx ? "left" : o == this.centerx ? "center" : "right", RGraph.Text(n, i, r, o, h, String(t[f]), "center", halign) }, RGraph.Rose.prototype.getShape = RGraph.Rose.prototype.getSegment = function (n) { var t, e; RGraph.FixEventObject(n); var a = this.canvas, c = this.context, i = this.angles; for (t = 0; t < i.length; ++t) { var o = i[t][0], s = i[t][1], h = i[t][2], l = i[t][3], u = i[t][4], f = i[t][5], r = RGraph.getMouseXY(n), v = r[0] - u, y = r[1] - f; if (this.context.beginPath(), this.context.arc(u, f, h ? h : .01, o, s, !1), this.context.arc(u, f, l, s, o, !0), this.context.closePath(), c.isPointInPath(r[0], r[1])) return i[t][6] = t, RGraph.parseTooltipText && (e = RGraph.parseTooltipText(this.Get("chart.tooltips"), i[t][6])), i[t].object = this, i[t].x = i[t][4], i[t].y = i[t][5], i[t]["angle.start"] = i[t][0], i[t]["angle.end"] = i[t][1], i[t]["radius.start"] = i[t][2], i[t]["radius.end"] = i[t][3], i[t].index = i[t][6], i[t].tooltip = e ? e : null, i[t] } return null }, RGraph.Rose.prototype.getexploded = function (n, t, i, r) { var u, f; return typeof r == "object" && typeof r[n] == "number" ? (u = Math.cos((i - t) / 2 + t) * r[n], f = Math.sin((i - t) / 2 + t) * r[n]) : typeof r == "number" ? (u = Math.cos((i - t) / 2 + t) * r, f = Math.sin((i - t) / 2 + t) * r) : (u = 0, f = 0), [u, f] }, RGraph.Rose.prototype.AllowTooltips = function () { RGraph.PreLoadTooltip / images(this), RGraph.InstallWindowMousedownTooltipListener(this), RGraph.InstallCanvasMousemoveTooltipListener(this), RGraph.InstallCanvasMouseupTooltipListener(this) }, RGraph.Rose.prototype.Highlight = function (n) { this.Get("chart.tooltips.highlight") && (this.context.beginPath(), this.context.strokeStyle = this.Get("chart.highlight.stroke"), this.context.fillStyle = this.Get("chart.highlight.fill"), this.context.arc(n.x, n.y, n["radius.end"], n["angle.start"], n["angle.end"], !1), n["radius.start"] > 0 ? this.context.arc(n.x, n.y, n["radius.start"], n["angle.end"], n["angle.start"], !0) : this.context.lineTo(n.x, n.y), this.context.closePath(), this.context.stroke(), this.context.fill()) }, RGraph.Rose.prototype.getObjectByXY = function (n) { var t = RGraph.getMouseXY(n), i = RGraph.getHypLength(this.centerx, this.centery, t[0], t[1]); if (t[0] > this.centerx - this.radius && t[0] < this.centerx + this.radius && t[1] > this.centery - this.radius && t[1] < this.centery + this.radius && i <= this.radius) return this }, RGraph.Rose.prototype.positionTooltip = function (n, t, i, r, u) { var c = n.angles[u][4], l = n.angles[u][5], v = n.angles[u][0], y = n.angles[u][1], e = (n.angles[u][3] - n.angles[u][2]) / 2 + n.angles[u][2], o = (y - v) / 2 + v, s = RGraph.getCanvasXY(n.canvas), p = n.Get("chart.gutter.left"), w = n.Get("chart.gutter.top"), h = r.offsetWidth, a = r.offsetHeight, f; r.style.overflow = "", f = new Image, f.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC", f.style.position = "absolute", f.id = "__rgraph_tooltip_pointer__", f.style.top = r.offsetHeight - 2 + "px", r.appendChild(f), s[0] + c + Math.cos(o) * e - h / 2 < 10 ? (r.style.left = s[0] + c + Math.cos(o) * e - h * .1 + "px", r.style.top = s[1] + l + Math.sin(o) * e - a - 5 + "px", f.style.left = h * .1 - 8.5 + "px") : s[0] + c + Math.cos(o) * e + h / 2 > document.body.offsetWidth - 10 ? (r.style.left = s[0] + c + Math.cos(o) * e - h * .9 + "px", r.style.top = s[1] + l + Math.sin(o) * e - a - 5 + "px", f.style.left = h * .9 - 8.5 + "px") : (r.style.left = s[0] + c + Math.cos(o) * e - h / 2 + "px", r.style.top = s[1] + l + Math.sin(o) * e - a - 5 + "px", f.style.left = h * .5 - 8.5 + "px") }, RGraph.Rose.prototype.getRadius = function (n) { if (n < 0 || n > this.max) return null; return n / this.max * this.radius }, RGraph.Rose.prototype.parseColors = function () { for (var n = 0; n < this.properties["chart.colors"].length; ++n)this.properties["chart.colors"][n] = this.parseSingleColorForGradient(this.properties["chart.colors"][n]); if (!RGraph.is_null(this.properties["chart.key.colors"])) for (n = 0; n < this.properties["chart.key.colors"].length; ++n)this.properties["chart.key.colors"][n] = this.parseSingleColorForGradient(this.properties["chart.key.colors"][n]); this.properties["chart.text.color"] = this.parseSingleColorForGradient(this.properties["chart.text.color"]), this.properties["chart.title.color"] = this.parseSingleColorForGradient(this.properties["chart.title.color"]), this.properties["chart.highlight.fill"] = this.parseSingleColorForGradient(this.properties["chart.highlight.fill"]), this.properties["chart.highlight.stroke"] = this.parseSingleColorForGradient(this.properties["chart.highlight.stroke"]) }, RGraph.Rose.prototype.parseSingleColorForGradient = function (n) { var e = this.canvas, u = this.context, t; if (!n || typeof n != "string") return n; if (n.match(/^gradient\((.*)\)$/i)) { var i = RegExp.$1.split(":"), r = u.createRadialGradient(this.centerx, this.centery, 0, this.centerx, this.centery, this.radius), f = 1 / (i.length - 1); for (r.addColorStop(0, RGraph.trim(i[0])), t = 1; t < i.length; ++t)r.addColorStop(t * f, RGraph.trim(i[t])) } return r ? r : n }
|