PHPlot绘制仅选择记录

时间:2018-01-16 15:42:38

标签: php html mysql phplot

我正在测量我测量的温度。我认为使用phplot绘制温度图是很好的,例如在最后一天。但是phplot从基础中抽取每一条记录。是否有任何选项可以设置像每个第十条记录的phplot? 我使用的代码很简单:

<?php
//Include the code
require_once 'phplot/phplot.php';

//Define the object
$plot = new PHPlot(800,400);

//Set titles
$plot->SetTitle("Wykres temperatury od czasu");
$plot->SetXTitle('Data');
$plot->SetYTitle('Temperatura');

mysql_connect("", "", "");
mysql_select_db("");
$query = mysql_query("SELECT data,temperatura FROM arduino ORDER BY data DESC LIMIT 3");

$data = array();

while ($row = mysql_fetch_assoc($query)) {
    $data[] = $row;
}

$plot->SetDataValues($data);

//Turn off X axis ticks and labels because they get in the way:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');

//Draw it
$plot->DrawGraph();
?>

0 个答案:

没有答案