예제 #1
0
		  labels: ['Value']
		});
		
		
		new Morris.Line({
		  // ID of the element in which to draw the chart.
		  element: 'cpuchart',
		  // Chart data records -- each entry in this array corresponds to a point on
		  // the chart.
		  data: [
		   	<?php 
foreach ($cat_stats->rows as $historic_stats) {
    $json = json_decode($historic_stats->value->metrics);
    $load_avg = $json->load_average;
    $time = $historic_stats->value->TimeStamp;
    echo "{ time: '" . utc_to_eastern($time) . "' , value: " . $load_avg . " },";
}
?>
 	   
		  ],
		  // The name of the data record attribute that contains x-values.
		  xkey: 'time',
		  // A list of names of data record attributes that contain y-values.
		  ykeys: ['value'],
		  // Labels for the ykeys -- will be displayed when you hover over the
		  // chart.
		  labels: ['Value']
		});
</script>

예제 #2
0
//javascript to draw the graphs
		new Morris.Line({
		  // ID of the element in which to draw the chart.
		  element: 'diskchart',
		  // Chart data records -- each entry in this array corresponds to a point on
		  // the chart.
		  data: [	
		  <?php 
foreach ($cat_stats->rows as $historic_stats) {
    $time = $historic_stats->value->TimeStamp;
    $json = json_decode($historic_stats->value->metrics);
    foreach ($json->disk_space as $mount_entry) {
        if ($mount_entry->mount_point == $mount) {
            $percent_used = $mount_entry->percent_used;
            $hd_percentage = number_format($percent_used, 2, '.', '');
            echo "{ time: '" . utc_to_eastern($time) . "' , value: " . $hd_percentage . " },";
        }
    }
}
?>
			
			
			/*
<?php 
foreach ($cat_stats->rows as $historic_stats) {
    $json = json_decode($historic_stats->value->metrics);
    if ($json->disk_space->mount_point == $mount) {
        $disk = $json->disk_space->percent_used;
    } else {
        $disk = "0";
    }