OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 |
| 3 <!--[if lte IE 8]><SCRIPT src='source/excanvas.js'></script><![endif]--><SCRIPT
src='../ChartNew.js'></script> |
| 4 |
| 5 |
| 6 <SCRIPT> |
| 7 |
| 8 function setColor(area,data,config,i,j,animPct,value) |
| 9 { |
| 10 if(value > 35)return("rgba(220,0,0,"+animPct); |
| 11 else return("rgba(0,220,0,"+animPct); |
| 12 |
| 13 } |
| 14 |
| 15 var charJSPersonnalDefaultOptions = { decimalSeparator : "," , thousandSeparator
: ".", roundNumber : "none", graphTitleFontSize: 2 }; |
| 16 |
| 17 defCanvasWidth=1200; |
| 18 defCanvasHeight=600; |
| 19 |
| 20 var mydata2 = [ |
| 21 { |
| 22 value : 30, |
| 23 color: "#D97041", |
| 24 title : "data1" |
| 25 }, |
| 26 { |
| 27 value : 90, |
| 28 color: "#C7604C", |
| 29 title : "data2" |
| 30 }, |
| 31 { |
| 32 value : 24, |
| 33 color: "#21323D", |
| 34 title : "data3" |
| 35 }, |
| 36 { |
| 37 value : 58, |
| 38 color: "#9D9B7F", |
| 39 title : "data4" |
| 40 }, |
| 41 { |
| 42 value : 82, |
| 43 color: "#7D4F6D", |
| 44 title : "data5" |
| 45 }, |
| 46 { |
| 47 value : 8, |
| 48 color: "#584A5E", |
| 49 title : "data6" |
| 50 } |
| 51 ]; |
| 52 |
| 53 function setFontSize(area,ctx,data,statData,posi,posj,othervars) { |
| 54 if(statData[posi].v6<=5) return(0); // do not display the data
if the slice is less than 5 % |
| 55 else if (statData[posi].v6<10)return(10); // display with font size=1
0 when slice is between 5 and 10 % |
| 56 else return(20); // otherwise, display with
font size= 20 |
| 57 } |
| 58 |
| 59 var opt1 = { |
| 60 animation : false, |
| 61 graphTitle : "issue 169", |
| 62 legend : true, |
| 63 inGraphDataFontSize: setFontSize, |
| 64 inGraphDataShow : true |
| 65 } |
| 66 |
| 67 |
| 68 |
| 69 </SCRIPT> |
| 70 |
| 71 |
| 72 <html> |
| 73 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
| 74 <head> |
| 75 <title>Demo ChartNew.js</title> |
| 76 </head> |
| 77 <body> |
| 78 |
| 79 <center> |
| 80 <FONT SIZE=6><B>Demo of ChartNew.js !</B></FONT> <BR> |
| 81 |
| 82 <script> |
| 83 |
| 84 document.write("<canvas id=\"canvas_Pie1\" height=\""+defCanvasHeight+"\" wi
dth=\""+defCanvasWidth+"\"></canvas>"); |
| 85 |
| 86 window.onload = function() { |
| 87 var myPie = new Chart(document.getElementById("canvas_Pie1").getContext("2d"
)).Pie(mydata2,opt1); |
| 88 } |
| 89 |
| 90 </script> |
| 91 </body> |
| 92 </html> |
OLD | NEW |