In this example we see how to start and stop real time graphs using the API.
<script>
$("#kitbox").kitbox({
kitboxType: "kitboxSeries",
dataType: "json",
url: "/pages/series/realtime.php",
header: {text: "Real-Time Updates"},
options: {
seriesType: "realtime",
interval: 3000,
window: 20
}
});
</script>
<?php
$data = array( "data" => array(), "xaxis" => array());
$number = 300;
for( $x = 0; $x < 1; $x++ ){
$slice = array();
for( $y = 0; $y < $number; $y++ )
array_push( $slice, mt_rand( ($y+1)*10, ($y+1)*200));
array_push($data['data'], array( "data" => $slice, "label" => "Series: " . $x, "lines" => array("show" => false)));
}
for( $x = 0; $x < $number; $x++ )
array_push($data['xaxis'], "Element: " . $x );
echo json_encode( $data );
?>