Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <script src="http://www.chartjs.org/assets/Chart.min.js"></script>
  7. </head>
  8. <body>
  9. <div style="width:50%;text-align:center;display:block;margin:0 auto;font-family:arial;">
  10. <div>
  11. <h1>SmartGov Line Graph: Example Of Interactivity</h1>
  12. <canvas id="canvas" height="450" width="600"></canvas>
  13. </div>
  14. </div>
  15.  
  16.  
  17. <script>
  18. var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
  19. var lineChartData = {
  20. labels : ["January","February","March","April","May","June","July"],
  21. datasets : [
  22. {
  23. label: "My First dataset",
  24. fillColor : "rgba(168, 27, 100, 0.2)",
  25. strokeColor : "#a81b64",
  26. pointColor : "#a81b64",
  27. pointStrokeColor : "#a81b64",
  28. pointHighlightFill : "#a81b64",
  29. pointHighlightStroke : "#a81b64",
  30. data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
  31. },
  32. {
  33. label: "My Second dataset",
  34. fillColor : "rgba(183, 183, 183, 0.2)",
  35. strokeColor : "#b7b7b7",
  36. pointColor : "#b7b7b7",
  37. pointStrokeColor : "#b7b7b7",
  38. pointHighlightFill : "#b7b7b7",
  39. pointHighlightStroke : "#b7b7b7",
  40. data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
  41. }
  42. ]
  43. }
  44. window.onload = function(){
  45. var ctx = document.getElementById("canvas").getContext("2d");
  46. window.myLine = new Chart(ctx).Line(lineChartData, {
  47. responsive: true
  48. });
  49. }
  50. </script>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement