fix #7664 = graph error
authorAlan <alan@roojs.com>
Thu, 25 May 2023 07:36:33 +0000 (15:36 +0800)
committerAlan <alan@roojs.com>
Thu, 25 May 2023 07:36:33 +0000 (15:36 +0800)
g.pie.sector.js
test/bartest.html

index 5ab668f..01ddd27 100644 (file)
@@ -99,17 +99,17 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
             }
             
             for (i = 0; i < len; i++) {
-                // minimum degree of a pie shown
-                if (defcut && values[i] * 360 / total <= 1.5) {
-                    cut = i;
-                    defcut = false;
-                }
-
                 if (i > cut) {
                     defcut = false;
                     values[cut].value += values[i];
                     values[cut].others = true;
                 }
+
+                // minimum degree of a pie shown
+                if (defcut && values[i] * 360 / total <= 1.5) {
+                    cut = i;
+                    defcut = false;
+                }
             }
             
             len = Math.min(cut + 1, values.length);
index bfee2b2..0b98eef 100644 (file)
                 // console.log(r);
 
 
-        r.piesectorchart(550, 450, 275, 150, 105, [52,27,31,9,31,20,12,5,2,29,23,4,2,2,4,1,2], {
+        r.piesectorchart(400, 450, 200, 150, 105, [133,2,64,125,21,1024,37,1,5], {
             background: '#FFFFFF',
             barwidth : 70,
             colors:  ["#83DBFF","#F9C80A","#1E47DA","#B21ADF","#FF11BA","#FF8C30"],
             cut: 5,
             others: 'Others - #qty# (#%#)',
-            labels: ["#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#"],
+            labels: ["#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#","#%#"],
             labelfont: 'Work Sans',
             labelsize: 20,
             labelweight: 600,
-            legend:  ["Hong Kong S.A.R. - #qty# (#%#)","Singapore - #qty# (#%#)","India - #qty# (#%#)","Australia - #qty# (#%#)","Taiwan - #qty# (#%#)","Indonesia - #qty# (#%#)","Philippines - #qty# (#%#)","New Zealand - #qty# (#%#)","Cambodia - #qty# (#%#)","Malaysia - #qty# (#%#)","Vietnam - #qty# (#%#)","Thailand - #qty# (#%#)","Asia Pacific - #qty# (#%#)","South Korea - #qty# (#%#)","Macao S.A.R. - #qty# (#%#)","Pakistan - #qty# (#%#)","Laos - #qty# (#%#)"],
+            legend:  ["Germany - #qty# (#%#)","Austria - #qty# (#%#)","United Kingdom - #qty# (#%#)","France - #qty# (#%#)","Italy - #qty# (#%#)","Spain - #qty# (#%#)","Belgium - #qty# (#%#)","Sweden - #qty# (#%#)","Europe - #qty# (#%#)"],
             legendpos: 'bottom',
             legendkeyshape: 'rect',
             legendkeysize: 14,
             legendfont: 'Work Sans',
             legendfontsize: 14,
             legendfontcolor: '#323232',
-            lineheight : 40,
-            legendcolumn : 2
+            lineheight: 23,
+            legendcolumn: 1
         });