本文整理汇总了PHP中x_axis_labels::set_steps方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis_labels::set_steps方法的具体用法?PHP x_axis_labels::set_steps怎么用?PHP x_axis_labels::set_steps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis_labels
的用法示例。
在下文中一共展示了x_axis_labels::set_steps方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function set_labels_from_array($a)
{
$x_axis_labels = new x_axis_labels();
$x_axis_labels->set_labels($a);
$this->labels = $x_axis_labels;
if (isset($this->steps)) {
$x_axis_labels->set_steps($this->steps);
}
}
示例2: 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();
}
示例3: render
/**
* Method to render a statistical chart using Open Flash library.
*
* @return false if someting wrong
*/
function render()
{
$values = array();
foreach ($this->values as $number_variable => $variable) {
$values[$number_variable] = (int) $variable;
}
$area = new area();
$area->set_default_dot_style(new hollow_dot());
$area->set_colour('#5B56B6');
$area->set_fill_alpha(0.4);
$area->set_values($values);
$area->set_key('Values', 12);
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_vertical();
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($this->legend);
$x = new x_axis();
$x->set_colour('#A2ACBA');
$x->set_grid_colour('#D7E4A3');
$x->set_offset(false);
$x->set_steps(1);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$y = new y_axis();
$y_max = max($values) > 0 ? max($values) : 4;
$y_mod = (int) ($y_max / 4 + 1);
$y_max += $y_mod - $y_max % $y_mod;
$y->set_range(0, $y_max, $y_mod);
$y->labels = null;
$y->set_offset(false);
$chart = new open_flash_chart();
$chart->set_x_axis($x);
$chart->add_y_axis($y);
$chart->add_element($area);
return $chart;
}
示例4: line
$user_line->set_values($user_signups);
$user_line->colour('#0099cc');
$user_line->set_key('User', 14);
$grp_line = new line();
$grp_line->set_values($groups_added);
$grp_line->colour('#990000');
$grp_line->set_key('Groups', 14);
$max = $max;
$steps = round($max / 5, 0.49);
$y = new y_axis();
$y->set_range(0, $max, $steps);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($vid_line);
$chart->add_element($user_line);
$chart->add_element($grp_line);
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_vertical();
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($year);
$x = new x_axis();
$x->set_colour('#A2ACBA');
$x->set_grid_colour('#D7E4A3');
$x->set_offset(false);
$x->set_steps(4);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
echo $chart->toString();
示例5: dot
$line_watt->set_tooltip("#val# W");
$line_tot_default_dot = new dot();
$line_tot_default_dot->size(4)->halo_size(2);
$line_tot = new line();
$line_tot->set_default_dot_style($line_tot_default_dot);
$line_tot->set_values($data_tot);
$line_tot->set_colour('#A0A000');
$line_tot->set_width(2);
$line_tot->set_key('Gesamt (kWh)', 10);
$line_tot->set_tooltip("#val# kWh");
$max = max(max($data_watt), $max_val) * 1.15;
$y = new y_axis();
$y->set_range(0, $max, round($max * 0.1, -1));
$x_labels = new x_axis_labels();
$x_labels->set_vertical();
$x_labels->set_steps(6);
$x_labels->set_colour('#333333');
$x_labels->set_labels($time_axis);
$x = new x_axis();
$x->set_colour('#333333');
$x->set_grid_colour('#ffffff');
$x->set_offset(false);
$x->set_steps(3);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart = new open_flash_chart();
$chart->set_tooltip($tooltip);
$chart->set_title($title);
//$chart->add_element( $line_max );
$chart->add_element($line_watt);
$chart->add_element($bars_curr);
示例6: title
}
//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();
?>
示例7: 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();
}
示例8: index2Action
public function index2Action()
{
$this->_helper->layout->disableLayout();
include 'open-flash-chart.php';
$db = Zend_Registry::get('db');
$select = $db->select();
$select->from('report', array('left(create_date,10) as date', 'count(*)'))->where('report.campaign_id = 3')->where("report.state = 'APPROVED'")->group('date')->order('date')->limit(0);
$results = $db->fetchAll($select);
$array_data = array();
$array_create_date = array();
foreach ($results as $result) {
array_push($array_data, (int) $result["count(*)"]);
array_push($array_create_date, $result["date"]);
}
$title = new title("BugsLock Reports By Day");
$y = new y_axis();
$y->set_range(0, 100, 10);
$x = new x_axis();
$x_labels = new x_axis_labels();
$x_labels->set_labels($array_create_date);
$x_labels->set_steps(2);
$x_labels->rotate(40);
$x->set_labels($x_labels);
//There is a bug on the tooltip of bar: can not show #x_label#. So use bar_stack instead of bar here.
// $bar = new bar_filled( '#E2D66A', '#577261' );
// $bar->set_values($array_data);
// $bar->set_tooltip('#x_label#: #val#');
$bar = new bar_stack();
$bar->set_colours(array('#E2D66A', '#577261'));
foreach ($array_data as $date) {
$bar->append_stack(array((int) $date));
}
$bar->set_tooltip('#x_label#: #val#');
$this->view->chart3 = new open_flash_chart();
$this->view->chart3->set_title($title);
$this->view->chart3->add_element($bar);
$this->view->chart3->set_bg_colour('#FFFFFF');
$this->view->chart3->set_x_axis($x);
$this->view->chart3->set_y_axis($y);
// echo $this->view->chart3->toPrettyString();
}
示例9: title
}
//Prevent error on no data
if (count($datalist < 1)) {
$datalist[] = 0;
$labellist[] = 0;
}
$title = new title("Daily checking account balance");
$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(2);
$x = new x_axis();
$x->set_labels($x_labels);
$y = new y_axis();
$y->set_range(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();
?>
示例10: 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();
示例11: 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);
}
示例12: get_jx_json_bar
public function get_jx_json_bar($info, $type = '')
{
$year = array_keys($info);
$price = array_values($info);
$chart = new open_flash_chart();
$chart->set_bg_colour('#FFFFFF');
//flash背景颜色
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_size(12);
$x_labels->set_colour('#000000');
if (count($year) > 0) {
$x_labels->set_vertical();
}
$x_labels->set_labels($year);
// // 插入数据
$x = new x_axis();
$x->set_colour('#000000');
$x->set_grid_colour('#dadada');
$x->set_offset(true);
$x->set_steps(1);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$x->set_offset(true);
$chart->set_x_axis($x);
// $bar = new bar_filled( '#74b1e0', '#9dc7e8' );
// $bar->set_values( $price );
$price_array = array();
foreach ($price as $k => $v) {
$price_array[$k] = new bar_value($v);
$price_array[$k]->set_colour('#74b1e0');
if ($type == 'percent') {
//$y->set_label_text("#val#%");
$price_array[$k]->set_tooltip($year[$k] . '<br>' . '' . number_format($v) . '%');
} else {
$price_array[$k]->set_tooltip($year[$k] . '<br>' . '' . number_format($v));
}
}
$bar = new bar_glass();
$bar->set_values($price_array);
$chart->add_element($bar);
//
// LOOK:
//
//$x_legend = new x_legend( '1983 to 2008' );
//$x_legend->set_style( '{font-size: 20px; color: #778877}' );
//$chart->set_x_legend( $x_legend );
//
// remove this when the Y Axis is smarter
//
$y = new y_axis();
$max = $this->get_the_right_y(max($price));
$max = $max > 0 ? $max : 1;
$y->set_range(0, ($max / 5 + 1) * 5, $max / 5 + 1);
// if ($max > 20 && $max <= 100) {
//
// $y->set_range(0, $max, 10);
// }elseif($max >= 10&&$max<=20){
// $y->set_range(0, $max, 5);
// }
// else {
// $y->set_range(0, $max);
// }
$y->set_colour('#000000');
$y->set_grid_colour('#dadada');
if ($type == 'percent') {
$y->set_label_text(" #val#%");
} else {
$y->set_label_text(" #val#");
}
$chart->add_y_axis($y);
$info = $chart->toPrettyString();
return $info;
}
示例13: result_screen
//.........这里部分代码省略.........
$sql_table = 'polls';
$sql_field = 'added';
$page_detail = "Showing the number of Polls added. (Note: All times based on GMT)";
} else {
if ($mode == 'rqst') {
$table = 'Request Statistics';
$sql_table = 'requests';
$sql_field = 'added';
$page_detail = "Showing the number of Requests made. (Note: All times based on GMT)";
}
}
}
}
}
}
}
}
}
}
switch ($_POST['timescale']) {
case 'daily':
$sql_date = "%w %U %m %Y";
$php_date = "F jS - Y";
// $sql_scale = "DAY";
break;
case 'monthly':
$sql_date = "%m %Y";
$php_date = "F Y";
// $sql_scale = "MONTH";
break;
default:
// weekly
$sql_date = "%U %Y";
$php_date = " [F Y]";
// $sql_scale = "WEEK";
break;
}
$sortby = isset($_POST['sortby']) ? mysql_real_escape_string($_POST['sortby']) : "";
// $sortby = sqlesc($sortby);
$sqlq = "SELECT UNIX_TIMESTAMP(MAX({$sql_field})) as result_maxdate,\n\t\t\t\t COUNT(*) as result_count,\n\t\t\t\t DATE_FORMAT({$sql_field},'{$sql_date}') AS result_time\n\t\t\t\t FROM {$sql_table}\n\t\t\t\t WHERE UNIX_TIMESTAMP({$sql_field}) > '{$from_time}'\n\t\t\t\t AND UNIX_TIMESTAMP({$sql_field}) < '{$to_time}'\n\t\t\t\t GROUP BY result_time\n\t\t\t\t ORDER BY {$sql_field} {$sortby}";
$res = @mysql_query($sqlq);
$running_total = 0;
$max_result = 0;
$results = array();
if (mysql_num_rows($res)) {
while ($row = mysql_fetch_assoc($res)) {
if ($row['result_count'] > $max_result) {
$max_result = $row['result_count'];
}
$running_total += $row['result_count'];
$results[] = array('result_maxdate' => $row['result_maxdate'], 'result_count' => $row['result_count'], 'result_time' => $row['result_time']);
}
include 'chart/php-ofc-library/open-flash-chart.php';
foreach ($results as $pOOp => $data) {
$counts[] = (int) $data['result_count'];
if ($_POST['timescale'] == 'weekly') {
$labes[] = "Week #" . strftime("%W", $data['result_maxdate']) . "\n" . date($php_date, $data['result_maxdate']);
} else {
$labes[] = date($php_date, $data['result_maxdate']);
}
}
$title = new title($page_title . "\n" . ucfirst($_POST['timescale']) . " " . $table . " " . $human_from_date['mday'] . " " . $month_names[$human_from_date['mon']] . " " . $human_from_date['year'] . " to " . $human_to_date['mday'] . " " . $month_names[$human_to_date['mon']] . " " . $human_to_date['year']);
$chart = new open_flash_chart();
$chart->set_title($title);
$line_1 = new line_hollow();
$line_1->set_values($counts);
$line_1->set_key($table . " | Total: " . $running_total, 12);
$line_1->set_halo_size(1);
$line_1->set_width(2);
$line_1->set_colour('#0099FF');
$line_1->set_dot_size(5);
$chart->add_element($line_1);
$x_labels = new x_axis_labels();
$x_labels->set_steps(2);
$x_labels->set_vertical();
$x_labels->set_colour('#000000');
$x_labels->set_size(12);
$x_labels->set_labels($labes);
$x = new x_axis();
$x->set_colours('#A2ACBA', '#ECFFAF');
$x->set_steps(2);
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_steps(2);
$y->set_colour('#A2ACBA');
$y->set_range(0, max($counts) + 5, 50);
$chart->add_y_axis($y);
$cont = $chart->toPrettyString();
// toFile($_SERVER["DOCUMENT_ROOT"]."/chart/","chart.json",$cont,false);
// unset($cont);
$html = "<script type=\"text/javascript\" src=\"chart/js/json/json2.js\"></script>";
$html .= "<script type=\"text/javascript\" src=\"chart/js/swfobject.js\"></script>";
$html .= "<script type=\"text/javascript\">\n\n\t\t\t\tfunction open_flash_chart_data()\n\t\t\t\t{\n\t\t\t\treturn JSON.stringify(data);\n\t\t\t\t}\n\n\t\t\t\tfunction findSWF(movieName) {\n\t\t\t\t if (navigator.appName.indexOf(\"Microsoft\")!= -1) {\n\t\t\t\t\treturn window[movieName];\n\t\t\t\t } else {\n\t\t\t\t\treturn document[movieName];\n\t\t\t\t }\n\t\t\t\t}\n\n\t\t\t\tvar data = " . $cont . ";\n\n\t\t\t\t\t swfobject.embedSWF(\"chart/open-flash-chart.swf\", \"my_chart\", \"800\", \"" . (max($counts) * 5 < 200 ? "250" : (max($counts) * 5 > 400 ? "400" : max($counts) * 5)) . "\", \"9.0.0\", \"expressInstall.swf\", {\"loading\":\"Please wait while the stats are loaded!\"} );\n\t\t\t\t\t </script>";
$html .= "<div id=\"my_chart\"></div>";
} else {
$html .= "No results found\n";
}
print $html . "<br />";
}
示例14: 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();
}
示例15:
$line_dot->set_key($legend, 10);
$chart->add_element($line_dot);
$line_dot = NULL;
}
$y = new y_axis();
// grid steps:
$y->set_range(0, $max_val + 10, (int) (($max_val + 10) / 10));
/*$y_labels = new y_axis_labels();
$y_labels->set_size (15);
$y->set_labels( $y_labels );*/
$chart->set_y_axis($y);
$x = new x_axis();
$x->offset(true)->steps(1);
//var_dump($labels);
$chart->set_x_axis($x);
//
// Style the X Axis Labels:
//
$x_labels = new x_axis_labels();
// show every other label:
$x_labels->set_steps(5);
//$x_labels->set_size( 15 );
// set them vertical
//$x_labels->set_vertical();
$x_labels->set_labels($labels);
//
// Add the X Axis Labels to the X Axis
//
$x->set_labels($x_labels);
//$x->set_labels_from_array($labels);
echo $chart->toPrettyString();