pie.html 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Pie Chart</title>
  5. <script src="../Chart.js"></script>
  6. </head>
  7. <body>
  8. <div id="canvas-holder">
  9. <canvas id="chart-area" width="300" height="300"/>
  10. </div>
  11. <script>
  12. var pieData = [
  13. {
  14. value: 300,
  15. color:"#F7464A",
  16. highlight: "#FF5A5E",
  17. label: "Red"
  18. },
  19. {
  20. value: 50,
  21. color: "#46BFBD",
  22. highlight: "#5AD3D1",
  23. label: "Green"
  24. },
  25. {
  26. value: 100,
  27. color: "#FDB45C",
  28. highlight: "#FFC870",
  29. label: "Yellow"
  30. },
  31. {
  32. value: 40,
  33. color: "#949FB1",
  34. highlight: "#A8B3C5",
  35. label: "Grey"
  36. },
  37. {
  38. value: 120,
  39. color: "#4D5360",
  40. highlight: "#616774",
  41. label: "Dark Grey"
  42. }
  43. ];
  44. window.onload = function(){
  45. var ctx = document.getElementById("chart-area").getContext("2d");
  46. window.myPie = new Chart(ctx).Pie(pieData);
  47. };
  48. </script>
  49. </body>
  50. </html>