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.

112 lines
3.5 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/radar.js" type="text/javascript"></script>
  9. <script>
  10. var chart;
  11. var chartData = [
  12. {
  13. "direction": "N",
  14. "value": 8
  15. },
  16. {
  17. "direction": "NE",
  18. "value": 9
  19. },
  20. {
  21. "direction": "E",
  22. "value": 4.5
  23. },
  24. {
  25. "direction": "SE",
  26. "value": 3.5
  27. },
  28. {
  29. "direction": "S",
  30. "value": 9.2
  31. },
  32. {
  33. "direction": "SW",
  34. "value": 8.4
  35. },
  36. {
  37. "direction": "W",
  38. "value": 11.1
  39. },
  40. {
  41. "direction": "NW",
  42. "value": 10
  43. }
  44. ];
  45. AmCharts.ready(function () {
  46. // RADAR CHART
  47. chart = new AmCharts.AmRadarChart();
  48. chart.dataProvider = chartData;
  49. chart.categoryField = "direction";
  50. chart.startDuration = 1;
  51. // TITLE
  52. chart.addTitle("Prevailing winds", 15);
  53. // VALUE AXIS
  54. var valueAxis = new AmCharts.ValueAxis();
  55. valueAxis.gridType = "circles";
  56. valueAxis.fillAlpha = 0.05;
  57. valueAxis.fillColor = "#000000";
  58. valueAxis.axisAlpha = 0.2;
  59. valueAxis.gridAlpha = 0;
  60. valueAxis.fontWeight = "bold";
  61. valueAxis.minimum = 0;
  62. chart.addValueAxis(valueAxis);
  63. // GRAPH
  64. var graph = new AmCharts.AmGraph();
  65. graph.lineColor = "#FFCC00";
  66. graph.fillAlphas = 0.4;
  67. graph.bullet = "round";
  68. graph.valueField = "value";
  69. graph.balloonText = "[[category]]: [[value]] m/s";
  70. chart.addGraph(graph);
  71. // GUIDES
  72. // blue fill
  73. var guide = new AmCharts.Guide();
  74. guide.angle = 225;
  75. guide.tickLength = 0;
  76. guide.toAngle = 315;
  77. guide.value = 0;
  78. guide.toValue = 14;
  79. guide.fillColor = "#0066CC";
  80. guide.fillAlpha = 0.6;
  81. valueAxis.addGuide(guide);
  82. // red fill
  83. guide = new AmCharts.Guide();
  84. guide.angle = 45;
  85. guide.tickLength = 0;
  86. guide.toAngle = 135;
  87. guide.value = 0;
  88. guide.toValue = 14;
  89. guide.fillColor = "#CC3333";
  90. guide.fillAlpha = 0.6;
  91. valueAxis.addGuide(guide);
  92. // WRITE
  93. chart.write("chartdiv");
  94. });
  95. </script>
  96. </head>
  97. <body>
  98. <div id="chartdiv" style="width:600px; height:400px;"></div>
  99. </body>
  100. </html>