Mas

Mas

  • NA
  • 473
  • 64.9k

How we can pass the below values through JSON to this script

Jan 22 2020 9:11 AM
  1. <!DOCTYPE html>  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head runat="server">  
  4. <title>ChartJS - Pie Chart</title>  
  5. <script src="jquery-2.1.4.min.js"></script>  
  6. <script src="Chart.js"></script>  
  7. </head>  
  8. <body>  
  9. <canvas id="mycanvas" width="256" height="256" />  
  10. <script>  
  11. $(document).ready(function(){  
  12. var ctx = $("#mycanvas").get(0).getContext("2d");  
  13. var data = [  
  14. {  
  15. value: 150,  
  16. color: "cornflowerblue",  
  17. //highlight: "lightskyblue",  
  18. label: "Bigdata"  
  19. },  
  20. {  
  21. value: 100,  
  22. color: "lightgreen",  
  23. //highlight: "yellowgreen",  
  24. label: "Mechin Learning"  
  25. },  
  26. {  
  27. value: 40,  
  28. color: "orange",  
  29. //highlight: "darkorange",  
  30. label: "Java"  
  31. },  
  32. {  
  33. value: 70,  
  34. color: "lightgray",  
  35. //highlight: "yellowgreen",  
  36. label: "C#"  
  37. }  
  38. ];  
  39. //draw  
  40. var piechart = new Chart(ctx).Pie(data);  
  41. });  
  42. </script>  
  43. </body>  
  44. </html>  

Answers (2)