You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.4 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>amCharts examples</title>
  6. <link rel="stylesheet" href="style.css" type="text/css">
  7. <script src="../amcharts/amcharts.js" type="text/javascript"></script>
  8. <script src="../amcharts/pie.js" type="text/javascript"></script>
  9. <script>
  10. var chart;
  11. var chartData = [
  12. {
  13. "country": "United States",
  14. "visits": 9252
  15. },
  16. {
  17. "country": "China",
  18. "visits": 1882
  19. },
  20. {
  21. "country": "Japan",
  22. "visits": 1809
  23. },
  24. {
  25. "country": "Germany",
  26. "visits": 1322
  27. },
  28. {
  29. "country": "United Kingdom",
  30. "visits": 1122
  31. },
  32. {
  33. "country": "France",
  34. "visits": 1114
  35. },
  36. {
  37. "country": "India",
  38. "visits": 984
  39. },
  40. {
  41. "country": "Spain",
  42. "visits": 711
  43. }
  44. ];
  45. AmCharts.ready(function () {
  46. // PIE CHART
  47. chart = new AmCharts.AmPieChart();
  48. // title of the chart
  49. chart.addTitle("Visitors countries", 16);
  50. chart.dataProvider = chartData;
  51. chart.titleField = "country";
  52. chart.valueField = "visits";
  53. chart.sequencedAnimation = true;
  54. chart.startEffect = "elastic";
  55. chart.innerRadius = "30%";
  56. chart.startDuration = 2;
  57. chart.labelRadius = 15;
  58. chart.balloonText = "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>";
  59. // the following two lines makes the chart 3D
  60. chart.depth3D = 10;
  61. chart.angle = 15;
  62. // WRITE
  63. chart.write("chartdiv");
  64. });
  65. </script>
  66. </head>
  67. <body>
  68. <div id="chartdiv" style="width:600px; height:400px;"></div>
  69. </body>
  70. </html>