本文整理汇总了PHP中x_axis_labels::rotate方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis_labels::rotate方法的具体用法?PHP x_axis_labels::rotate怎么用?PHP x_axis_labels::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis_labels
的用法示例。
在下文中一共展示了x_axis_labels::rotate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getMonthName
while ( $val = mssql_fetch_assoc( $query ) ) {
$jumlah[] = $val[ 'jumlah' ];
$bulan[] = getMonthName( $val[ 'bulan' ] );
$total = $val[ 'total' ];
}*/
$max = 0;
$title = new title('Jumlah Data Peserta KB Per Kelurahan, Total : ' . $total . ' ( ' . date("D M d Y") . ' ) ');
$title->set_style('{font-size:20px; color: #bcd6ff; margin:0px; background-color: #5E83BF;}');
$bar = new bar_3d();
$bar->set_values($jumlah);
$bar->colour = '#9999FF';
$bar->set_on_show(new bar_on_show('grow-up', 1, 0));
$labels = new x_axis_labels();
$labels->set_labels($kelurahan);
$labels->set_size(11);
$labels->rotate(315);
$y_base = new y_axis_base();
$y_base->set_range(0, $maxJumlah + round($maxJumlah / 2), round($maxJumlah / 10));
$x = new x_axis();
$x->set_labels($labels);
$x->set_3d(5);
$y = new y_axis();
$y->set_labels($y_labels);
$tags = new ofc_tags();
$tags->font('Verdana', 10)->colour('#000000')->align_x_center()->text('#y#');
$i = 0;
foreach ($jumlah as $j) {
$tags->append_tag(new ofc_tag($i, $j));
$i++;
}
$chart = new open_flash_chart();
示例3: array
/**
* Build The Bar Gharph.
*
* @param array $params assoc array of name/value pairs
*
* @return object $chart object of open flash chart.
* @static
*/
static function &barChart(&$params)
{
$chart = null;
if (empty($params)) {
return $chart;
}
$values = CRM_Utils_Array::value('values', $params);
if (!is_array($values) || empty($values)) {
return $chart;
}
// get the required data.
$xValues = $yValues = array();
foreach ($values as $xVal => $yVal) {
$yValues[] = (double) $yVal;
// we has to have x values as string.
$xValues[] = (string) $xVal;
}
$chartTitle = CRM_Utils_Array::value('legend', $params) ? $params['legend'] : ts('Bar Chart');
//set y axis parameters.
$yMin = 0;
// calculate max scale for graph.
$yMax = max($yValues);
if ($mod = $yMax % str_pad(5, strlen($yMax) - 1, 0)) {
$yMax += str_pad(5, strlen($yMax) - 1, 0) - $mod;
}
$ySteps = $yMax / 5;
// $bar = new bar( );
// glass seem to be more cool
$bar = new bar_glass();
//set values.
$bar->set_values($yValues);
// call user define function to handle on click event.
if ($onClickFunName = CRM_Utils_Array::value('on_click_fun_name', $params)) {
$bar->set_on_click($onClickFunName);
}
// get the currency.
require_once 'CRM/Utils/Money.php';
$config =& CRM_Core_Config::singleton();
$symbol = $config->defaultCurrencySymbol;
// set the tooltip.
$bar->set_tooltip("{$symbol} #val#");
// create x axis label obj.
$xLabels = new x_axis_labels();
$xLabels->set_labels($xValues);
// set angle for labels.
if ($xLabelAngle = CRM_Utils_Array::value('xLabelAngle', $params)) {
$xLabels->rotate($xLabelAngle);
}
// create x axis obj.
$xAxis = new x_axis();
$xAxis->set_labels($xLabels);
//create y axis and set range.
$yAxis = new y_axis();
$yAxis->set_range($yMin, $yMax, $ySteps);
// create chart title obj.
$title = new title($chartTitle);
// create chart.
$chart = new open_flash_chart();
// add x axis w/ labels to chart.
$chart->set_x_axis($xAxis);
// add y axis values to chart.
$chart->add_y_axis($yAxis);
// set title to chart.
$chart->set_title($title);
// add bar element to chart.
$chart->add_element($bar);
// add x axis legend.
if ($xName = CRM_Utils_Array::value('xname', $params)) {
$xLegend = new x_legend($xName);
$xLegend->set_style("{font-size: 13px; color:#000000; font-family: Verdana; text-align: center;}");
$chart->set_x_legend($xLegend);
}
// add y axis legend.
if ($yName = CRM_Utils_Array::value('yname', $params)) {
$yLegend = new y_legend($yName);
$yLegend->set_style("{font-size: 13px; color:#000000; font-family: Verdana; text-align: center;}");
$chart->set_y_legend($yLegend);
}
return $chart;
}
示例4: title
$datalist[] = 1 * $tmp[1];
$labellist[] = $tmp[0];
}
//Prevent error on no data
if (count($datalist < 1)) {
$datalist[] = 0;
$labellist[] = 0;
}
$title = new title("Checking account forecast");
$default_dot = new dot();
$default_dot->tooltip('$#val#');
$line = new line();
$line->set_values($datalist);
$line->set_default_dot_style($default_dot);
$x_labels = new x_axis_labels();
$x_labels->rotate(45);
$x_labels->set_labels($labellist);
$x_labels->set_steps(3);
$x = new x_axis();
$x->set_labels($x_labels);
$y = new y_axis();
$y->set_range(min(min($datalist) - 10, 0), round(max($datalist) * 1.1));
$y->set_label_text("\$#val#");
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($line);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
?>
示例5: getNewUsersByTime
function getNewUsersByTime($timePhase, $fromDate = '', $toDate = '')
{
$this->load->library('ofc');
$userId = $this->common->getUserId();
$this->ofc->open_flash_chart();
$this->ofc->set_bg_colour(CHART_BG_COLOR);
$toTime = date("Y-m-d", strtotime("-1 day"));
if ($timePhase == "7day") {
$fromTime = date("Y-m-d", strtotime("-8 day"));
$color = CHART_LINE_1;
$key = "近7日新增用户";
$title = new title("近7日新增用户统计");
}
if ($timePhase == "1month") {
$title = new title("近30天新增用户统计");
$fromTime = date("Y-m-d", strtotime("-31 day"));
$color = CHART_LINE_2;
$key = "近30天新增用户统计";
}
if ($timePhase == "3month") {
$title = new title("近三个月新增用户统计");
$fromTime = date("Y-m-d", strtotime("-92 day"));
$color = CHART_LINE_3;
$key = "近三个月新增用户统计";
}
if ($timePhase == "all") {
$title = new title("所有新增用户统计");
$fromTime = '1970-01-01';
$color = CHART_LINE_4;
$key = "所有新增用户统计";
}
if ($timePhase == "any") {
$title = new title("所有新增用户统计");
$fromTime = $fromDate;
$toTime = $toDate;
$color = CHART_LINE_4;
$key = "所有新增用户统计";
}
$fromTime = $this->product->getUserStartDate($userId, $fromTime);
$query = $this->newusermodel->getNewUsersByUserId($fromTime, $toTime, $userId);
$data = array();
$maxY = 0;
$recordCount = $query->num_rows();
$steps = $recordCount - 1 <= 10 ? 2 : (int) (((int) $recordCount - 1) / 10);
$xlabelArray = array();
if ($query != null && $query->num_rows() > 0) {
foreach ($query->result() as $row) {
$dot = new dot();
$dot->size(3)->halo_size(1)->colour($color);
$dot->tooltip($row->startdate . " 新增" . $row->totalusers . "用户");
$dot->value((int) $row->totalusers);
if ((int) $row->totalusers > $maxY) {
$maxY = (int) $row->totalusers;
}
array_push($xlabelArray, date('y-m-d', strtotime($row->startdate)));
array_push($data, $dot);
}
}
$y = new y_axis();
$y->set_range(0, $this->common->getMaxY($maxY), $this->common->getStepY($maxY));
$x = new x_axis();
$x->set_range(0, $recordCount > 1 ? $recordCount - 1 : 1);
$x_labels = new x_axis_labels();
$x_labels->set_steps($steps);
$x_labels->set_vertical();
$x_labels->set_colour(CHART_LABEL_COLOR);
$x_labels->set_size(13);
$x_labels->set_labels($xlabelArray);
$x_labels->rotate(-25);
$x->set_labels($x_labels);
$x->set_steps(1);
$this->ofc->set_y_axis($y);
$this->ofc->set_x_axis($x);
$dot = new dot();
$dot->size(3)->halo_size(1)->colour($color);
$line = new line();
$line->set_default_dot_style($dot);
$line->set_values($data);
$line->set_width(2);
$line->set_colour($color);
$line->colour($color);
$line->set_key($key, 12);
$this->ofc->add_element($line);
$title->set_style("{font-size: 14px; color:#000000; font-family: Verdana; text-align: center;}");
// $x_legend = new x_legend("<a href=\"javascript:changeChartName('chartNewUser')\">新增用户</a> <a href=\"javascript:changeChartName('chartActiveUser')\">活跃用户</a> <a href=\"javascript:changeChartName('chartStartUser')\">启动用户</a>");
// $this->ofc->set_x_legend( $x_legend );
// $x_legend->set_style( '{font-size: 14px; color: #778877}' );
$this->ofc->set_title($title);
echo $this->ofc->toPrettyString();
}
示例6: renderHTML
//.........这里部分代码省略.........
/* 14 - 2^13 PUBLISH */
if ($r_methods & 8192) {
$ul_methods['PUBLISH'] = $ul_methods['PUBLISH'] + 1;
}
/* 15 - 2^14 OTHER */
if ($r_methods & 16384) {
$ul_methods['OTHERS'] = $ul_methods['OTHERS'] + 1;
}
} else {
$ul_methods['NONE'] = $ul_methods['NONE'] + 1;
}
/* supported NAT stats */
if (isset($r_cflags) && $r_cflags != 0) {
if ($r_cflags & 1 << 6) {
$ul_nat['NATTED'] = $ul_nat['NATTED'] + 1;
}
if ($r_cflags & 1 << 7) {
$ul_nat['SIPPING'] = $ul_nat['SIPPING'] + 1;
}
}
$yidx = $yidx + 1;
}
if ($yidx > 0) {
$ousr++;
if ($prevcnt < 5) {
$ul_contacts[$prevcnt] = $ul_contacts[$prevcnt] + 1;
} else {
$ul_contacts[5] = $ul_contacts[5] + 1;
}
}
/* user agents chart */
$ua_title = new title('User Agents');
$ua_x_labels = new x_axis_labels();
$ua_x_labels->rotate(20);
$ua_bar = new bar_glass();
$chart_vals = array();
$chart_lbls = array();
$i = 0;
$ymax = 10;
foreach ($ul_uas as $key => $val) {
if ($val > 0) {
$chart_vals[$i] = new bar_value($val);
$chart_vals[$i]->set_colour($chart_colors[$i % $chart_colors_size]);
$chart_vals[$i]->set_tooltip($key . '<br>#val#');
$chart_lbls[$i] = $key;
if ($ymax < $val) {
$ymax = $val;
}
$i = $i + 1;
}
}
$ua_bar->set_values($chart_vals);
$ua_x_labels->set_labels($chart_lbls);
$x = new x_axis();
$x->set_labels($ua_x_labels);
$y = new y_axis();
$y->set_range(0, $ymax, $ymax / 10);
$ul_uas_chart = new open_flash_chart();
$ul_uas_chart->set_title($ua_title);
$ul_uas_chart->add_element($ua_bar);
$ul_uas_chart->set_x_axis($x);
$ul_uas_chart->add_y_axis($y);
/* supported SIP Methods chart */
$mt_title = new title('Supported SIP Methods');
$mt_x_labels = new x_axis_labels();
$mt_x_labels->rotate(20);
示例7: setXLabels
/**
*
* Set the xLabels
* Note we can no longer set angle for labels as openFlashPlayer
* doesn't seem to render it anymore - presumably after being upgraded
* I think the fonts would need to be embedded
* @return object x_axis_labels
*/
function setXLabels()
{
$xLabels = new x_axis_labels();
$xLabels->set_labels($this->xlabels);
$xLabels->set_size($this->xlabelSize);
if ($this->xlabelAngle) {
$xLabels->rotate($this->xlabelAngle);
}
return $xLabels;
}
开发者ID:eileenmcnaughton,项目名称:net.ourpowerbase.report.advancedfundraising,代码行数:18,代码来源:OpenFlashChart.php
示例8: ceil
}
} else {
$c = '#0066CC';
}
$tags->append_tag(new ofc_tag($x, $v, $c));
$x++;
}
$chart = new open_flash_chart();
//$chart->set_bg_colour('#ffffff');
$chart->set_title($title);
$chart->add_element($bar);
$chart->add_element($tags);
//$chart->add_element( $bar2 );
$xal = new x_axis_labels();
$x_labels = array_keys($data);
$xal->rotate(20);
$xal->set_labels($x_labels);
$xal->set_size($xfs);
$xal->set_colour('#hhffhh');
$x = new x_axis();
$x->set_offset(true);
$x->set_labels($xal);
$x->set_3d(5);
$x->colour = '#909090';
//$x->set_labels_from_array( $x_labels );
$chart->set_x_axis($x);
$yal = new y_axis_labels();
$yal->set_size($yfs);
$y = new y_axis();
$y->set_labels($yal);
$y_max = ceil($y_max / $step) * $step;
示例9: ceil
} else {
$c = '#066303';
}
} else {
$c = '#066303';
}
$tags->append_tag(new ofc_tag($x, $v, $c));
$x++;
}
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar);
$chart->add_element($tags);
$xal = new x_axis_labels();
$x_labels = array_keys($data);
$xal->rotate(15);
//ROTATING GRAPH LABELS
$xal->set_labels($x_labels);
$xal->set_size($xfs);
$xal->set_colour('#hhffhh');
$x = new x_axis();
$x->set_offset(true);
$x->set_labels($xal);
$x->set_3d(5);
$x->colour = '#909090';
$chart->set_x_axis($x);
$yal = new y_axis_labels();
$yal->set_size($yfs);
$y = new y_axis();
$y->set_labels($yal);
$y_max = ceil($y_max / $step) * $step + 10;
示例10: 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();
}
示例11: renderHTML
//.........这里部分代码省略.........
} else {
$acc_records['inviteXYZ'][$idx] = $acc_records['inviteXYZ'][$idx] + 1;
}
}
}
} 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']);
示例12: gsitedata
function gsitedata()
{
$this->autoRender = false;
$solid = $this->Session->read('sol');
$host_id = $this->Session->read('host_id');
$tinterval = 3600;
$host_srch = "";
if (!empty($host_id) && $host_id != 0) {
$host_srch = " AND source_id = " . $host_id;
}
$this->DnsMessage->recursive = -1;
$site_count = $this->DnsMessage->query('SELECT hostname, COUNT(*) FROM dns_messages WHERE sol_id = ' . $solid . $host_srch . ' GROUP BY hostname ORDER BY COUNT(*) DESC LIMIT 50');
//sort($site_count);
$data = array();
$x = array();
$max_resp = 0;
foreach ($site_count as $site) {
$data[] = array((int) $site[0]['COUNT(*)'], 0);
if ($max_resp < (int) $site[0]['COUNT(*)']) {
$max_resp = (int) $site[0]['COUNT(*)'];
}
if (empty($site[0]['hostname'])) {
$x[] = (string) $site['dns_messages']['hostname'];
} else {
$x[] = (string) $site[0]['hostname'];
}
}
// joson data format
$title = new title(__("Host Popularity", true));
$title->set_style("{font-size: 14px; color: #990000; text-align: center; font-weight:bold;}");
$bar = new bar_stack();
$bar->set_colours(array('#e77919', '#577261'));
$bar->set_on_show(new bar_on_show('grow-up', 0, 0.5));
$bar->set_values($data);
$bar->set_tooltip('Host: #x_label#<br>Response #val#<br>');
$tooltip = new tooltip();
$tooltip->set_hover();
$tooltip->set_shadow(false);
$tooltip->set_stroke(5);
$tooltip->set_colour("#6E604F");
$tooltip->set_background_colour("#BDB396");
$data_labels = new x_axis_labels();
$data_labels->rotate(90);
$data_labels->set_labels($x);
$x_axis = new x_axis();
$x_axis->set_labels($data_labels);
$y = new y_axis();
$y->set_range(0, $max_resp * 1.1, (int) ($max_resp / 10));
$chart = new open_flash_chart();
$chart->set_bg_colour('#F9F9F9');
$chart->set_title($title);
$chart->add_element($bar);
$chart->set_x_axis($x_axis);
$chart->set_y_axis($y);
$chart->set_tooltip($tooltip);
// menu'
$m = new ofc_menu("#f0E0ff", "#878787");
$m->values(array(new ofc_menu_item(__('DNS Response', true), 'go_gpage')));
$chart->set_menu($m);
header("Content-Type: text/plain");
echo $chart->toPrettyString();
die;
}
示例13: clientimpressionAction
//.........这里部分代码省略.........
$accumulate = $result + $accumulate;
$data_1[$i] = $accumulate + $staticsparks[$i];
$data_2min[$i] = floor($accumulate * 2.5 + $staticsparks[$i]);
$data_2max[$i] = $accumulate * 5 + $staticsparks[$i];
$data_2avg[$i] = $accumulate * 3.75;
$data_3min[$i] = floor($data_2avg[$i] * 3) + $data_2min[$i];
$data_3max[$i] = floor($data_2avg[$i] * 4) + $data_2max[$i];
$max = $data_3max[$i];
if ($i == $xTodayLength) {
break;
}
$i++;
}
// set max y axis value
$dateArray = array_keys($resultArray);
$y = new y_axis();
if ($request->isPost()) {
$formData = $request->getPost();
$max = $formData['y_max'];
} else {
if ($max < 10000) {
$max = ceil($max / 100) * 100;
} else {
$max = ceil($max / 1000) * 1000;
}
}
$y->set_range(0, $max, $max / 10);
$this->view->ymax = $max;
// draw lines
$x = new x_axis();
$x_labels = new x_axis_labels();
$x_labels->set_labels($dateArray);
$x_labels->set_steps(floor($xDateArrayLength / 42) + 1);
$x_labels->rotate(40);
$x->set_labels($x_labels);
$line_1_default_dot = new dot();
$line_1_default_dot->colour('#007DCD')->tooltip('#x_label#: #val#');
$line_1 = new line();
$line_1->set_default_dot_style($line_1_default_dot);
$line_1->set_values($data_1);
$line_1->set_colour("#007DCD");
$line_1->set_width(1);
$line_2min_default_dot = new dot();
$line_2min_default_dot->colour('#81C909')->tooltip('#x_label#: #val#');
$line_2min = new line();
$line_2min->set_default_dot_style($line_2min_default_dot);
$line_2min->set_values($data_2min);
$line_2min->set_colour("#81C909");
$line_2min->set_width(1);
$line_2_default_dot = new dot();
$line_2_default_dot->colour('#81C909')->tooltip('#x_label#: #val#');
$line_2 = new line();
$line_2->set_default_dot_style($line_2_default_dot);
$line_2->set_values($data_2max);
$line_2->set_colour("#81C909");
$line_2->set_width(1);
$line_3_default_dot = new dot();
$line_3_default_dot->colour('#FF0000')->tooltip('#x_label#: #val#');
$line_3 = new line();
$line_3->set_default_dot_style($line_3_default_dot);
$line_3->set_values($data_3min);
$line_3->set_colour("#FF0000");
$line_3->set_width(1);
$line_3max_default_dot = new dot();
$line_3max_default_dot->colour('#FF0000')->tooltip('#x_label#: #val#');
$line_3max = new line();
示例14: 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);
}
示例15: generateStats
function generateStats($params)
{
global $reportCacheLocation;
// Computer Statistics Generation
$dbTrackHandler = connectDb();
$resultBag = generateStatsBag($params, $dbTrackHandler);
// ----------------------------------------------------
// Generate charts
$animation_1 = isset($params['animation_1']) ? $params['animation_1'] : 'pop';
$delay_1 = isset($params['delay_1']) ? $params['delay_1'] : 0.5;
$cascade_1 = isset($params['cascade_1']) ? $params['cascade_1'] : 1;
$title = new title("Genie Report: " . $params['reportName'] . " - Generated on " . date('Y/m/d h:i:s A'));
$title->set_style("{font-size: 12px; color: #000000; text-align: center;}");
$bar_stack = new bar_stack();
if ($params['reportType'] == 'computerStats') {
foreach ($resultBag as $elm) {
$tmpTotal = $elm[AVAIBILITY_TYPE_OFFLINE] + $elm[AVAIBILITY_TYPE_AVAILABLE] + $elm[AVAIBILITY_TYPE_BUSY];
if ($tmpTotal == 0) {
$tmpTotal = 1;
}
// Only Chuck Norris can divide by Zero.
$bar_stack->append_stack(array($elm[AVAIBILITY_TYPE_OFFLINE] / $tmpTotal * 100, $elm[AVAIBILITY_TYPE_AVAILABLE] / $tmpTotal * 100, $elm[AVAIBILITY_TYPE_BUSY] / $tmpTotal * 100));
}
$bar_stack->set_colours(array('#FF0000', '#00FF00', '#A25B00'));
$bar_stack->set_keys(array(new bar_stack_key('#FF0000', 'OFFLINE', 13), new bar_stack_key('#00FF00', 'FREE', 13), new bar_stack_key('#A25B00', 'BUSY', 13)));
} else {
$allProgNames = array();
foreach ($resultBag as $elm) {
$progNames = array_keys($elm);
foreach ($progNames as $progName) {
if (validProgram($progName)) {
if (!array_key_exists($progName, $allProgNames)) {
$allProgNames[$progName] = "#" . dechex(rand(0, 10000000));
}
}
}
}
$progsArray = array();
foreach ($resultBag as $elm) {
$tmpTotal = 0;
$progNames = array_keys($elm);
foreach ($elm as $programName => $programWeight) {
if (validProgram($programName)) {
$tmpTotal += $programWeight;
}
}
//echo "<h1>$tmpTotal</h1>";
if ($tmpTotal == 0) {
$tmpTotal = 1;
}
// Only Chuck Norris can divide by Zero.
$progs = array();
foreach ($elm as $programName => $programWeight) {
if (validProgram($programName)) {
$percentVal = $programWeight / $tmpTotal * 100;
$progs[] = new bar_stack_value($percentVal, $allProgNames[$programName]);
$progsArray[$percentVal * 1000000] = $programName;
}
}
$bar_stack->append_stack($progs);
}
$legends = array();
//$strAllProgNames = array_keys($allProgNames);
foreach ($allProgNames as $programName => $programColor) {
$legends[] = new bar_stack_key($programColor, $programName, 13);
}
$bar_stack->set_keys($legends);
ksort($progsArray);
echo "<pre>";
while (list($key, $value) = each($progsArray)) {
$kw = $key / 1000000;
echo "{$kw}: {$value}<br />\n";
}
echo "</pre>";
}
//$bar_stack->set_tooltip( 'In #x_label# you get #total# days holiday a year.<br>Number of days: #val#' );
$bar_stack->set_on_show(new bar_on_show($animation_1, $cascade_1, $delay_1));
$y = new y_axis();
$y->set_range(0, 100, 10);
//$y->set_range( 0, $tmpMax, $tmpMax/10 );
$x_labels = new x_axis_labels();
$x_labels->rotate(45);
$x_labels->set_labels(array_keys($resultBag));
$x = new x_axis();
$x->set_labels($x_labels);
$tooltip = new tooltip();
$tooltip->set_hover();
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar_stack);
$chart->set_x_axis($x);
$chart->add_y_axis($y);
$chart->set_tooltip($tooltip);
// ----------------------------------------------------
$cacheid = time();
$filename = $cacheid . '.cache.json';
$myFile = "{$reportCacheLocation}/reports-cache/" . $filename;
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $chart->toPrettyString());
fclose($fh);
//.........这里部分代码省略.........