OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 <html> |
| 3 <head> |
| 4 <meta http-equiv="content-type" content="text/html; charset=windows-1250"> |
| 5 <meta name="generator" content="PSPad editor, www.pspad.com"> |
| 6 <title></title> |
| 7 <!--[if lte IE 8]><SCRIPT src='source/excanvas.js'></script><![endif]--><SCRIP
T src='../ChartNew.js'></script> |
| 8 </head> |
| 9 <body> |
| 10 <canvas id="mycanvas1" height="800" width="1400"></canvas>
|
| 11 <canvas id="mycanvas2" height="800" width="1400"></canvas>
|
| 12 <script> |
| 13 var mydata1 = { |
| 14 labels : ["January","February","March","April","May","June","July"], |
| 15 datasets : [ |
| 16 { |
| 17 fillColor : "rgba(220,220,220,0.5)", |
| 18 strokeColor : "rgba(220,220,220,1)", |
| 19 pointColor : "rgba(220,220,220,1)", |
| 20 pointStrokeColor : "#fff", |
| 21 data : [65,-59,90,81,-56,55,40], |
| 22 title : "First data" |
| 23 }, |
| 24 { |
| 25 fillColor : "rgba(151,187,205,0.5)", |
| 26 strokeColor : "rgba(151,187,205,1)", |
| 27 pointColor : "rgba(151,187,205,1)", |
| 28 pointStrokeColor : "#fff", |
| 29 data : [28,48,-40,19,96,-27,100], |
| 30 title : "Second data" |
| 31 } |
| 32 ] |
| 33 }; |
| 34 var mydata2 = { |
| 35 labels : ["January","February","March","April","May","June","July"], |
| 36 datasets : [ |
| 37 { |
| 38 fillColor : "rgba(220,220,220,0.5)", |
| 39 strokeColor : "rgba(220,220,220,1)", |
| 40 pointColor : "rgba(220,220,220,1)", |
| 41 pointStrokeColor : "#fff", |
| 42 data : [65,59,90,81,56,55,40], |
| 43 title : "First data" |
| 44 }, |
| 45 { |
| 46 fillColor : "rgba(151,187,205,0.5)", |
| 47 strokeColor : "rgba(151,187,205,1)", |
| 48 pointColor : "rgba(151,187,205,1)", |
| 49 pointStrokeColor : "#fff", |
| 50 data : [28,48,40,19,96,27,100], |
| 51 title : "Second data" |
| 52 } |
| 53 ] |
| 54 }; |
| 55 |
| 56 function computeScaleStepWidth(area,ctx,data,statData,posi,posj,othervars) { |
| 57 return 10; |
| 58 }; |
| 59 |
| 60 function computeStepValue(area,ctx,data,statData,posi,posj,othervars) { |
| 61 return 20; |
| 62 }; |
| 63 |
| 64 function computeStartValue(area,ctx,data,statData,posi,posj,othervars) { |
| 65 var minimumValue=Number.MAX_VALUE; |
| 66 for(var i=0;i<data.datasets.length;i++) { |
| 67 for (var j=0;j<data.datasets[i].data.length;j++) minimumValue=Ma
th.min(minimumValue,1*data.datasets[i].data[j]); |
| 68 } |
| 69 if(minimumValue>=0)return(0); |
| 70 else return(-100); |
| 71 }; |
| 72 |
| 73 var options = |
| 74 { |
| 75 scaleOverride: true, |
| 76 scaleSteps: computeStepValue, |
| 77 scaleStepWidth: computeScaleStepWidth, |
| 78 scaleStartValue : computeStartValue |
| 79 }; |
| 80 |
| 81 window.onload = function() { |
| 82 var myLine1 = new Chart(document.getElementById("mycanvas1").getContext("2d"
)).Line(mydata1,options); |
| 83 var myLine2 = new Chart(document.getElementById("mycanvas2").getContext("2d"
)).Line(mydata2,options); |
| 84 } |
| 85 </script> |
| 86 |
| 87 </body> |
| 88 </html> |
OLD | NEW |