g.circular.js
authoredward <edward@roojs.com>
Thu, 21 Jun 2018 08:52:38 +0000 (16:52 +0800)
committeredward <edward@roojs.com>
Thu, 21 Jun 2018 08:52:38 +0000 (16:52 +0800)
g.circular.js

index 8d34aaa..5721ac2 100644 (file)
@@ -136,8 +136,7 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
         
         var legend = function (labels, otherslabel, mark, dir) {
             var x = cx + r + r / 5,
-                y = cy,
-                h = y + 10;
+                y = cy - r,
             
             labels = labels || [];
             dir = (dir && dir.toLowerCase && dir.toLowerCase()) || "east";
@@ -151,11 +150,11 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
                 var l = values[i].others ? (otherslabel || "Others") : labels[j];
                 
                 chart.labels.push(paper.set());
-                chart.labels[i].push(paper[mark](x + 5, h, 5).attr({ fill: colors[i] || chartinst.colors[i], stroke: "none" }));
+                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, h, l || values[i]).attr(chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"}));
+                    txt = paper.text(x + 20, y, l || values[i]).attr(chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"}));
                 
-                h += txt.getBBox().height * 1.2;
+                y += txt.getBBox().height * 1.2;
             }
 
             var bb = chart.labels.getBBox(),