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.

220 lines
5.7 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 href='http://fonts.googleapis.com/css?family=Covered+By+Your+Grace' rel='stylesheet' type='text/css'>
  7. <link rel="stylesheet" href="style.css" type="text/css">
  8. <script src="../amcharts/amcharts.js" type="text/javascript"></script>
  9. <script src="../amcharts/serial.js" type="text/javascript"></script>
  10. <script>
  11. AmCharts.ready(function() {
  12. makeLineChart();
  13. makeBarChart();
  14. });
  15. //// BAR CHART
  16. var barChartData = [{
  17. "continent": "Australia",
  18. "river": "Darling",
  19. "length": 2739
  20. }, {
  21. "continent": "Europe",
  22. "river": "Volga",
  23. "length": 3692
  24. }, {
  25. "continent": "North America",
  26. "river": "Mississippi",
  27. "length": 6275
  28. }, {
  29. "continent": "Asia",
  30. "river": "Yangtze",
  31. "length": 6300
  32. }, {
  33. "continent": "South America",
  34. "river": "Amazon",
  35. "length": 6400
  36. }, {
  37. "continent": "Africa",
  38. "river": "Nile",
  39. "length": 6650
  40. }];
  41. function makeBarChart() {
  42. // SERIAL CHART
  43. var chart = new AmCharts.AmSerialChart();
  44. chart.dataProvider = barChartData;
  45. chart.rotate = true;
  46. chart.fontSize = 18;
  47. chart.fontFamily = 'Covered By Your Grace';
  48. chart.color = "#FFFFFF";
  49. chart.categoryField = "continent";
  50. chart.startDuration = 0;
  51. chart.handDrawScatter = 3;
  52. chart.columnWidth = 0.5;
  53. chart.handDrawn = true;
  54. var balloon = chart.balloon;
  55. balloon.adjustBorderColor = false;
  56. balloon.borderColor = "#000000";
  57. balloon.fillColor = "#FFFFFF";
  58. balloon.verticalPadding = 0;
  59. var valueAxis = new AmCharts.ValueAxis();
  60. valueAxis.minimum = 0;
  61. valueAxis.axisColor = "#FFFFFF";
  62. valueAxis.gridColor = "#FFFFFF";
  63. chart.addValueAxis(valueAxis);
  64. // AXES
  65. // category
  66. var categoryAxis = chart.categoryAxis;
  67. categoryAxis.labelRotation = 90;
  68. categoryAxis.gridPosition = "start";
  69. categoryAxis.axisColor = "#FFFFFF";
  70. categoryAxis.gridColor = "#FFFFFF";
  71. categoryAxis.gridAlpha = 0;
  72. // GRAPH
  73. var graph = new AmCharts.AmGraph();
  74. graph.valueField = "length";
  75. graph.type = "column";
  76. graph.balloonText = "<span style='font-size:14px'>[[category]]</span><br>[[river]]: [[value]] km.";
  77. graph.lineAlpha = 0;
  78. graph.lineColor = "#FFFFFF";
  79. graph.fillAlphas = 0.8;
  80. graph.lineThickness = 1;
  81. graph.pattern = {
  82. url: "patterns/chalk/pattern1.jpg",
  83. width: 600,
  84. height: 600,
  85. randomY: 300
  86. };
  87. chart.addGraph(graph);
  88. // CURSOR
  89. var chartCursor = new AmCharts.ChartCursor();
  90. chartCursor.cursorAlpha = 0;
  91. chartCursor.zoomable = false;
  92. chartCursor.categoryBalloonEnabled = false;
  93. chart.addChartCursor(chartCursor);
  94. chart.creditsPosition = "top-right";
  95. chart.write("columnChartDiv");
  96. }
  97. //// LINE CHART
  98. var lineChartData = [{
  99. "continent": "Australia",
  100. "mountain": "Kosciusko",
  101. "height": 2228
  102. }, {
  103. "continent": "Africa",
  104. "mountain": "Kilimanjaro",
  105. "height": 5895
  106. }, {
  107. "continent": "Antarctica",
  108. "mountain": "Aconcagua",
  109. "height": 4897
  110. },
  111. {
  112. "continent": "Europe",
  113. "mountain": "Elbrus",
  114. "height": 5642
  115. }, {
  116. "continent": "Asia",
  117. "mountain": "Everest",
  118. "height": 8850
  119. },
  120. {
  121. "continent": "South America",
  122. "mountain": "Aconcagua",
  123. "height": 6960
  124. }, {
  125. "continent": "North America",
  126. "mountain": "McKinley",
  127. "height": 6194
  128. }
  129. ];
  130. function makeLineChart() {
  131. // SERIAL CHART
  132. var lineChart = new AmCharts.AmSerialChart();
  133. lineChart.dataProvider = lineChartData;
  134. lineChart.fontSize = 18;
  135. lineChart.fontFamily = 'Covered By Your Grace';
  136. lineChart.color = "#FFFFFF";
  137. lineChart.categoryField = "continent";
  138. lineChart.marginLeft = 117;
  139. lineChart.startDuration = 0;
  140. lineChart.handDrawn = true;
  141. lineChart.backgroundColor = "#2d2b2c";
  142. var balloon = lineChart.balloon;
  143. balloon.adjustBorderColor = false;
  144. balloon.borderColor = "#000000";
  145. balloon.fillColor = "#FFFFFF";
  146. balloon.verticalPadding = 0;
  147. var valueAxis = new AmCharts.ValueAxis();
  148. valueAxis.minimum = 0;
  149. valueAxis.ignoreAxisWidth = true;
  150. valueAxis.axisColor = "#FFFFFF";
  151. valueAxis.gridColor = "#FFFFFF";
  152. lineChart.addValueAxis(valueAxis);
  153. // AXES
  154. // category
  155. var categoryAxis = lineChart.categoryAxis;
  156. categoryAxis.labelRotation = 90;
  157. categoryAxis.gridPosition = "start";
  158. categoryAxis.axisColor = "#FFFFFF";
  159. categoryAxis.labelRotation = 45;
  160. categoryAxis.gridAlpha = 0;
  161. // GRAPH
  162. var graph = new AmCharts.AmGraph();
  163. graph.valueField = "height";
  164. graph.balloonText = "<span style='font-size:14px'>[[category]]</span><br>[[mountain]]: [[value]] m.";
  165. graph.lineAlpha = 1;
  166. graph.lineColor = "#FFFFFF";
  167. graph.fillAlphas = 0.8;
  168. graph.lineThickness = 4;
  169. graph.bullet = "round";
  170. graph.pattern = {
  171. url: "patterns/chalk/pattern2.jpg",
  172. width: 600,
  173. height: 600
  174. };
  175. lineChart.addGraph(graph);
  176. // CURSOR
  177. var chartCursor = new AmCharts.ChartCursor();
  178. chartCursor.cursorAlpha = 0;
  179. chartCursor.zoomable = false;
  180. chartCursor.categoryBalloonEnabled = false;
  181. lineChart.addChartCursor(chartCursor);
  182. lineChart.write("lineChartDiv");
  183. }
  184. </script>
  185. </head>
  186. <body style="background-image: url('images/board.jpg')">
  187. <div id="lineChartDiv" style="position:absolute;top:100px;left:0px; width:550px; height:350px;"></div>
  188. <div id="columnChartDiv" style="position:absolute;top:100px;left:550px; width:550px; height:308px;"></div>
  189. </body>
  190. </html>