本文整理匯總了PHP中Plot::setXAxisAsTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Plot::setXAxisAsTime方法的具體用法?PHP Plot::setXAxisAsTime怎麽用?PHP Plot::setXAxisAsTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Plot
的用法示例。
在下文中一共展示了Plot::setXAxisAsTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Plot
$Query = '
SELECT
time*1000 as time,
DAYOFYEAR(FROM_UNIXTIME(`time`)) as `d`,
AVG(`temperature`) as `temp`
FROM `' . PREFIX . 'training`
WHERE
!ISNULL(`temperature`) AND
`time` BETWEEN UNIX_TIMESTAMP(\'' . (int) $Year . '-01-01\') AND UNIX_TIMESTAMP(\'' . ((int) $Year + 1) . '-01-01\')-1
GROUP BY `d`
ORDER BY `d` ASC';
$Data = DB::getInstance()->query($Query)->fetchAll();
foreach ($Data as $dat) {
$Temperatures[$dat['time']] = $Temperature->format((int) $dat['temp'], false);
}
$Plot = new Plot("year" . $Year, 780, 240);
$Plot->Data[] = array('label' => __('Temperatures') . ' ' . $Year, 'data' => $Temperatures);
$Plot->setMarginForGrid(5);
$Plot->setXAxisAsTime();
$Plot->setXAxisLimitedTo($Year);
$Plot->addYAxis(1, 'left');
$Plot->addYUnit(1, $Temperature->unit(), 0);
$Plot->setYTicks(1, 5, 0);
$Plot->addThreshold('y', 0);
$Plot->addMarkingArea('y', -99, 0);
$Plot->showPoints(2);
$Plot->smoothing(false);
if (empty($Data)) {
$Plot->raiseError(__('No data available.'));
}
$Plot->outputJavaScript();