当前位置: 首页>>代码示例>>PHP>>正文


PHP y_axis::set_offset方法代码示例

本文整理汇总了PHP中y_axis::set_offset方法的典型用法代码示例。如果您正苦于以下问题:PHP y_axis::set_offset方法的具体用法?PHP y_axis::set_offset怎么用?PHP y_axis::set_offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在y_axis的用法示例。


在下文中一共展示了y_axis::set_offset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:madseller,项目名称:coperio,代码行数:42,代码来源:openflashrenderer.php

示例2: title

include '../php-ofc-library/open-flash-chart.php';
$chart = new open_flash_chart();
$chart->set_title(new title('Area Chart'));
//
// Make our area chart:
//
$area = new area();
// set the circle line width:
$area->set_width(2);
$area->set_default_dot_style(new hollow_dot());
$area->set_colour('#838A96');
$area->set_fill_colour('#E01B49');
$area->set_fill_alpha(0.4);
$area->set_values($data);
// add the area object to the chart:
$chart->add_element($area);
$y_axis = new y_axis();
$y_axis->set_range(-2, 2, 2);
$y_axis->labels = null;
$y_axis->set_offset(false);
$x_axis = new x_axis();
$x_axis->labels = $data;
$x_axis->set_steps(2);
$x_labels = new x_axis_labels();
$x_labels->set_steps(4);
$x_labels->set_vertical();
// 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;
echo $chart->toPrettyString();
开发者ID:rosickey,项目名称:pychartit,代码行数:31,代码来源:1.php

示例3: tooltip

    if ($max_value < $value) {
        $max_value = $value;
    }
    $y_labels[] = (string) $label;
    $hbar->append_value(new hbar_value(0, (double) $value));
}
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($hbar);
$step_count = $max_value > 0 ? $max_value / 10 : 1;
$x = new x_axis();
$x->set_offset(false);
$x->set_steps($max_value / 10);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_offset(true);
$y->set_labels($y_labels);
$chart->add_y_axis($y);
if (isset($yaxis_label)) {
    $y_legend = new y_legend($yaxis_label);
    $y_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_y_legend($y_legend);
}
if (isset($xaxis_label)) {
    $x_legend = new x_legend($xaxis_label);
    $x_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_x_legend($x_legend);
}
$chart->set_bg_colour("#f3f3f3");
$tooltip = new tooltip();
$tooltip->set_hover();
开发者ID:nguyennamtien,项目名称:PHP-Point-Of-Sale,代码行数:31,代码来源:hbar.php

示例4: flowview_viewchart

/** flowview_viewchart()
 *
 *  This function is taken from Slowlog.  Given
 *  a title, chart type and chart data, it will
 *  echo the required syntax for the Callback
 *  from the chart page to operate corectly.
 */
