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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
<html>
3
 
4
    <head>
5
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
        <title>amCharts examples</title>
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
            var chart;
12
 
13
            var chartData = [
14
                {
15
                    "year": 2005,
16
                    "income": 23.5,
17
                    "expenses": 18.1
18
                },
19
                {
20
                    "year": 2006,
21
                    "income": 26.2,
22
                    "expenses": 22.8
23
                },
24
                {
25
                    "year": 2007,
26
                    "income": 30.1,
27
                    "expenses": 23.9
28
                },
29
                {
30
                    "year": 2008,
31
                    "income": 29.5,
32
                    "expenses": 25.1
33
                },
34
                {
35
                    "year": 2009,
36
                    "income": 24.6,
37
                    "expenses": 25
38
                }
39
            ];
40
 
41
 
42
            AmCharts.ready(function () {
43
                // SERIAL CHART
44
                chart = new AmCharts.AmSerialChart();
45
                chart.dataProvider = chartData;
46
                chart.categoryField = "year";
47
                chart.startDuration = 1;
48
                chart.plotAreaBorderColor = "#DADADA";
49
                chart.plotAreaBorderAlpha = 1;
50
                // this single line makes the chart a bar chart
51
                chart.rotate = true;
52
 
53
                // AXES
54
                // Category
55
                var categoryAxis = chart.categoryAxis;
56
                categoryAxis.gridPosition = "start";
57
                categoryAxis.gridAlpha = 0.1;
58
                categoryAxis.axisAlpha = 0;
59
 
60
                // Value
61
                var valueAxis = new AmCharts.ValueAxis();
62
                valueAxis.axisAlpha = 0;
63
                valueAxis.gridAlpha = 0.1;
64
                valueAxis.position = "top";
65
                chart.addValueAxis(valueAxis);
66
 
67
                // GRAPHS
68
                // first graph
69
                var graph1 = new AmCharts.AmGraph();
70
                graph1.type = "column";
71
                graph1.title = "Income";
72
                graph1.valueField = "income";
73
                graph1.balloonText = "Income:[[value]]";
74
                graph1.lineAlpha = 0;
75
                graph1.fillColors = "#ADD981";
76
                graph1.fillAlphas = 1;
77
                chart.addGraph(graph1);
78
 
79
                // second graph
80
                var graph2 = new AmCharts.AmGraph();
81
                graph2.type = "column";
82
                graph2.title = "Expenses";
83
                graph2.valueField = "expenses";
84
                graph2.balloonText = "Expenses:[[value]]";
85
                graph2.lineAlpha = 0;
86
                graph2.fillColors = "#81acd9";
87
                graph2.fillAlphas = 1;
88
                chart.addGraph(graph2);
89
 
90
                // LEGEND
91
                var legend = new AmCharts.AmLegend();
92
                chart.addLegend(legend);
93
 
94
                chart.creditsPosition = "top-right";
95
 
96
                // WRITE
97
                chart.write("chartdiv");
98
            });
99
        </script>
100
    </head>
101
 
102
    <body>
103
        <div id="chartdiv" style="width:500px; height:600px;"></div>
104
    </body>
105
 
106
</html>