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.

100 lines
3.2 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. "country": "Czech Republic",
  13. "litres": 301.9,
  14. "pattern": {
  15. "url": "patterns/black/pattern1.png",
  16. "width": 4,
  17. "height": 4,
  18. "color": "#cc0000"
  19. }
  20. }, {
  21. "country": "Ireland",
  22. "litres": 201.1,
  23. "pattern": {
  24. "url": "patterns/black/pattern2.png",
  25. "width": 4,
  26. "height": 4
  27. }
  28. }, {
  29. "country": "Germany",
  30. "litres": 165.8,
  31. "pattern": {
  32. "url": "patterns/black/pattern3.png",
  33. "width": 4,
  34. "height": 4
  35. }
  36. }, {
  37. "country": "Australia",
  38. "litres": 139.9,
  39. "pattern": {
  40. "url": "patterns/black/pattern4.png",
  41. "width": 4,
  42. "height": 4
  43. }
  44. }, {
  45. "country": "Austria",
  46. "litres": 128.3,
  47. "pattern": {
  48. "url": "patterns/black/pattern5.png",
  49. "width": 4,
  50. "height": 4
  51. }
  52. }, {
  53. "country": "UK",
  54. "litres": 99,
  55. "pattern": {
  56. "url": "patterns/black/pattern6.png",
  57. "width": 4,
  58. "height": 4
  59. }
  60. }, {
  61. "country": "Belgium",
  62. "litres": 60,
  63. "pattern": {
  64. "url": "patterns/black/pattern7.png",
  65. "width": 4,
  66. "height": 4
  67. }
  68. }];
  69. AmCharts.ready(function() {
  70. // PIE CHART
  71. chart = new AmCharts.AmPieChart();
  72. chart.dataProvider = chartData;
  73. chart.titleField = "country";
  74. chart.valueField = "litres";
  75. chart.patternField = "pattern";
  76. chart.outlineColor = "#000000";
  77. chart.outlineAlpha = 0.6;
  78. chart.balloonText = "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>";
  79. var legend = new AmCharts.AmLegend();
  80. legend.markerBorderColor = "#000000";
  81. legend.switchType = undefined;
  82. legend.align = "center";
  83. chart.addLegend(legend);
  84. // WRITE
  85. chart.write("chartdiv");
  86. });
  87. </script>
  88. </head>
  89. <body>
  90. <div id="chartdiv" style="width: 100%; height: 400px;"></div>
  91. </body>
  92. </html>