php - highchart point is not in right location -
i'm making line chart highcharts , data retrieve mysql. code:
<?php $query = "select distinct idchip datatable "; $result = mysql_query( $query ); $rows = array(); $count = 0; while( $row = mysql_fetch_array( $result ) ) { $table = array(); $query2 = "select datetime,temperature datatable idchip=".$row['idchip'].' '; $query3 = "select datetime datatable idchip=".$row['idchip'].' group datetime asc'; $timeresult = mysql_query($query3); while($datatime = mysql_fetch_array($timeresult)) { $newtime .= $datatime['0'].','; $newcates .= "'".$datatime['0']."',"; } $total= explode(",", $newtime); array_pop($total); $count = 0; $dataresult = mysql_query($query2); while($datarow = mysql_fetch_array($dataresult)) { $data = ''; //$datatimes = ''; $datatimes .= $datarow['0'].','; //$stringtime .= $datatimes; $timetotal = explode(",",$datatimes); array_pop($timetotal); echo count($total).' |'; //echo count($timetotal).' |'; //echo $timetotal[$count]." |"; $data .= (integer)$datarow['1'].','; $stringdata .= $data; } $newstring = $stringdata ; //$total = ''; //$newtime = ''; $stringdata = ''; $stringtime = ''; //$stringcates = ''; //echo $newstring; $namedata = "{name:'chip ".$row["idchip"]."',data:[$newstring]},"; $getall .= $namedata; } $serries = 'series: [ '.$getall.' ]'; $xaxis = 'xaxis: { categories:['.$newcates.']},'; ?>
and want show on chart, node data chip 7 must on "it must here" location:
so guys saw data not on right point, because of data array not in location. need add "null," $newstring have string: null,null,[my data show] -> these null node me have data in right location. can , can't me this, please me. want add 'null,' string when time yaxis different xaxis data point show correctly.
#this database:
id idchip datetime signal temperature edit delete 1 5 2015-05-12 08:24:40 + 29 edit delete 12 5 2015-05-12 08:23:40 + 031 edit delete 3 6 2015-05-12 08:27:55 + 29 edit delete 4 7 2015-05-12 08:26:01 + 50 edit delete 5 5 2015-05-12 08:25:12 + 28 edit delete 6 6 2015-05-12 08:28:32 + 29 edit delete 7 6 2015-05-12 08:24:42 + 30 edit delete 8 5 2015-05-12 08:27:58 + 29 edit delete 9 5 2015-05-12 08:26:02 + 31 edit delete 10 5 2015-05-12 08:26:13 + 29 edit delete 11 5 2015-05-12 08:26:53 + 32
Comments
Post a Comment