Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
776 lars 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
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
7
        <title>amCharts Responsive Example</title>
8
        <script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
9
        <script src="http://www.amcharts.com/lib/3/serial.js"></script>
10
        <script src="../responsive.min.js"></script>
11
        <style>
12
            body,
13
            html {
14
                height: 100%;
15
                padding: 0;
16
                margin: 0;
17
            }
18
        </style>
19
        <script>
20
            var chartData = [];
21
            generateChartData();
22
            var chart = AmCharts.makeChart("chartdiv",
23
            {
24
                "type": "serial",
25
                "dataProvider": chartData,
26
                "categoryField": "date",
27
                "categoryAxis":
28
                {
29
                    "parseDates": true,
30
                    "gridAlpha": 0.15,
31
                    "minorGridEnabled": true,
32
                    "axisColor": "#DADADA"
33
                },
34
                "valueAxes": [
35
                {
36
                    "axisAlpha": 0.2,
37
                    "id": "v1"
38
                }],
39
                "graphs": [
40
                {
41
                    "title": "red line",
42
                    "id": "g1",
43
                    "valueAxis": "v1",
44
                    "valueField": "visits",
45
                    "bullet": "round",
46
                    "bulletBorderColor": "#FFFFFF",
47
                    "bulletBorderAlpha": 1,
48
                    "lineThickness": 2,
49
                    "lineColor": "#b5030d",
50
                    "negativeLineColor": "#0352b5",
51
                    "balloonText": "[[category]]<br><b><span style='font-size:14px;'>value: [[value]]</span></b>"
52
                }],
53
                "chartCursor":
54
                {
55
                    "fullWidth": true,
56
                    "cursorAlpha": 0.1
57
                },
58
                "chartScrollbar":
59
                {
60
                    "scrollbarHeight": 40,
61
                    "color": "#FFFFFF",
62
                    "autoGridCount": true,
63
                    "graph": "g1"
64
                },
65
                "mouseWheelZoomEnabled": true,
66
                "responsive":
67
                {
68
                    "enabled": true
69
                }
70
            });
71
            chart.addListener("dataUpdated", zoomChart);
72
            // generate some random data, quite different range
73
            function generateChartData()
74
            {
75
                var firstDate = new Date();
76
                firstDate.setDate(firstDate.getDate() - 500);
77
                for (var i = 0; i < 500; i++)
78
                {
79
                    // we create date objects here. In your data, you can have date strings
80
                    // and then set format of your dates using chart.dataDateFormat property,
81
                    // however when possible, use date objects, as this will speed up chart rendering.
82
                    var newDate = new Date(firstDate);
83
                    newDate.setDate(newDate.getDate() + i);
84
                    var visits = Math.round(Math.random() * 40) - 20;
85
                    chartData.push(
86
                    {
87
                        date: newDate,
88
                        visits: visits
89
                    });
90
                }
91
            }
92
            // this method is called when chart is first inited as we listen for "dataUpdated" event
93
            function zoomChart()
94
            {
95
                // different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues
96
                chart.zoomToIndexes(chartData.length - 40, chartData.length - 1);
97
            }
98
        </script>
99
    </head>
100
 
101
    <body>
102
        <div id="chartdiv" style="width: 100%; height: 100%;"></div>
103
    </body>
104
 
105
</html>