本文整理汇总了PHP中y_axis::range方法的典型用法代码示例。如果您正苦于以下问题:PHP y_axis::range方法的具体用法?PHP y_axis::range怎么用?PHP y_axis::range使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类y_axis
的用法示例。
在下文中一共展示了y_axis::range方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
');
$deposits = array();
$withdrawals = array();
$weeks = array();
while ($row = mysql_fetch_assoc($result)) {
$weeks[] = date('d.m.Y', $row['stamp']);
$deposits[] = round($row['deposits'], 2);
$withdrawals[] = -round($row['withdrawals'], 2);
}
//lines
$line1 = new line();
$line1->set_values($deposits);
$line1->set_colour('#00FF00');
$line2 = new line();
$line2->set_values($withdrawals);
$line2->set_colour('#FF0000');
//axises
$axis_x = new x_axis();
$axis_x_labels = new x_axis_labels();
$axis_x_labels->set_labels($weeks);
$axis_x->set_labels($axis_x_labels);
$axis_y = new y_axis();
$axis_y->range(0, max(max($deposits), max($withdrawals)), 1000);
//chart
$chart = new open_flash_chart();
$chart->set_y_axis($axis_y);
$chart->set_x_axis($axis_x);
$chart->add_element($line1);
$chart->add_element($line2);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
示例2: subscription
function subscription()
{
acymailing::setTitle(JText::_('CHARTS'), 'stats', 'diagram&task=subscription');
$listsClass = acymailing::get('class.list');
$lists = $listsClass->getLists('listid');
$db =& JFactory::getDBO();
$db->setQuery('SELECT min(subdate) as minsubdate, min(unsubdate) as minunsubdate FROM ' . acymailing::table('listsub'));
$dates = $db->loadObject();
$spaces = array();
$intervals = 10;
$dates->maxsubdate = time();
$delay = ($dates->maxsubdate - $dates->minsubdate) / $intervals;
for ($i = 0; $i < $intervals; $i++) {
$spaces[$i] = (int) ($dates->minsubdate + $delay * $i);
}
$spaces[$intervals] = $dates->maxsubdate;
$results = array();
$legendX = array();
for ($i = 0; $i <= $intervals; $i++) {
$legendX[] = acymailing::getDate($spaces[$i]);
$db->setQuery('SELECT count(subid) as total, listid FROM ' . acymailing::table('listsub') . ' WHERE `status` != 2 AND `subdate` < ' . $spaces[$i] . ' AND (`status` = 1 OR `unsubdate`>' . $spaces[$i] . ') GROUP BY listid');
$results[$i] = $db->loadObjectList('listid');
}
$title = new title(JText::_('SUB_HISTORY'));
$title->set_style('font-size:20px; color: #FF8040');
$lines = array();
$maxSub = 0;
foreach ($lists as $listid => $oneList) {
$lines[$listid] = new line_base();
$values = array();
for ($i = 0; $i <= $intervals; $i++) {
$values[] = empty($results[$i][$listid]->total) ? 0 : (int) $results[$i][$listid]->total;
}
$lines[$listid]->set_values($values);
$lines[$listid]->set_text($oneList->name);
$lines[$listid]->set_colour($oneList->color);
$maxSub = max($maxSub, max($values));
}
$x_axis = new x_axis();
$xlabelobject = new x_axis_labels();
$xlabelobject->rotate(-20);
$xlabelobject->set_labels($legendX);
$x_axis->set_labels($xlabelobject);
$y_axis = new y_axis();
$y_axis->range(0, $maxSub, intval($maxSub / 10));
$chart = new open_flash_chart();
$chart->set_x_axis($x_axis);
$chart->set_y_axis($y_axis);
$chart->set_title($title);
foreach ($lines as $oneLine) {
$chart->add_element($oneLine);
}
$this->assignRef('chart', $chart);
}