本文整理汇总了PHP中x_axis_labels::text方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis_labels::text方法的具体用法?PHP x_axis_labels::text怎么用?PHP x_axis_labels::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis_labels
的用法示例。
在下文中一共展示了x_axis_labels::text方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function get_statistic()
{
$this->load->library('OpenFlashChartLib', NULL, 'OFCL');
$data_1 = array();
$data_2 = array();
// generate 7 data points
for ($i = 0; $i <= 7; $i++) {
$x = mktime(0, 0, 0, date("m"), date("d") - $i, date('Y'));
$param['sms_date'] = date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - $i, date("Y")));
$param['user_id'] = $this->session->userdata('id_user');
$y = $this->Kalkun_model->get_sms_used('date', $param);
$data_1[] = new scatter_value($x, $y);
$data_2[] = $y;
}
$def = new solid_dot();
$def->size(4)->halo_size(0)->colour('#21759B')->tooltip('#date:d M y#<br>#val# SMS');
$line = new scatter_line('#21759B', 3);
$line->set_values($data_1);
$line->set_default_dot_style($def);
$line->set_key("SMS used in last 7 days", 10);
$x = new x_axis();
// grid line and tick every 10
$x->set_range(mktime(0, 0, 0, date("m"), date("d") - 7, date('Y')), mktime(0, 0, 0, date("m"), date("d"), date('Y')));
// show ticks and grid lines for every day:
$x->set_steps(86400);
$labels = new x_axis_labels();
// tell the labels to render the number as a date:
$labels->text('#date:M-d#');
// generate labels for every day
$labels->set_steps(86400);
// only display every other label (every other day)
$labels->visible_steps(1);
$labels->rotate(45);
// finally attach the label definition to the x axis
$x->set_labels($labels);
$y = new y_axis();
if (max($data_2) > 0) {
$max = max($data_2);
} else {
$max = 10;
}
$y->set_range(0, $max, 10);
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->add_element($line);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
}
示例2: array
function _render_statistic($x = array(), $yout = array(), $yin = array(), $type = 'bar', $points)
{
$this->load->helper('date');
$this->load->library('OpenFlashChartLib', NULL, 'OFCL');
$data_1 = array();
$data_2 = array();
$data_3 = array();
switch ($type) {
case 'bar':
for ($i = 0; $i <= $points; $i++) {
$data_1[$i] = $x[$i];
$data_2[$i] = (int) $yout[$i];
// force to integer
$data_3[$i] = (int) $yin[$i];
// force to integer
}
$data_1 = array_reverse($data_1);
$data_2 = array_reverse($data_2);
$data_3 = array_reverse($data_3);
$bar_1 = new bar();
$bar_1->set_values($data_3);
$bar_1->set_colour('#639F45');
$bar_1->key(lang('kalkun_incoming_sms'), 10);
$bar_1->set_tooltip('#x_label#<br>#val# SMS');
//$bar_1->set_key("SMS used in last 7 days", 10);
$bar_2 = new bar();
$bar_2->set_values($data_2);
$bar_2->set_colour('#21759B');
$bar_2->key(lang('kalkun_outgoing_sms'), 10);
$bar_2->set_tooltip('#x_label#<br>#val# SMS');
$x = new x_axis();
$labels = new x_axis_labels();
$labels->set_labels($data_1);
$labels->set_steps(1);
$x->set_labels($labels);
$y = new y_axis();
$max = max(max($data_2), max($data_3));
if ($max < 10) {
$max = 10;
}
$max = ceil($max / 5) * 5;
$range = ceil($max / 5);
$range = ceil($range / 10) * 10;
$y->set_range(0, $max, $range);
$element1 = $bar_1;
$element2 = $bar_2;
break;
case 'line':
for ($i = 0; $i <= 7; $i++) {
$data_1[$i] = new scatter_value($x[$i], $yin[$i]);
$data_2[$i] = new scatter_value($x[$i], $yout[$i]);
$data_3[$i] = (int) $yin[$i];
$data_4[$i] = (int) $yout[$i];
}
$def = new solid_dot();
$def->size(4)->halo_size(0)->colour('#21759B')->tooltip('#date:d M y#<br>#val# SMS');
$line_1 = new scatter_line('#639F45', 3);
$line_1->set_values($data_1);
$line_1->set_default_dot_style($def);
$line_1->set_key("Incoming SMS", 10);
$line_2 = new scatter_line('#21759B', 3);
$line_2->set_values($data_2);
$line_2->set_default_dot_style($def);
$line_2->set_key("Outgoing SMS", 10);
$x = new x_axis();
// grid line and tick every 10
$x->set_range(mktime(0, 0, 0, date("m"), date("d") - 7, date('Y')), mktime(0, 0, 0, date("m"), date("d"), date('Y')));
// show ticks and grid lines for every day:
$x->set_steps(86400);
$labels = new x_axis_labels();
// tell the labels to render the number as a date:
$labels->text('#date:M-d#');
// generate labels for every day
$labels->set_steps(86400);
// only display every other label (every other day)
$labels->visible_steps(1);
$labels->rotate(45);
// finally attach the label definition to the x axis
$x->set_labels($labels);
$y = new y_axis();
$max = max(max($data_3), max($data_4));
if ($max < 1) {
$max = 10;
}
$y->set_range(0, $max, round($max / 100) * 10);
$element1 = $line_1;
$element2 = $line_2;
break;
}
$chart = new open_flash_chart();
$chart->add_element($element1);
$chart->add_element($element2);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
}
示例3: getIdealYSteps
//-----/end get ranges -----------------
// Prepare the x-axis
$x = new x_axis();
$x->set_range($lowest, $highest);
// Calculate the steps and visible steps
$step = ($highest - $lowest) / 60;
$step_vis = 2;
// do not allow steps to be less than 30 minutes
if ($step < 26400) {
# 86400
$step = 26400;
$step_vis = 1;
}
$x->set_steps($step);
$labels = new x_axis_labels();
$labels->text('#date:Y-m-d#');
$labels->set_steps($step);
$labels->visible_steps($step_vis);
$labels->rotate(90);
$x->set_labels($labels);
// Prepare the y-axis
$y = new y_axis();
// $maximum is already set above
// set the range and y-step
$y->set_range(0, $maximum + getIdealYSteps($maximum));
$y->set_steps(getIdealYSteps($maximum));
# $chart->add_element( $s );
$chart->set_x_axis($x);
$chart->add_y_axis($y);
// echo a pretty ofc-string anyway
echo $chart->toPrettyString();
示例4: array
$highest_date = $array['date'];
}
}
}
//
// create an X Axis object
$x = new x_axis();
$x->set_grid_colour("#E3E3E3");
//$x->steps(3);
//$x->set_labels_from_array($labels);
// grid line and tick every day
$x->set_steps(TIME_DAY);
$labels = new x_axis_labels();
$label_a = array_reverse($label_a);
$labels->set_labels($label_a);
$labels->text('#date:M d#');
$labels->set_steps(TIME_DAY);
$labels->visible_steps(1);
$labels->rotate(90);
// finally attach the label definition to the x axis
$x->set_labels($labels);
//$x->set_steps(TIME_DAY);
//SMA 50
$sma50 = array();
$sma25 = array();
$sma15 = array();
$sma10 = array();
$sma5 = array();
$sum5 = 0;
$sum10 = 0;
$sum15 = 0;
示例5: array
function admin_graphs($id = null)
{
App::import('Vendor', 'Newsletter.php-ofc-library', array('file' => 'php-ofc-library/open-flash-chart.php'));
//Configure::write('debug', 0);
//$this->layout = null;
// generate some random data
srand((double) microtime() * 1000000);
$title = new title(__d("newsletter", "Views per time", true));
$chart = new open_flash_chart();
$chart->set_title($title);
$newsletter = $this->Newsletter->read(null, $id);
// Views
$dates = array();
$values = array();
//// init sender class ////
App::import('Lib', 'Newsletter.ClassCollection');
$senderOpt = NewsletterConfig::load('sender');
if (!is_array($senderOpt)) {
$senderOpt = array('name' => $senderOpt);
}
$sender = ClassCollection::getObject('NewsletterSender', $senderOpt['name']);
//// query ////
$opt = array('type' => 'graph', 'query' => array('fields' => array('count(*) as nb', 'DATE(NewsletterEvent.date) as date'), 'conditions' => array('NewsletterSended.newsletter_id' => $id, 'or' => array('NewsletterEvent.action' => 'view', array('NewsletterEvent.action IS NULL', 'NewsletterEvent.url' => null))), 'group' => 'DATE(NewsletterEvent.date)', 'order' => 'DATE(NewsletterEvent.date)', 'model' => 'NewsletterEvent'));
$data = $this->_get_stats(array('viewByDays' => $opt), $newsletter, $sender);
//debug($data);
$dates = $data['viewByDays'];
$min_value = 99999999;
$max_value = 0;
foreach ($dates as $d => $val) {
if ($val < $min_value) {
$min_value = $val;
}
if ($val > $max_value) {
$max_value = $val;
}
}
if ($max_value == $min_value) {
$max_value++;
$min_value--;
}
$min_value = 0;
//debug($dates);
$min_date = key($dates);
end($dates);
$max_date = key($dates);
for ($cur_date = $min_date; $cur_date <= $max_date; $cur_date = $cur_date + 86400) {
$x = strtotime('00:00:00', $cur_date);
if (isset($dates[$cur_date])) {
$values[] = new scatter_value($x, $dates[$cur_date]);
} else {
$values[] = new scatter_value($x, 0);
}
}
if ($max_date == $min_date) {
$max_date += 86400;
}
//debug($values);
//pr($views);
$line_dot = new line();
$line_dot->set_values($values);
$line_dot->set_text("Views");
$chart->add_element($line_dot);
$y = new y_axis();
$y->set_range($min_value, $max_value, ($max_value - $min_value) / 10);
$x = new x_axis();
// grid line and tick every 10
$x->set_range(mktime(0, 0, 0, date("m", $min_date), date("d", $min_date), date("Y", $min_date)), mktime(0, 0, 0, date("m", $max_date), date("d", $max_date), date("Y", $max_date)));
// show ticks and grid lines for every day:
$x->set_steps(86400);
$labels = new x_axis_labels();
// tell the labels to render the number as a date:
$labels->text('#date:d-m-Y#');
// generate labels for every day
$labels->set_steps(86400);
// only display every other label (every other day)
$labels->visible_steps(ceil(($max_date - $min_date) / 86400 / 20));
$labels->rotate(90);
$x->set_labels($labels);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$chart->set_bg_colour("#FFFFFF");
//print_r($views);
//$this->set("allviews",$views[0][0]['count(*)']);
$line_dot = new line();
$line_dot->set_values(array(2, 1));
$line_dot->set_text("Unique views");
$line_dot->colour("#0000000");
//$chart->add_element($line_dot);
//
echo $chart->toPrettyString();
exit;
//$this->render(false);
}