function flowview_viewchart()
{
    global $colors, $config;
    include $config['base_path'] . "/plugins/flowview/lib/open-flash-chart-object.php";
    include $config['base_path'] . "/plugins/flowview/lib/open-flash-chart.php";
    $title = $_REQUEST["title"];
    $chart_type = "bar";
    $column = $_REQUEST["type"];
    $sessionid = $_REQUEST["session"];
    /* get the chart data from the session */
    if (isset($_SESSION['flowview_flows'][$sessionid]['data'])) {
        $data = $_SESSION['flowview_flows'][$sessionid]['data'];
    } else {
        $filter = createfilter($sessionid);
        $data = $_SESSION['flowview_flows'][$sessionid]['data'];
    }
    switch ($column) {
        case 'flows':
            $unit = ucfirst($column);
            $suffix = "Total Flows";
            $_SESSION['sess_flows_flows'] = 'on';
            break;
        case 'bytes':
            $unit = ucfirst($column);
            $suffix = "Bytes Exchanged";
            $_SESSION['sess_flows_bytes'] = 'on';
            break;
        case 'packets':
            $unit = ucfirst($column);
            $suffix = "Packets Examined";
            $_SESSION['sess_flows_packets'] = 'on';
            break;
    }
    $columns = $_SESSION['flowview_flows'][$sessionid]['columns'];
    foreach ($columns as $key => $cdata) {
        if (strtolower($cdata) == $column) {
            $column = $key;
        }
    }
    if (sizeof($data)) {
        $elements = array();
        $legend = array();
        $maxvalue = 0;
        if (isset($_REQUEST['exclude']) && $_REQUEST['exclude'] > 0) {
            for ($i = 0; $i < $_REQUEST['exclude']; $i++) {
                array_shift($data);
            }
        }
        foreach ($data as $row) {
            if ($maxvalue < $row[$column]) {
                $maxvalue = $row[$column];
                $scaling = flowview_autoscale($row[$column]);
            }
        }
        $maxvalue = flowview_getmax($maxvalue);
        $autorange = flowview_autoscale($maxvalue);
        $maxvalue = $maxvalue / $autorange[0];
        $i = 0;
        foreach ($data as $row) {
            $elements[$i] = new bar_value(round($row[$column] / $autorange[0], 3));
            $elements[$i]->set_colour(flowview_get_color());
            $elements[$i]->set_tooltip($unit . ": #val# " . $autorange[1]);
            if (sizeof($row) == 4) {
                $legend[] = $row[0];
            } else {
                $legend[] = $row[0] . " -\n" . $row[1];
            }
            $i++;
        }
        $bar = new bar_glass();
        $bar->set_values($elements);
        $title = new title($title . " (" . $suffix . ")");
        $title->set_style("{font-size: 18px; color: #444444; text-align: center;}");
        $x_axis_labels = new x_axis_labels();
        $x_axis_labels->set_size(10);
        $x_axis_labels->rotate(45);
        $x_axis_labels->set_labels($legend);
        $x_axis = new x_axis();
        //$x_axis->set_3d( 3 );
        $x_axis->set_colours('#909090', '#909090');
        $x_axis->set_labels($x_axis_labels);
        $y_axis = new y_axis();
        $y_axis->set_offset(true);
        $y_axis->set_colours('#909090', '#909090');
        $y_axis->set_range(0, $maxvalue, $maxvalue / 10);
        $y_axis->set_label_text("#val# " . $autorange[1]);
        $chart = new open_flash_chart();
        $chart->set_title($title);
        $chart->add_element($bar);
        $chart->set_x_axis($x_axis);
        $chart->add_y_axis($y_axis);
        $chart->set_bg_colour('#FEFEFE');
        echo $chart->toString();
//.........这里部分代码省略.........
开发者ID:avillaverdec,项目名称:cacti,代码行数:101,代码来源:functions.php

示例5: ceil

        $data_step = $data_step_multiplier / 10;
    }
}
$data_max = ceil($data_max / $data_step) * $data_step;
//DRAW X AXIS
$x = new x_axis();
$x->set_offset(false);
$xl_tmp = array();
foreach ($dates as $date) {
    $xl_tmp[] = date('d.m', strtotime($date));
}
$x->steps(10);
$x->set_labels_from_array($xl_tmp);
//DRAW Y AXIS
$y = new y_axis();
$y->set_offset(false);
$y->set_range(0, $data_max, $data_step);
//SET TOOLTIP FORMAT
$t = new tooltip();
$t->set_shadow(false);
$t->set_stroke(5);
$t->set_colour("#cccccc");
$t->set_background_colour("#efefef");
$t->set_body_style("{font-size:10px; font-weight:bold; color:#000000;}");
//PREPARE FINAL CHART AND RETURN IT
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($line_1);
$chart->add_element($line_5);
//moved above to make sure line 2 is above line 5
$chart->add_element($line_2);
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:31,代码来源:analysis-depot-stock.php

示例6: 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);
//.........这里部分代码省略.........
开发者ID:easthero,项目名称:kohana,代码行数:101,代码来源:chart.php


注:本文中的y_axis::set_offset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。