PHP-Code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
var aufrufe1;
$(function () {
$.ajax({
url:"holen.php",
dataType:"json"
}).done(function(data){
var aufrufe1 = data[2][0];
$('#container').highcharts({
chart: {
},
title: {
text: 'Combination chart'
},
xAxis: {
categories: ['Februar', 'März', 'April', 'Mai', 'Juni','Juli']
},
tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y +' Aufrufe';
} else {
s = ''+
this.x +': '+ this.y;
}
return s;
}
},
labels: {
items: [{
html: 'Total fruit consumption',
style: {
left: '40px',
top: '8px',
color: 'black'
}
}]
},
series: [{
type: 'column',
name: data[0][0],
data: [aufrufe1,5,90]
}, {
type: 'column',
name: data[0][1],
data: [aufrufe1,5,90]
}, {
type: 'column',
name: data[0][2],
data: [aufrufe1,5,90]
}, {
type: 'spline',
name: 'Linie',
data: [aufrufe1,5,90],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
}
}, {
type: 'pie',
name: 'Total consumption',
data: [{
name: data[0][0],
y: 77,
color: Highcharts.getOptions().colors[0] // Jane's color
}, {
name: data[0][1],
y: 150,
color: Highcharts.getOptions().colors[1] // John's color
}, {
name: data[0][2],
y: 45,
color: Highcharts.getOptions().colors[1] // John's color
},{
name: data[0][3],
y: 12,
color: Highcharts.getOptions().colors[2] // Joe's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
});
});
</script>
</head>
<body>
<script src="high/js/highcharts.js"></script>
<script src="high/js/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>
Kommentar