本文整理汇总了PHP中x_axis_labels::set_labels方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis_labels::set_labels方法的具体用法?PHP x_axis_labels::set_labels怎么用?PHP x_axis_labels::set_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis_labels
的用法示例。
在下文中一共展示了x_axis_labels::set_labels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildChart
protected function buildChart()
{
$chart = $this->getGraph();
// $title = new title('No data');
// $title->set_style('{font-size: 25px;}');
// $chart->set_title($title);
//
$area = $this->createArea();
$dotValues = $this->buildDotValues('#f58615');
$area->set_values($dotValues);
// add the area object to the chart:
$chart->add_element($area);
$y_axis = $this->createYAxis();
$y_axis->set_range(max(0, min($this->values) - 1), max($this->values) + 1);
$y_axis->set_steps(ceil(max($this->values) / 4));
//y_axis legend
$y_legend = new y_legend('Viewers');
$y_legend->set_style('color: #515151; font-size: 12px;');
$chart->set_y_legend($y_legend);
$x_axis = $this->createXAxis();
$x_axis->set_steps(1);
$x_labels = new x_axis_labels();
$x_labels->set_labels(array_values($this->labels));
//$x_labels->set_steps( 1 );
// Add the X Axis Labels to the X Axis
$x_axis->set_labels($x_labels);
$chart->add_y_axis($y_axis);
$chart->x_axis = $x_axis;
return $chart;
}
示例2: get_laba_rugi
/**
* Generates data for OFC2 line chart in json format
*
* @return void
*/
public function get_laba_rugi()
{
$this->load->plugin('ofc2');
$this->load->model('jurnal_model');
$model_data = $this->jurnal_model->get_laba_rugi_data();
$bulan_data = array("Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des");
for ($i = date('n') + 1; $i <= 12; $i++) {
$pendapatan_kredit = isset($model_data[$i][date('Y') - 1][4][0]) ? $model_data[$i][date('Y') - 1][4][0] : 0;
$pendapatan_debit = isset($model_data[$i][date('Y') - 1][4][1]) ? $model_data[$i][date('Y') - 1][4][1] : 0;
$beban_kredit = isset($model_data[$i][date('Y') - 1][5][0]) ? $model_data[$i][date('Y') - 1][5][0] : 0;
$beban_debit = isset($model_data[$i][date('Y') - 1][5][1]) ? $model_data[$i][date('Y') - 1][5][1] : 0;
$data[] = $pendapatan_kredit - $pendapatan_debit - ($beban_debit - $beban_kredit);
$thn = date('y') - 1;
$thn = strlen($thn) == 1 ? '0' . $thn : $thn;
$x_data[] = $bulan_data[$i - 1] . "'" . $thn;
}
for ($i = 1; $i <= date('n'); $i++) {
$pendapatan_kredit = isset($model_data[$i][date('Y')][4][0]) ? $model_data[$i][date('Y')][4][0] : 0;
$pendapatan_debit = isset($model_data[$i][date('Y')][4][1]) ? $model_data[$i][date('Y')][4][1] : 0;
$beban_kredit = isset($model_data[$i][date('Y')][5][0]) ? $model_data[$i][date('Y')][5][0] : 0;
$beban_debit = isset($model_data[$i][date('Y')][5][1]) ? $model_data[$i][date('Y')][5][1] : 0;
$data[] = $pendapatan_kredit - $pendapatan_debit - ($beban_debit - $beban_kredit);
$x_data[] = $bulan_data[$i - 1] . "'" . date('y');
}
$max = (int) max($data);
$maxlen = strlen($max);
$up = round($max, -($maxlen - 1));
$min = (int) min($data);
$minlen = strlen($min);
$down = round($min, -($minlen - 1));
$abs_max = (int) max(abs($max), abs($min));
$len = strlen($abs_max);
$round = round($abs_max, -($len - 1));
$step = '1' . substr($round, 1);
$up = $max > $up ? $up + $step : $up;
$down = $min < $down ? $down - $step : $down;
$d = new hollow_dot();
$d->size(4)->halo_size(1)->colour('#668053');
$line = new line();
$line->set_values($data);
$line->set_default_dot_style($d);
$line->set_width(5);
$line->set_colour('#7491a0');
$x_labels = new x_axis_labels();
$x_labels->set_labels($x_data);
$x = new x_axis();
$x->set_labels($x_labels);
$x->set_grid_colour('#bfb8b3');
$y = new y_axis();
$y->set_grid_colour('#bfb8b3');
$y->set_range($down, $up, $step);
$chart = new open_flash_chart();
$chart->add_element($line);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
}
示例3:
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);
}
}
示例4: setUpGraph
protected function setUpGraph()
{
parent::setUpGraph();
$aDataSets = $this->getDataSets();
// if no data, or only one data point, we don't display the graph
if (count($this->xLabels) <= 1) {
return false;
}
$chart = $this->getGraph();
//set up the axes
$y_axis = $this->createYAxis();
$y_axis->set_range(max(0, $this->getMinYValue() - 1), $this->getMaxYValue() + 1);
$y_axis->set_steps(ceil($this->getMaxYValue() / 4));
$y_axis->set_label_text("#val#" . $this->yUnit);
//y_axis legend
$y_legend = new y_legend('Viewers');
$y_legend->set_style('color: #515151; font-size: 12px;');
$chart->set_y_legend($y_legend);
$x_axis = $this->createXAxis();
$x_values = $this->xLabels;
$xSteps = 5;
if (count($x_values) < $xSteps) {
$xSteps = count($x_values);
} else {
// hack around the set_steps that doesn't seem to work for X axis
foreach ($x_values as $i => &$xValue) {
if ($i % $xSteps != 0) {
$xValue = '';
}
}
}
$x_axis->set_steps($xSteps);
$x_labels = new x_axis_labels();
$x_labels->set_labels($x_values);
// Add the X Axis Labels to the X Axis
$x_axis->set_labels($x_labels);
$chart->add_y_axis($y_axis);
$chart->x_axis = $x_axis;
$oColorHelper = new Graph_DataSetColorsHelper();
foreach ($aDataSets as $aDataSet) {
$values = $aDataSet['values'];
$name = $aDataSet['name'];
$aColors = $oColorHelper->getNextColors();
$dotValues = $this->buildDotValues($aColors['line'], $values, $name);
$area = $this->createArea($aColors['line'], $aColors['fill']);
$area->set_fill_alpha("0.1");
$area->set_values($dotValues);
$area->set_text($name);
// add the area object to the chart:
$chart->add_element($area);
}
return $chart;
}
示例5: 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;
}
示例6: title
$bar_values[$p] += $r['products'];
}
//Start constructing charts
$title = new title('Last ' . $days . ' Days Sales Chart');
$title->set_style("{font-size:14px; font-weight:bold; padding:10px;}");
$chart = new open_flash_chart();
$chart->set_title($title);
$area = new area();
$area->set_colour('#5B56B6');
$area->set_values(array_values($bar_values));
$area->set_key('Products', 12);
$chart->add_element($area);
//define x-axis
$x_labels = new x_axis_labels();
$x_labels->set_steps(4);
$x_labels->set_labels($period);
$x = new x_axis();
$x->set_grid_colour('#D7E4A3');
//$x->set_offset($period_offset);
$x->set_steps(4);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart->set_x_axis($x);
//define y-axis
$y = new y_axis();
$range_min_value = 0;
$range_max_value = max($bar_values);
$y_data_step = ceil($range_max_value / $y_points);
$y_data_step = $y_data_step - $y_data_step % 100;
$range_max_value = ceil($range_max_value / $y_data_step) * $y_data_step;
$y->set_range($range_min_value, $range_max_value, $y_data_step);
示例7: 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();
示例8: line
$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);
//$chart->add_element( $line_tot );
//$chart->add_element( $sline );
示例9: axis
/**
* Use this method to set up the axis' range and labels. There are also a number
* of options (mostly styling) that can be set up. The two axis have different
* options, but a full documentation can be found on the links given under.
* Importantly though, the y has a range option that takes an array with 3 values
* (minimum value, max value and step size). On the x axis you will often want
* to use the labels from the dataset and the helper will add those labels if
* you have defined a proper labels path, either as the third parameter of
* setDate() or using the setLabelsPat() method. Note, that even if you require
* no options for the x-axis, you will have to call this method on that axis
* for it to use those labels.
*
* See documentation for options ;
* http://teethgrinder.co.uk/open-flash-chart-2/x-axis.php
* http://teethgrinder.co.uk/open-flash-chart-2/y-axis.php
*
* @example $flashChart->axis('x'); //Sets labels from dataset
* @example $flashChart->axis('x',array('labels'=>array('Things','To','Do')),array('colour'=>'#aaFF33', 'vertical'=>true));
* @example $flashChart->axis('y', array('range'=>array(0,50,5), 'tick_length'=>15);
* @param string $axis 'x' or 'y'
* @param array $options
* @param array $labelsOptions used to customize x axis labels
*/
public function axis($axis, $options = array(), $labelsOptions = array())
{
$axis_object_name = $axis . '_axis';
$axis_set_method = 'set_' . $axis . '_axis';
$axis_object = new $axis_object_name();
foreach ($options as $key => $setting) {
// special options set direcly bellow
if (in_array($key, array('labels', 'range'))) {
continue;
}
$set_method = 'set_' . $key;
if (is_array($setting)) {
switch ($key) {
case 'colours':
$axis_object->set_colours($setting[0], $setting[1]);
break;
default:
$axis_object->{$set_method}($setting);
}
} else {
$axis_object->{$set_method}($setting);
}
}
// that wich must always be set :
if (!isset($options['colour'])) {
$axis_object->set_colour($this->grid_colour);
}
if (!isset($options['grid_colour'])) {
$axis_object->set_grid_colour($this->grid_colour);
}
if (isset($options['range'])) {
if (isset($options['range'][0])) {
$min = $options['range'][0];
} else {
$min = $this->defaultRange[$axis][0];
}
if (isset($options['range'][1])) {
$max = $options['range'][1];
} else {
$max = $this->defaultRange[$axis][1];
}
if (isset($options['range'][2])) {
$step = $options['range'][2];
} else {
$step = $this->defaultRange[$axis][2];
}
if ($axis == 'y') {
$axis_object->set_range($min, $max, $step);
} else {
// $axis == 'x'
$axis_object->set_range($min, $max);
$axis_object->set_steps($step);
}
} else {
if ($axis == 'y') {
$axis_object->set_range($this->defaultRange[$axis][0], $this->defaultRange[$axis][1], $this->defaultRange[$axis][2]);
}
}
if ($axis == 'x' && is_string($this->labelsPath) && !empty($this->labelsPath)) {
if (sizeof($labelsOptions) > 0) {
$labels = Set::extract($this->data, $this->labelsPath);
$x_axis_label = new x_axis_labels();
foreach ($labelsOptions as $key => $setting) {
$set_method = 'set_' . $key;
$x_axis_label->{$set_method}($setting);
}
$x_axis_label->set_labels($labels);
$axis_object->set_labels($x_axis_label);
} else {
$labels = Set::extract($this->data, $this->labelsPath);
$axis_object->set_labels_from_array($labels);
}
} elseif (isset($options['labels']) && is_array($options['labels']) && $axis == 'x') {
if (isset($labelsOptions['vertical']) && $labelsOptions['vertical'] == true) {
$x_axis_label = new x_axis_labels();
$x_axis_label->set_vertical();
$x_axis_label->set_labels($options['labels']);
//.........这里部分代码省略.........
示例10: 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();
}
示例11: array
/**
* assign the chartdata object for open flash chart library
* @param $config
* @return unknown_type
*/
function _setChartdata($config)
{
$model = $this->getModel();
$rounds = $this->get('Rounds');
$round_labels = array();
foreach ($rounds as $r) {
$round_labels[] = $r->name;
}
$division = $this->get('division');
$data = $model->getDataByDivision($division->id);
//create a line
$length = count($rounds) - 0.5;
$linewidth = $config['color_legend_line_width'];
$lines = array();
//$title = $division->name;
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->set_bg_colour($config['bg_colour']);
//colors defined for ranking table lines
//todo: add support for more than 2 lines
foreach ($this->colors as $color) {
foreach ($rounds as $r) {
for ($n = $color['from']; $n <= $color['to']; $n++) {
$lines[$color['color']][$n][] = $n;
}
}
}
//set lines on the graph
foreach ($lines as $key => $value) {
foreach ($value as $line => $key2) {
$chart->add_element(hline($key, $length, $line, $linewidth));
}
}
//load team1, first team in the dropdown
$team = $this->team1;
$d = new $config['dotstyle_1']();
$d->size((int) $config['line1_dot_strength']);
$d->halo_size(1);
$d->colour($config['line1']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($team->rankings);
$line->set_width((int) $config['line1_strength']);
$line->set_key($team->name, 12);
$line->set_colour($config['line1']);
$line->on_show(new line_on_show($config['l_animation_1'], $config['l_cascade_1'], $config['l_delay_1']));
$chart->add_element($line);
//load team2, second team in the dropdown
$team = $this->team2;
$d = new $config['dotstyle_2']();
$d->size((int) $config['line2_dot_strength']);
$d->halo_size(1);
$d->colour($config['line2']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($team->rankings);
$line->set_width((int) $config['line2_strength']);
$line->set_key($team->name, 12);
$line->set_colour($config['line2']);
$line->on_show(new line_on_show($config['l_animation_2'], $config['l_cascade_2'], $config['l_delay_2']));
$chart->add_element($line);
$x = new x_axis();
if ($config['x_axis_label'] == 1) {
$xlabels = new x_axis_labels();
$xlabels->set_labels($round_labels);
$xlabels->set_vertical();
}
$x->set_labels($xlabels);
$x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$chart->set_x_axis($x);
$x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_CURVE_ROUNDS'));
$x_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_x_legend($x_legend);
$y = new y_axis();
$y->set_range(count($data), 1, -1);
$y->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$chart->set_y_axis($y);
$y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_CURVE_RANK'));
$y_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_y_legend($y_legend);
ob_clean();
echo $chart->toString();
}
示例12: max
if (empty($array)) $array[] = 0;
$bar->set_values( $array );
$bar->set_tooltip("#val#<br>Average = ".commify($avg[0]));
$bar2->set_values( ($avg) );
$bar2->set_colour( "#40FF40" );
$bar2->set_tooltip("#val#<br>Average [#x_label#]");
//
// create a Y Axis object
//
$y = new y_axis();
// grid steps:
$y->set_range( 0, max($array), round(max($array)/10));
$chart->set_y_axis( $y );
$x_labels = new x_axis_labels();
$x_labels->set_vertical();
$x_labels->set_labels( $hms );
$x = new x_axis();
$x->set_labels( $x_labels );
$chart->set_x_axis( $x );
echo $chart->toPrettyString();
break;
case "chart_mpd":
$title = new title( date("D M d Y") );
$bar = new bar_rounded_glass();
// -------------------------
// Get Messages Per Day
// -------------------------
$array = array();
// Below will update today every time the page is refreshed, otherwise we get stale data
$sql = "REPLACE INTO cache (updatetime,name, value) SELECT NOW(), CONCAT('chart_mpd_',DATE_FORMAT(NOW(), '%Y-%m-%d_%a')), (SUM(value)/2) FROM cache WHERE name LIKE 'chart_mph_%'";
示例13: intval
$month[] = $s->getSourceIP();
$request[] = intval($s->getSourceIpCount());
}
$chart = new open_flash_chart();
$title = new title('Source IP Distribution');
$title->set_style("{font-size: 20px; color: #A2ACBA; text-align: center;}");
$chart->set_title($title);
$chart->set_bg_colour('#FFFFFF');
$area = new area();
$area->set_colour('#5B56B6');
$area->set_values($request);
$chart->add_element($area);
$x_labels = new x_axis_labels();
$x_labels->set_vertical();
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($month);
$x = new x_axis();
$x->set_colour('#A2ACBA');
$x->set_grid_colour('#D7E4A3');
$x->set_offset(false);
$x->set_steps(4);
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$x_legend = new x_legend(date("D M d Y"));
$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();
$y->set_range(0, $max_rec, ceil($max_rec / 10));
示例14: 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;
if ($y_max == $step) {
示例15: 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 />";
}