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.

106 lines
3.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. "pattern": {"url":"patterns/black/pattern21.png", "width":4, "height":4, "color":"#CC0000"}
  16. },
  17. {
  18. "country": "China",
  19. "visits": 1882,
  20. "pattern": {"url":"patterns/black/pattern20.png", "width":4, "height":4}
  21. },
  22. {
  23. "country": "Japan",
  24. "visits": 1809,
  25. "pattern": {"url":"patterns/black/pattern19.png", "width":4, "height":4}
  26. },
  27. {
  28. "country": "Germany",
  29. "visits": 1322,
  30. "pattern": {"url":"patterns/black/pattern18.png", "width":4, "height":4}
  31. },
  32. {
  33. "country": "UK",
  34. "visits": 1122,
  35. "pattern": {"url":"patterns/black/pattern17.png", "width":4, "height":4}
  36. },
  37. {
  38. "country": "France",
  39. "visits": 1114,
  40. "pattern": {"url":"patterns/black/pattern16.png", "width":4, "height":4}
  41. },
  42. {
  43. "country": "India",
  44. "visits": 984,
  45. "pattern": {"url":"patterns/black/pattern15.png", "width":4, "height":4}
  46. },
  47. {
  48. "country": "Spain",
  49. "visits": 711,
  50. "pattern": {"url":"patterns/black/pattern14.png", "width":4, "height":4}
  51. }
  52. ];
  53. AmCharts.ready(function () {
  54. // SERIAL CHART
  55. chart = new AmCharts.AmSerialChart();
  56. chart.dataProvider = chartData;
  57. chart.categoryField = "country";
  58. // AXES
  59. // category
  60. var categoryAxis = chart.categoryAxis;
  61. categoryAxis.gridAlpha = 0;
  62. categoryAxis.axisAlpha = 0;
  63. categoryAxis.gridPosition = "start";
  64. // value
  65. var valueAxis = new AmCharts.ValueAxis();
  66. valueAxis.axisAlpha = 0;
  67. valueAxis.gridAlpha = 0;
  68. chart.addValueAxis(valueAxis);
  69. // GRAPH
  70. var graph = new AmCharts.AmGraph();
  71. graph.valueField = "visits";
  72. graph.balloonText = "[[category]]: <b>[[value]]</b>";
  73. graph.type = "column";
  74. graph.lineAlpha = 0;
  75. graph.lineColor = "#000000";
  76. graph.fillAlphas = 0.8;
  77. graph.patternField = "pattern";
  78. chart.addGraph(graph);
  79. // CURSOR
  80. var chartCursor = new AmCharts.ChartCursor();
  81. chartCursor.cursorAlpha = 0;
  82. chartCursor.zoomable = false;
  83. chartCursor.categoryBalloonEnabled = false;
  84. chart.addChartCursor(chartCursor);
  85. chart.creditsPosition = "top-right";
  86. chart.write("chartdiv");
  87. });
  88. </script>
  89. </head>
  90. <body>
  91. <div id="chartdiv" style="width: 100%; height: 400px;"></div>
  92. </body>
  93. </html>