本文整理汇总了PHP中x_axis_labels::visible_steps方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis_labels::visible_steps方法的具体用法?PHP x_axis_labels::visible_steps怎么用?PHP x_axis_labels::visible_steps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis_labels
的用法示例。
在下文中一共展示了x_axis_labels::visible_steps方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
}
//
// 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;
$sum25 = 0;
$sum50 = 0;
示例5: siremis_get_chart_data
//.........这里部分代码省略.........
$ymin = $ydata[$i][$k];
}
if ($ydata[$i][$k] > $ymax) {
$ymax = $ydata[$i][$k];
}
}
}
$k = $k + 1;
}
$ofcobj = new open_flash_chart();
$ctitle = $chart->GetTitle();
$rev = 0;
if ($chart->GetOrder() && $chart->GetOrder() == "reverse") {
$rev = 1;
}
$x = new x_axis();
$xstep = (int) ($k / 20);
if ($k % 20 != 0) {
$xstep = $xstep + 1;
}
$x->set_steps($xstep);
if ($xydata[0]->getXYType() == "timestamp") {
if ($rev == 1) {
$time_min = $xdata[$k - 1];
$time_max = $xdata[0];
} else {
$time_min = $xdata[0];
$time_max = $xdata[$k - 1];
}
$ctitle .= " - From " . date('Y-m-d H:i:s', $time_min);
$ctitle .= " To " . date('Y-m-d H:i:s', $time_max);
$time_x_labels = new x_axis_labels();
$time_x_labels->rotate(20);
$chart_lbls = array();
for ($i = 0; $i < $k; $i = $i + 1) {
if ($rev == 0) {
$chart_lbls[] = date('H:i', $xdata[$i]);
} else {
$chart_lbls[] = date('H:i', $xdata[$k - $i - 1]);
}
}
$time_x_labels->visible_steps($xstep);
$time_x_labels->set_labels($chart_lbls);
$x->set_labels($time_x_labels);
} else {
$time_x_labels->visible_steps($xstep);
if ($rev == 1) {
$ctitle .= " - From " . $xdata[$k - 1] . " To " . $xdata[0];
} else {
$ctitle .= " - From " . $xdata[0] . " To " . $xdata[$k - 1];
}
}
$ofcobj->set_title(new title($ctitle));
$dot_style = new dot();
$dot_style->size(3)->halo_size(1);
for ($i = 0; $i < $yn; $i++) {
if ($chart->GetChartType() == "area") {
$line[$i] = new area();
$line[$i]->set_fill_alpha(0.3);
$line[$i]->set_default_dot_style($dot_style);
} else {
if ($chart->GetChartType() == "line_dot") {
$line[$i] = new line_dot();
$line[$i]->set_default_dot_style($dot_style);
} else {
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
}
}
if ($xydata[$i + 1]->GetXYColor() && $xydata[$i + 1]->GetXYColor() != "") {
$line[$i]->set_colour($xydata[$i + 1]->GetXYColor());
}
if ($xydata[$i + 1]->GetXYTitle() && $xydata[$i + 1]->GetXYTitle() != "") {
$line[$i]->set_key($xydata[$i + 1]->GetXYTitle(), 10);
} else {
$line[$i]->set_key("Key " . $i, 10);
}
if ($rev == 1) {
$line[$i]->set_values(array_reverse($ydata[$i]));
} else {
$line[$i]->set_values($ydata[$i]);
}
$ofcobj->add_element($line[$i]);
}
if ($ymax > 10) {
$y = new y_axis();
if ($ymin > 10) {
$y->set_range($ymin - 10, $ymax, (int) (($ymax - $ymin + 10) / 10));
} else {
$y->set_range(0, $ymax, (int) ($ymax / 10));
}
$ofcobj->set_y_axis($y);
}
$ofcobj->set_x_axis($x);
if ($chart->GetBGColor() && $chart->GetBGColor() != "") {
$ofcobj->set_bg_colour($chart->GetBGColor());
}
// return $ofcobj->toPrettyString();
return $ofcobj->toString();
}
示例6: array
//.........这里部分代码省略.........
if ($type == 'HOUR') {
$e_key = date('Y-m-d H', strtotime($e->endate)) . ':00:00';
} else {
if ($type == 'MONTH') {
$e_key = date('Y-m', strtotime($e->endate)) . '-01';
} else {
if ($type == 'YEAR') {
$e_key = date('Y', strtotime($e->endate)) . '-01-01';
}
}
}
$temp_array[$e_key] = $e->encount;
}
// Get the dates array
if ($type == 'HOUR') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60) {
if (!in_array(date('Y-m-d H', $e) . ':00:00', $dates_array)) {
$dates_array[] = date('Y-m-d H', $e) . ':00:00';
}
}
$date_format = get_option('time_format');
} else {
if ($type == 'MONTH') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24 * 25) {
if (!in_array(date('Y-m', $e) . '-01', $dates_array)) {
$dates_array[] = date('Y-m', $e) . '-01';
}
}
$date_format = 'F Y';
} else {
if ($type == 'YEAR') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24 * 364) {
if (!in_array(date('Y', $e) . '-01-01', $dates_array)) {
$dates_array[] = date('Y', $e) . '-01-01';
}
}
$date_format = 'Y';
} else {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24) {
$dates_array[] = date("Y-m-d", $e);
}
$date_format = get_option('date_format');
}
}
}
// Make sure counts array is in order and includes zero click days
foreach ($dates_array as $date_str) {
if (isset($temp_array[$date_str])) {
$counts_array[$date_str] = $temp_array[$date_str];
} else {
$counts_array[$date_str] = 0;
}
}
foreach ($counts_array as $date => $count) {
$labels[] = date_i18n($date_format, strtotime($date));
$values[] = (int) $count;
}
if ($type == 'MONTH') {
$title = __('Monthly Entries', 'formidable');
} else {
if ($type == 'YEAR') {
$title = __('Yearly Entries', 'formidable');
} else {
if ($type == 'HOUR') {
$title = __('Hourly Entries', 'formidable');
} else {
$title = __('Daily Entries', 'formidable');
}
}
}
$title = new title($title);
$line_1_default_dot = new dot();
$line_1_default_dot->colour($colors[0]);
$line_1_default_dot->tooltip('#x_label#<br>#val# Entries');
$line_1 = new line();
$line_1->set_default_dot_style($line_1_default_dot);
$line_1->set_values($values);
$line_1->set_colour($colors[1]);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->set_bg_colour('#FFFFFF');
$x = new x_axis();
$x_labels = new x_axis_labels();
$x_labels->rotate(340);
$x_labels->set_labels($labels);
if (count($labels) > 15) {
$x_labels->visible_steps(2);
}
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$y = new y_axis();
if (!empty($values)) {
$max = max($values) + 1;
$step = ceil($max / 10);
$y->set_range(0, $max, $step);
}
$chart->add_element($line_1);
$chart->set_y_axis($y);
return $chart->toPrettyString();
}
示例7: renderHTML
//.........这里部分代码省略.........
} else {
if ($r_method == "BYE") {
$acc_records['bye'][$idx] = $acc_records['bye'][$idx] + 1;
} else {
if ($r_method == "MESSAGE") {
$acc_records['message'][$idx] = $acc_records['message'][$idx] + 1;
} else {
$acc_records['other'][$idx] = $acc_records['other'][$idx] + 1;
}
}
}
}
$yidx = $yidx + 1;
}
/* sip method types chart */
$mtsobj = new open_flash_chart();
$ctitle = "SIP Method Types";
$x = new x_axis();
$xstep = (int) ($fetchInterval / 12);
if ($fetchInterval % 2 != 0) {
$xstep = $xstep + 1;
}
$x->set_steps($xstep);
$time_min = $stime;
$time_max = $ctime;
$ctitle .= " - From " . date('Y-m-d H:i:s', $time_min);
$ctitle .= " To " . date('Y-m-d H:i:s', $time_max);
$time_x_labels = new x_axis_labels();
$time_x_labels->rotate(20);
$chart_lbls = array();
for ($i = 0; $i < $fetchInterval; $i = $i + 1) {
$chart_lbls[] = date('H:i', $stime + 3600 * $i);
}
$time_x_labels->visible_steps($xstep);
$time_x_labels->set_labels($chart_lbls);
$x->set_labels($time_x_labels);
$mtsobj->set_title(new title($ctitle));
$dot_style = new dot();
$dot_style->size(3)->halo_size(1);
$clr = 0;
$i = 0;
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("INVITE", 10);
$line[$i]->set_values($acc_records['invite']);
$mtsobj->add_element($line[$i]);
$i++;
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("BYE", 10);
$line[$i]->set_values($acc_records['bye']);
$mtsobj->add_element($line[$i]);
$i++;
if ($cfg_stats_acc_message) {
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("MESSAGE", 10);
$line[$i]->set_values($acc_records['message']);
$mtsobj->add_element($line[$i]);
$i++;
}
if ($cfg_stats_acc_other) {
$line[$i] = new line();
示例8: 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);
}