Advertisement
jsbsan

plantilla graficas javascript

Apr 18th, 2014
1,804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.29 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.   <head>
  4.     <title>Bar Chart</title>
  5.     <script src="../Chart.js"></script>
  6.     <script src="../legend.js"></script>
  7.     <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
  8.     <style>
  9.       canvas{
  10.       }
  11.     </style>
  12.   </head>
  13.   <body>
  14.  
  15.   <div>
  16.     <canvas id="canvas" height="300" width="300"></canvas>
  17.     <div id="lineLegend"></div>
  18.   </div>
  19.  
  20.   <script>
  21.  
  22.     var barChartData = {
  23.       labels : [#meses],
  24.       datasets : [
  25.         {
  26.           fillColor : "rgba(220,220,220,0.5)",
  27.           strokeColor : "rgba(220,220,220,1)",
  28.           data : [#datos1],
  29.           title: '#titulo1'
  30.         },
  31.         {
  32.           fillColor : "rgba(151,187,205,0.5)",
  33.           strokeColor : "rgba(151,187,205,1)",
  34.           data : [#datos2],
  35.           title: '#titulo2'
  36.         },
  37.         {
  38.           fillColor : "rgba(255,0,0,0.5)",
  39.           strokeColor : "rgba(250,0,0,1)",
  40.           data : [#datos3],
  41.           title: '#titulo3'
  42.         }
  43.       ]
  44.      
  45.    
  46. };
  47.   var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Bar(barChartData);
  48.   var ctx = document.getElementById("canvas").getContext("2d");
  49.  
  50.   legend(document.getElementById("lineLegend"), barChartData);
  51.  
  52.   </script>
  53.   </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement