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

index c9908f9..2c121fb 100644 (file)
@@ -142,36 +142,36 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
             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,
                     txt;
 
-                if(values[i].others){
-                    continue;
-                }
+                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, labels[j] || values[i]).attr(opts.txtattr || chartinst.txtattr).attr({ fill: opts.legendcolor || "#000", "text-anchor": "start"}));
+                    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,
+//                    txt;
+//
+//                if(values[i].others){
+//                    continue;
+//                }
+//                
+//                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, labels[j] || 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,
 //                    txt;