| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
| 5 | <title>color cycles</title> |
| 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
| 7 | |
| 8 | </head> |
| 9 | <body> |
| 10 | <p>Different color cycles</p> |
| 11 | |
| 12 | <div id="blah"></div> |
| 13 | <p><b>Colors: </b> |
| 14 | <button type=button id=0 onClick="change(this)"> first set</button> |
| 15 | <button type=button id=1 onClick="change(this)"> second set</button> |
| 16 | <button type=button id=2 onClick="change(this)"> undefined</button> |
| 17 | </p> |
| 18 | |
| 19 | <script type="text/javascript"> |
| 20 | var colorSets = [ |
| 21 | ['#284785', '#EE1111', '#8AE234'], |
| 22 | ['#444444', '#888888', '#DDDDDD'], |
| 23 | null |
| 24 | ] |
| 25 | chart = new Dygraph(document.getElementById("blah"), |
| 26 | "X,a,b,c\n" + |
| 27 | "10,12345,23456,34567\n" + |
| 28 | "11,12345,20123,31345\n", |
| 29 | { |
| 30 | width: 640, |
| 31 | height: 480, |
| 32 | colors: colorSets[0] |
| 33 | }); |
| 34 | |
| 35 | function change(el) { |
| 36 | chart.updateOptions({colors: colorSets[el.id]}); |
| 37 | } |
| 38 | </script> |
| 39 | </body> |
| 40 | </html> |