Subversion Repositories php-qbpwcf

Rev

Rev 23 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 liveuser 1
<!DOCTYPE html>
2
<html>
3
  <head>
4
    <meta charset="utf-8" />
5
 
6
    <style>
7
      html, body {
8
        width: 100%;
9
        height: 100%;
10
        margin: 0px;
11
      }
12
 
13
      #chartdiv {
14
        width: 100%;
15
        height: 100%;
16
      }
17
    </style>
18
  </head>
19
  <body>
20
    <script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
21
    <script src="http://www.amcharts.com/lib/3/pie.js"></script>
22
    <script src="http://www.amcharts.com/lib/3/themes/light.js"></script>
23
    <script src="../animate.min.js"></script>
24
 
25
    <div id="chartdiv"></div>
26
 
27
    <script>
28
      var chart = AmCharts.makeChart("chartdiv", {
29
        "type": "pie",
30
        "theme": "light",
31
        "dataProvider": generateChartData(),
32
        "valueField": "value",
33
        "titleField": "category",
34
        "labelRadiusField": "labelRadius",
35
        "alphaField": "alpha",
36
        "startDuration": 0
37
      });
38
 
39
 
40
      function generateChartData() {
41
        var chartData = [];
42
 
43
        for ( var i = 0; i < 10; i++ ) {
44
          var value = Math.floor(Math.random() * 100);
45
          var labelRadius = Math.floor(Math.random() * 100);
46
          var alpha = Math.random();
47
 
48
          chartData.push( {
49
            category: "" + i,
50
            value: value,
51
            labelRadius: labelRadius,
52
            alpha: alpha
53
          } );
54
        }
55
 
56
        return chartData;
57
      }
58
 
59
 
60
      function loop() {
61
        var data = generateChartData();
62
 
63
        chart.animateData(data, {
64
          duration: 1000,
65
          complete: function () {
66
            setTimeout(loop, 2000);
67
          }
68
        });
69
      }
70
 
71
      chart.addListener("init", function () {
72
        setTimeout(loop, 1000);
73
      });
74
    </script>
75
  </body>
76
</html>