Blame view

samples/radarPolar.html 3.52 KB
eed3c9f67   tom200e   first file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  <html>
      
      <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <title>amCharts examples</title>
          <link rel="stylesheet" href="style.css" type="text/css">
          <script src="../amcharts/amcharts.js" type="text/javascript"></script>
          <script src="../amcharts/radar.js" type="text/javascript"></script>
          
          <script type="text/javascript">
              var chart;
  
              var chartData = [
                  {
                      "direction": "N",
                      "value": 8
                  },
                  {
                      "direction": "NE",
                      "value": 9
                  },
                  {
                      "direction": "E",
                      "value": 4.5
                  },
                  {
                      "direction": "SE",
                      "value": 3.5
                  },
                  {
                      "direction": "S",
                      "value": 9.2
                  },
                  {
                      "direction": "SW",
                      "value": 8.4
                  },
                  {
                      "direction": "W",
                      "value": 11.1
                  },
                  {
                      "direction": "NW",
                      "value": 10
                  }
              ];
  
  
              AmCharts.ready(function () {
                  // RADAR CHART
                  chart = new AmCharts.AmRadarChart();
                  chart.dataProvider = chartData;
                  chart.categoryField = "direction";
                  chart.startDuration = 1;
  
                  // TITLE
                  chart.addTitle("Prevailing winds", 15);
  
                  // VALUE AXIS
                  var valueAxis = new AmCharts.ValueAxis();
                  valueAxis.gridType = "circles";
                  valueAxis.fillAlpha = 0.05;
                  valueAxis.fillColor = "#000000";
                  valueAxis.axisAlpha = 0.2;
                  valueAxis.gridAlpha = 0;
                  valueAxis.fontWeight = "bold";
                  valueAxis.minimum = 0;
                  chart.addValueAxis(valueAxis);
  
                  // GRAPH
                  var graph = new AmCharts.AmGraph();
                  graph.lineColor = "#FFCC00";
                  graph.fillAlphas = 0.4;
                  graph.bullet = "round";
                  graph.valueField = "value";
                  graph.balloonText = "[[category]]: [[value]] m/s";
                  chart.addGraph(graph);
  
                  // GUIDES
                  // blue fill
                  var guide = new AmCharts.Guide();
                  guide.angle = 225;
                  guide.tickLength = 0;
                  guide.toAngle = 315;
                  guide.value = 0;
                  guide.toValue = 14;
                  guide.fillColor = "#0066CC";
                  guide.fillAlpha = 0.6;
                  valueAxis.addGuide(guide);
  
                  // red fill
                  guide = new AmCharts.Guide();
                  guide.angle = 45;
                  guide.tickLength = 0;
                  guide.toAngle = 135;
                  guide.value = 0;
                  guide.toValue = 14;
                  guide.fillColor = "#CC3333";
                  guide.fillAlpha = 0.6;
                  valueAxis.addGuide(guide);
  
                  // WRITE                
                  chart.write("chartdiv");
              });
          </script>
      </head>
      
      <body>
          <div id="chartdiv" style="width:600px; height:400px;"></div>
      </body>
  
  </html>