Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
<!DOCTYPE HTML>
2
<html>
3
	<head>
4
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
		<title>Highcharts Example</title>
6
 
7
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
8
		<style type="text/css">
9
#container {
10
	height: 400px;
11
	min-width: 310px;
12
	max-width: 800px;
13
	margin: 0 auto;
14
}
15
		</style>
16
		<script type="text/javascript">
17
$(function () {
18
 
19
    // Give the points a 3D feel by adding a radial gradient
20
    Highcharts.getOptions().colors = $.map(Highcharts.getOptions().colors, function (color) {
21
        return {
22
            radialGradient: {
23
                cx: 0.4,
24
                cy: 0.3,
25
                r: 0.5
26
            },
27
            stops: [
28
                [0, color],
29
                [1, Highcharts.Color(color).brighten(-0.2).get('rgb')]
30
            ]
31
        };
32
    });
33
 
34
    // Set up the chart
35
    var chart = new Highcharts.Chart({
36
        chart: {
37
            renderTo: 'container',
38
            margin: 100,
39
            type: 'scatter',
40
            options3d: {
41
                enabled: true,
42
                alpha: 10,
43
                beta: 30,
44
                depth: 250,
45
                viewDistance: 5,
46
 
47
                frame: {
48
                    bottom: { size: 1, color: 'rgba(0,0,0,0.02)' },
49
                    back: { size: 1, color: 'rgba(0,0,0,0.04)' },
50
                    side: { size: 1, color: 'rgba(0,0,0,0.06)' }
51
                }
52
            }
53
        },
54
        title: {
55
            text: 'Draggable box'
56
        },
57
        subtitle: {
58
            text: 'Click and drag the plot area to rotate in space'
59
        },
60
        plotOptions: {
61
            scatter: {
62
                width: 10,
63
                height: 10,
64
                depth: 10
65
            }
66
        },
67
        yAxis: {
68
            min: 0,
69
            max: 10,
70
            title: null
71
        },
72
        xAxis: {
73
            min: 0,
74
            max: 10,
75
            gridLineWidth: 1
76
        },
77
        zAxis: {
78
            min: 0,
79
            max: 10,
80
            showFirstLabel: false
81
        },
82
        legend: {
83
            enabled: false
84
        },
85
        series: [{
86
            name: 'Reading',
87
            colorByPoint: true,
88
            data: [[1, 6, 5], [8, 7, 9], [1, 3, 4], [4, 6, 8], [5, 7, 7], [6, 9, 6], [7, 0, 5], [2, 3, 3], [3, 9, 8], [3, 6, 5], [4, 9, 4], [2, 3, 3], [6, 9, 9], [0, 7, 0], [7, 7, 9], [7, 2, 9], [0, 6, 2], [4, 6, 7], [3, 7, 7], [0, 1, 7], [2, 8, 6], [2, 3, 7], [6, 4, 8], [3, 5, 9], [7, 9, 5], [3, 1, 7], [4, 4, 2], [3, 6, 2], [3, 1, 6], [6, 8, 5], [6, 6, 7], [4, 1, 1], [7, 2, 7], [7, 7, 0], [8, 8, 9], [9, 4, 1], [8, 3, 4], [9, 8, 9], [3, 5, 3], [0, 2, 4], [6, 0, 2], [2, 1, 3], [5, 8, 9], [2, 1, 1], [9, 7, 6], [3, 0, 2], [9, 9, 0], [3, 4, 8], [2, 6, 1], [8, 9, 2], [7, 6, 5], [6, 3, 1], [9, 3, 1], [8, 9, 3], [9, 1, 0], [3, 8, 7], [8, 0, 0], [4, 9, 7], [8, 6, 2], [4, 3, 0], [2, 3, 5], [9, 1, 4], [1, 1, 4], [6, 0, 2], [6, 1, 6], [3, 8, 8], [8, 8, 7], [5, 5, 0], [3, 9, 6], [5, 4, 3], [6, 8, 3], [0, 1, 5], [6, 7, 3], [8, 3, 2], [3, 8, 3], [2, 1, 6], [4, 6, 7], [8, 9, 9], [5, 4, 2], [6, 1, 3], [6, 9, 5], [4, 8, 2], [9, 7, 4], [5, 4, 2], [9, 6, 1], [2, 7, 3], [4, 5, 4], [6, 8, 1], [3, 4, 0], [2, 2, 6], [5, 1, 2], [9, 9, 7], [6, 9, 9], [8, 4, 3], [4, 1, 7], [6, 2, 5], [0, 4, 9], [3, 5, 9], [6, 9, 1], [1, 9, 2]]
89
        }]
90
    });
91
 
92
 
93
    // Add mouse events for rotation
94
    $(chart.container).bind('mousedown.hc touchstart.hc', function (e) {
95
        e = chart.pointer.normalize(e);
96
 
97
        var posX = e.pageX,
98
            posY = e.pageY,
99
            alpha = chart.options.chart.options3d.alpha,
100
            beta = chart.options.chart.options3d.beta,
101
            newAlpha,
102
            newBeta,
103
            sensitivity = 5; // lower is more sensitive
104
 
105
        $(document).bind({
106
            'mousemove.hc touchdrag.hc': function (e) {
107
                // Run beta
108
                newBeta = beta + (posX - e.pageX) / sensitivity;
109
                chart.options.chart.options3d.beta = newBeta;
110
 
111
                // Run alpha
112
                newAlpha = alpha + (e.pageY - posY) / sensitivity;
113
                chart.options.chart.options3d.alpha = newAlpha;
114
 
115
                chart.redraw(false);
116
            },
117
            'mouseup touchend': function () {
118
                $(document).unbind('.hc');
119
            }
120
        });
121
    });
122
 
123
});
124
		</script>
125
	</head>
126
	<body>
127
 
128
<script src="../../js/highcharts.js"></script>
129
<script src="../../js/highcharts-3d.js"></script>
130
<script src="../../js/modules/exporting.js"></script>
131
 
132
<div id="container" style="height: 400px"></div>
133
	</body>
134
</html>