this is the javascript code (currently commented out). it alsa has the google jaspi line.
google.load('visualization', '1', {packages:['gauge']});
google.setOnLoadCallback(drawChartMemory);
google.setOnLoadCallback(drawChartCPU);
google.setOnLoadCallback(drawChartTemp);
function drawChartMemory() {
//Memory gauge
var dataMemory = google.visualization.arrayToDataTable([
['Label', 'Value'],
['Memory', <?php echo $percent_used; ?>]
]);
var optionsMemory = {
width: 266, height: 120,
redFrom: 90, redTo: 100,
yellowFrom:75, yellowTo: 90,
minorTicks: 5
};
var chartMemory = new google.visualization.Gauge(document.getElementById('chart_div_memory'));
chartMemory.draw(dataMemory, optionsMemory);
}
function drawChartCPU() {
var dataCPU = google.visualization.arrayToDataTable([
['Label', 'Value'],
['CPU', <?php echo $cpuload; ?>]
]);
var optionsCPU = {
width: 266, height: 120,
redFrom: 90, redTo: 100,
yellowFrom:80, yellowTo: 90,
minorTicks: 5
};
var chartCPU = new google.visualization.Gauge(document.getElementById('chart_div_cpu'));
chartCPU.draw(dataCPU, optionsCPU);
}
function drawChartTemp() {
var dataTemp = google.visualization.arrayToDataTable([
['Label', 'Value'],
['Temp', <?php echo $cpu_temperature; ?>]
]);
var optionsTemp = {
width: 133, height: 120,
redFrom: 75, redTo: 80,
yellowFrom:70, yellowTo: 75,
minorTicks: 5,
max: 80
};
var chartTemp = new google.visualization.Gauge(document.getElementById('chart_div_temp'));
chartTemp.draw(dataTemp, optionsTemp);
}
and here the html code.
<table class="w400">
<tr>
<td class="head center">Gauges</td>
</tr>
<tr>
<td>
<div id='chart_div_memory'></div>
<div id='chart_div_cpu'></div>
<div id='chart_div_temp'></div>
</td>
</tr>