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.

154 lines
4.8 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/serial.js" type="text/javascript"></script>
  9. <script>
  10. var chart;
  11. var chartData = [
  12. {
  13. "country": "USA",
  14. "visits": 4025,
  15. "color": "#FF0F00"
  16. },
  17. {
  18. "country": "China",
  19. "visits": 1882,
  20. "color": "#FF6600"
  21. },
  22. {
  23. "country": "Japan",
  24. "visits": 1809,
  25. "color": "#FF9E01"
  26. },
  27. {
  28. "country": "Germany",
  29. "visits": 1322,
  30. "color": "#FCD202"
  31. },
  32. {
  33. "country": "UK",
  34. "visits": 1122,
  35. "color": "#F8FF01"
  36. },
  37. {
  38. "country": "France",
  39. "visits": 1114,
  40. "color": "#B0DE09"
  41. },
  42. {
  43. "country": "India",
  44. "visits": 984,
  45. "color": "#04D215"
  46. },
  47. {
  48. "country": "Spain",
  49. "visits": 711,
  50. "color": "#0D8ECF"
  51. },
  52. {
  53. "country": "Netherlands",
  54. "visits": 665,
  55. "color": "#0D52D1"
  56. },
  57. {
  58. "country": "Russia",
  59. "visits": 580,
  60. "color": "#2A0CD0"
  61. },
  62. {
  63. "country": "South Korea",
  64. "visits": 443,
  65. "color": "#8A0CCF"
  66. },
  67. {
  68. "country": "Canada",
  69. "visits": 441,
  70. "color": "#CD0D74"
  71. },
  72. {
  73. "country": "Brazil",
  74. "visits": 395,
  75. "color": "#754DEB"
  76. },
  77. {
  78. "country": "Italy",
  79. "visits": 386,
  80. "color": "#DDDDDD"
  81. },
  82. {
  83. "country": "Australia",
  84. "visits": 384,
  85. "color": "#999999"
  86. },
  87. {
  88. "country": "Taiwan",
  89. "visits": 338,
  90. "color": "#333333"
  91. },
  92. {
  93. "country": "Poland",
  94. "visits": 328,
  95. "color": "#000000"
  96. }
  97. ];
  98. AmCharts.ready(function () {
  99. // SERIAL CHART
  100. chart = new AmCharts.AmSerialChart();
  101. chart.dataProvider = chartData;
  102. chart.categoryField = "country";
  103. // the following two lines makes chart 3D
  104. chart.depth3D = 20;
  105. chart.angle = 30;
  106. // AXES
  107. // category
  108. var categoryAxis = chart.categoryAxis;
  109. categoryAxis.labelRotation = 90;
  110. categoryAxis.dashLength = 5;
  111. categoryAxis.gridPosition = "start";
  112. // value
  113. var valueAxis = new AmCharts.ValueAxis();
  114. valueAxis.title = "Visitors";
  115. valueAxis.dashLength = 5;
  116. chart.addValueAxis(valueAxis);
  117. // GRAPH
  118. var graph = new AmCharts.AmGraph();
  119. graph.valueField = "visits";
  120. graph.colorField = "color";
  121. graph.balloonText = "<span style='font-size:14px'>[[category]]: <b>[[value]]</b></span>";
  122. graph.type = "column";
  123. graph.lineAlpha = 0;
  124. graph.fillAlphas = 1;
  125. chart.addGraph(graph);
  126. // CURSOR
  127. var chartCursor = new AmCharts.ChartCursor();
  128. chartCursor.cursorAlpha = 0;
  129. chartCursor.zoomable = false;
  130. chartCursor.categoryBalloonEnabled = false;
  131. chart.addChartCursor(chartCursor);
  132. chart.creditsPosition = "top-right";
  133. // WRITE
  134. chart.write("chartdiv");
  135. });
  136. </script>
  137. </head>
  138. <body>
  139. <div id="chartdiv" style="width: 100%; height: 400px;"></div>
  140. </body>
  141. </html>