本文整理汇总了PHP中x_axis::set_grid_colour方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis::set_grid_colour方法的具体用法?PHP x_axis::set_grid_colour怎么用?PHP x_axis::set_grid_colour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis
的用法示例。
在下文中一共展示了x_axis::set_grid_colour方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: title
//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);
$chart->add_y_axis($y);
echo $chart->toPrettyString();
示例4: max
$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 );
$chart->set_bg_colour('#ffffff');
$chart->set_y_axis($y);
$chart->set_x_axis($x);
示例5: 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;
}
示例6: while
if ($r > $max) {
$max = $r;
}
if (array_search($row[1], $lab) === FALSE) {
$val[] = $r;
$lab[] = $row[1];
} else {
$idx = array_search($row[1], $lab);
$val[$idx] += $r;
}
}
}
if (count($val) < 7) {
$lastedate = $lab[count($lab)];
while (count($val) < 7) {
$val[] = 0;
$lastdate = gmdate("M-j-Y", strtotime("-1 day", strtotime($lastdate)));
$lab[] = $lastdate;
}
}
$bar->set_values(array_reverse($val));
$x = new x_axis();
$x->set_colour('#428C3E');
$x->set_grid_colour('#86BF83');
$x->set_labels_from_array(array_reverse($lab));
$chart->set_x_axis($x);
$y = new y_axis();
$steps = round($max / 20);
$y->set_range(0, $max, $steps);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
示例7:
}
if ($array['low'] < $lowest) {
$lowest = $array['low'];
}
if ($array['date'] < $lowest_date) {
$lowest_date = $array['date'];
}
if ($array['date'] > $highest_date) {
$highest_date = $array['date'];
}
}
}
//
// create an X Axis object
$x = new x_axis();
$x->set_grid_colour("#E3E3E3");
//$x->steps(3);
//$x->set_labels_from_array($labels);
// grid line and tick every day
$x->set_steps(TIME_DAY);
$labels = new x_axis_labels();
$label_a = array_reverse($label_a);
$labels->set_labels($label_a);
$labels->text('#date:M d#');
$labels->set_steps(TIME_DAY);
$labels->visible_steps(1);
$labels->rotate(90);
// finally attach the label definition to the x axis
$x->set_labels($labels);
//$x->set_steps(TIME_DAY);
//SMA 50
示例8: netio
function netio()
{
function bit_to_kb($n)
{
return round($n / 1000, 2);
}
function bit_to_mb($n)
{
return round($n / 1000000, 2);
}
function get_data()
{
$recv_l = trim(shell_exec("cat /sys/class/net/eth0/statistics/rx_bytes")) / 8;
sleep(1);
$recv_n = trim(shell_exec("cat /sys/class/net/eth0/statistics/rx_bytes")) / 8;
return $recv_n - $recv_l;
}
if (array_key_exists('netio', $_SESSION) && array_key_exists('recv_l', $_SESSION)) {
if (count($_SESSION['netio']) == 10) {
array_shift($_SESSION['netio']);
$_SESSION['netio'][] = get_data();
} else {
$_SESSION['netio'][] = get_data();
$_SESSION['recv_l'] = end($_SESSION['netio']);
}
} else {
$_SESSION['netio'] = array(0, 0, 0, 0, 0, 0, 0, 0, 0);
$_SESSION['netio'][] = get_data();
$_SESSION['recv_l'] = end($_SESSION['netio']);
}
$data = $_SESSION['netio'];
/*
$data = array();
for($i=0;$i<40;$i++){
$data[] = rand(1000000,10000000);
}
*/
foreach (range(1, 10) as $i) {
settype($i, 'string');
$second[] = $i;
}
if (max($data) <= 1000) {
$data = array_map("bit_to_kb", $data);
$y_axis_max = 1;
$y_axis_key_text = " KB/s";
} elseif (max($data) <= 10000) {
$data = array_map("bit_to_kb", $data);
$y_axis_max = 10;
$y_axis_key_text = " KB/s";
} elseif (max($data) <= 100000) {
$data = array_map("bit_to_kb", $data);
$y_axis_max = 100;
$y_axis_key_text = " KB/s";
} elseif (max($data) <= 1000000) {
$data = array_map("bit_to_kb", $data);
$y_axis_max = 1000;
$y_axis_key_text = " KB/s";
} elseif (max($data) <= 10000000) {
$data = array_map("bit_to_mb", $data);
$y_axis_max = 10;
$y_axis_key_text = " MB/s";
} else {
$data = array_map("bit_to_mb", $data);
$y_axis_max = 100;
$y_axis_key_text = " MB/s";
}
$y_axis_step = $y_axis_max / 5;
$chart = new open_flash_chart();
$title = new title("实时流量显示");
$title->set_style("{font-size: 12px; color: #A2ACBA; text-align: center;}");
$chart->set_title($title);
#点是指曲线图上的顶点
# $d = new dot();
# $d->colour('#9C0E57')->size(3);
$area = new area();
#width是指曲线的宽度
# $area->set_width(3);
# $area->set_default_dot_style($d);
$area->set_colour('#5B56B6');
#value即曲线顶的值
$area->set_values($data);
#左上角的文字
$area->set_key($y_axis_key_text, 10);
$area->set_fill_colour('#CCCAAA');
#设透明度
$area->set_fill_alpha(0.3);
#area设置结束,使用add_element方法把area加进来
$chart->add_element($area);
$chart->set_bg_colour('#FFFFFF');
#设置label
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($second);
#设置X轴
$x_axis = new x_axis();
$x_axis->set_colour('#A2ACBA');
$x_axis->set_grid_colour('#D7E4A3');
$x_axis->set_offset(false);
//.........这里部分代码省略.........
示例9: array
function get_graph($field, $args)
{
$defaults = array('ids' => false, 'colors' => array('#EF8C08', '#21759B', '#1C9E05'), 'grid_color' => '#f7e8bf', 'bg_color' => '#FFFFFF', 'odd' => false, 'truncate' => 40, 'truncate_label' => 15, 'response_count' => 10, 'user_id' => false, 'type' => 'default', 'x_axis' => false, 'data_type' => 'count', 'limit' => '', 'x_start' => '', 'x_end' => '', 'show_key' => false, 'min' => '', 'max' => '', 'include_zero' => false, 'width' => 400, 'height' => 400);
$args = wp_parse_args($args, $defaults);
$vals = $this->get_graph_values($field, $args);
extract($args);
extract($vals);
$title = new title(preg_replace("/&#?[a-z0-9]{2,8};/i", "", FrmAppHelper::truncate($field->name, $truncate, 0)));
$chart = new open_flash_chart();
$chart->set_title($title);
$bar = new bar_glass();
$x = new x_axis();
$y = new y_axis();
$x_labels = new x_axis_labels();
if (in_array($field->type, array('select', 'checkbox', 'radio', '10radio', 'scale')) and (!isset($x_inputs) or !$x_inputs)) {
$x_labels->rotate(340);
//$x_labels->set_colour( '#A2ACBA' );
//$x->set_colour( '#A2ACBA' );
} else {
if ($field->type == 'user_id') {
if (!$pie) {
$x_labels->rotate(340);
}
} else {
$x_labels->rotate(340);
}
}
$pie = $type == 'default' ? $pie : ($type == 'pie' ? true : false);
if ($pie) {
$bar = new pie();
$bar->set_alpha(0.6);
$bar->set_start_angle(35);
$bar->add_animation(new pie_fade());
$bar->set_tooltip('#val# (#percent#)');
$bar->set_colours($colors);
$pie_values = array();
foreach ($values as $val_key => $val) {
if ($val) {
$pie_values[] = new pie_value($val, "{$labels[$val_key]} (" . round($val / $total_count * 100) . "%)");
}
}
$bar->set_values($pie_values);
} else {
$color = $odd ? current($colors) : next($colors);
if (!$color) {
$color = reset($colors);
}
if ($type == 'line') {
$bar = new line();
} else {
if ($type == 'hbar') {
$bar = new hbar($color);
} else {
if ($type == 'area') {
$bar = new area();
} else {
if ($type == 'bar_flat') {
$bar = new bar($color);
} else {
$bar = new bar_glass($color);
}
}
}
}
$bar->set_colour($color);
$bar->set_values($values);
if ($show_key) {
$bar->set_key(stripslashes($field->name), $show_key);
}
$x_labels->set_labels($labels);
$x->set_labels($x_labels);
$x->set_grid_colour($grid_color);
$y->set_grid_colour($grid_color);
if ($combine_dates and !strpos($width, '%') and count($labels) * 30 > (int) $width) {
$x_labels->visible_steps(ceil(count($labels) * 30 / (int) $width));
}
$set_max = $max;
if (!empty($values) and empty($max)) {
$max = abs(max($values) * 1.2);
if ($max < 3) {
$max = 3;
}
}
foreach ($ids as $f_id) {
$new_max = abs(max($f_values[$f_id]) * 1.2);
if ($set_max != $max and $new_max > $max) {
$max = $new_max;
}
unset($f_id);
unset($new_max);
}
$bars = array();
foreach ($f_values as $f_id => $f_vals) {
if ($type == 'line') {
$bars[$f_id] = new line();
} else {
if ($type == 'hbar') {
$bars[$f_id] = new hbar($color);
} else {
if ($type == 'area') {
//.........这里部分代码省略.........
示例10: Line
$bval = new bar_value($data_curr[$i]);
$bval->{"on-click"} = "load_chart('month',{$ttime_axis[$i]})";
$data[] = $bval;
}
$bar_curr->set_values($data);
$lin_soll = new Line();
$lin_soll->set_key("Sollwert {$curr_year}", 11);
$lin_soll->set_colour('#BFA447');
$lin_soll->set_width(1);
$lin_soll->set_values($data_soll);
$max = max(max($data_last), max($data_curr), max($data_soll)) * 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_colour('#333333');
$x_labels->set_labels($time_axis);
$x = new x_axis();
$x->set_colour('#333333');
$x->set_grid_colour('#CCCCCC');
$x->set_steps(1);
$x->set_labels($x_labels);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->set_bg_colour('#ffffff');
$chart->set_tooltip($tooltip);
$chart->add_element($bar_last);
$chart->add_element($bar_curr);
$chart->add_element($lin_soll);
$chart->set_y_axis($y);
$chart->set_x_axis($x);
echo $chart->toString();
示例11: get_linear_graph
function get_linear_graph($dates, $vals, $keys = array())
{
include 'php-ofc-library/open-flash-chart.php';
$max_y = 0;
$arr_filled = array();
for ($i = 0; $i < count($dates); $i++) {
$year[] = $dates[$i];
for ($m = 0; $m < count($vals); $m++) {
$price[$m][] = (int) $vals[$m][$i];
if ($max_y < (int) $vals[$m][$i]) {
$max_y = (int) $vals[$m][$i];
}
if (@$arr_filled[$m] != $vals[$m][$i] and @$arr_filled[$m] == 0) {
@($arr_filled[$m] = (int) $vals[$m][$i]);
}
}
}
while ($max_y % 10 != 0) {
$max_y++;
}
$chart = new open_flash_chart();
//$title = new title( 'UK Petrol price (pence) per Litre' );
$d = new anchor();
if (count($dates) > 60) {
$d->size(2);
} else {
$d->size(3);
}
$d->halo_size(1);
$d->colour('#3D5C56');
$d->rotation(0);
$d->sides(4);
for ($i = 0; $i < count($price); $i++) {
if ($arr_filled[$i] == 0) {
continue;
}
if ($i == 0) {
$color = '#5E0722';
} elseif ($i == 1) {
$color = '#00FF00';
} else {
$color = '#FF0000';
}
$area = new area();
$area->set_colour($color);
$area->set_default_dot_style($d);
$area->set_values($price[$i]);
if (isset($keys[$i])) {
$area->set_key($keys[$i], 12);
}
// mb_convert_encoding($keys[$i], "UTF-8", "Windows-1251")
$area->set_width(2);
$chart->add_element($area);
}
$x_labels = new x_axis_labels();
if (count($dates) > 40) {
$x_labels->set_steps(7);
} else {
$x_labels->set_steps(1);
}
$x_labels->set_vertical();
$x_labels->set_colour('#000000');
$x_labels->set_labels($year);
$x_labels->rotate(-55);
$x_labels->set_size(12);
$x = new x_axis();
$x->set_colour('#000000');
$x->set_grid_colour('#DDDDDD');
//$x->set_offset( false );
$x->set_steps(1);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_range(0, $max_y);
$y->set_colour('#000000');
$y->set_grid_colour('#DDDDDD');
$chart->add_y_axis($y);
$chart->set_bg_colour("#FFFFFF");
?>
<script type="text/javascript" src="script/json/json2.js"></script>
<script type="text/javascript" src="script/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "600", "350", "9.0.0");
</script>
<script type="text/javascript">
function ofc_ready()
{
}
function open_flash_chart_data()
{
return JSON.stringify(data);
}
//.........这里部分代码省略.........