| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
| 5 | <title>reverse y-axis</title> |
| 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
| 7 | |
| 8 | </head> |
| 9 | <body> |
| 10 | <h2>Reverse y-axis</h2> |
| 11 | <font size=-1>This test uses the same data as the <a |
| 12 | href='demo.html'>demo</a> test, but reverses the y-axis.</font><br/> |
| 13 | <table><tr><td> |
| 14 | <div id="demodiv"></div> |
| 15 | </td><td valign=top> |
| 16 | <div id="status" style="width:200px; font-size:0.8em; padding-top:5px;"></div> |
| 17 | </td> |
| 18 | </tr></table> |
| 19 | <script type="text/javascript"> |
| 20 | g = new Dygraph( |
| 21 | document.getElementById("demodiv"), |
| 22 | function() { |
| 23 | var zp = function(x) { if (x < 10) return "0"+x; else return x; }; |
| 24 | var r = "date,parabola,line,another line,sine wave\n"; |
| 25 | for (var i=1; i<=31; i++) { |
| 26 | r += "200610" + zp(i); |
| 27 | r += "," + 10*(i*(31-i)); |
| 28 | r += "," + 10*(8*i); |
| 29 | r += "," + 10*(250 - 8*i); |
| 30 | r += "," + 10*(125 + 125 * Math.sin(0.3*i)); |
| 31 | r += "\n"; |
| 32 | } |
| 33 | return r; |
| 34 | }, |
| 35 | { |
| 36 | rollPeriod: 1, |
| 37 | labelsDiv: document.getElementById('status'), |
| 38 | labelsSeparateLines: true, |
| 39 | labelsKMB: true, |
| 40 | colors: ["rgb(51,204,204)", |
| 41 | "rgb(255,100,100)", |
| 42 | "#00DD55", |
| 43 | "rgba(50,50,200,0.4)"], |
| 44 | width: 480, |
| 45 | height: 320, |
| 46 | valueRange: [3000, 0] // Reverse y-axis |
| 47 | } |
| 48 | ); |
| 49 | </script> |
| 50 | </body> |
| 51 | </html> |