From: edward Date: Thu, 21 Jun 2018 10:24:44 +0000 (+0800) Subject: g.circular.js X-Git-Url: http://git.roojs.org/?p=g.raphael;a=commitdiff_plain;h=bd21e50ae5d033e1756eacd7948b5c54a368efa8 g.circular.js --- diff --git a/g.circular.js b/g.circular.js index b390de2..5d1ba30 100644 --- a/g.circular.js +++ b/g.circular.js @@ -140,21 +140,6 @@ Roo = typeof(Roo) != 'undefined' ? Roo: (imports ? imports.seed.Roo.Roo: {}); dir = (dir && dir.toLowerCase && dir.toLowerCase()) || "east"; mark = paper[mark && mark.toLowerCase()] || "circle"; -// chart.labels = paper.set(); - -// for (var i = 0; i < len; i++) { -// var j = values[i].order, -// txt; -// -// var l = values[i].others ? (otherslabel || "Others") : labels[j]; -// -// chart.labels.push(paper.set()); -// chart.labels[i].push(paper[mark](x + 5, y, 5).attr({ fill: colors[i] || chartinst.colors[i], stroke: "none" })); -// chart.labels[i].push( -// txt = paper.text(x + 20, y, l || values[i]).attr(opts.txtattr || chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"})); -// -// y += txt.getBBox().height * 1.2; -// } for (var i = 0; i < len; i++) { var j = values[i].order, @@ -170,21 +155,21 @@ Roo = typeof(Roo) != 'undefined' ? Roo: (imports ? imports.seed.Roo.Roo: {}); y += txt.getBBox().height * 1.2; } -// for (var i = 0; i < len; i++) { -// var j = values[i].order, -// txt; -// -// if(!values[i].others){ -// continue; -// } -// -// chart.labels.push(paper.set()); -// chart.labels[len - 1].push(paper[mark](x + 5, y, 5).attr({ fill: colors[i] || chartinst.colors[i], stroke: "none" })); -// chart.labels[len - 1].push( -// txt = paper.text(x + 20, y, otherslabel || 'Others').attr(opts.txtattr || chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"})); -// -// y += txt.getBBox().height * 1.2; -// } + for (var i = 0; i < len; i++) { + var j = values[i].order, + txt; + + if(!values[i].others){ + continue; + } + + chart.labels.push(paper.set()); + chart.labels[len - 1].push(paper[mark](x + 5, y, 5).attr({ fill: colors[i] || chartinst.colors[i], stroke: "none" })); + chart.labels[len - 1].push( + txt = paper.text(x + 20, y, otherslabel || 'Others').attr(opts.txtattr || chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"})); + + y += txt.getBBox().height * 1.2; + } // var bb = chart.labels.getBBox(), // tr = {