略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: RRDGraph::setOptions

2024-12-21

RRDGraph::setOptions

(PECL rrd >= 0.9.0)

RRDGraph::setOptionsSets the options for rrd graph export

说明

public RRDGraph::setOptions(array $options): void

参数

options

List of options for the image generation from the RRD database file. It can be list of strings or list of strings with keys for better readability. Read the rrd graph man pages for list of available options.

返回值

没有返回值。

范例

示例 #1 RRDGraph::setOptions() example

<?php
$graphObj
->setOptions(array(
    
"--start" => "920804400",
    
"--end" => 920808000,
    
"--vertical-label" => "m/s",
    
"DEF:myspeed=$rrdFile:speed:AVERAGE",
    
"CDEF:realspeed=myspeed,1000,*",
    
"LINE2:realspeed#FF0000"
));
?>

示例 #2 Set multiple color options

<?php
$graphObj
->setOptions(array(
    
"--start" => "920804400",
    
"--end" => 920808000,
    
"--vertical-label" => "m/s",
    
"--color=BACK#00000000",
    
"--color=GRID#00000000",
    
"--color=MGRID#00000000",
    
"DEF:myspeed=$rrdFile:speed:AVERAGE",
    
"CDEF:realspeed=myspeed,1000,*",
    
"LINE2:realspeed#FF0000"
));
?>

Don't use key value syntax for same rrd option. It looks more readable, but it doesn't work.

<?php
$graphObj
->setOptions(array(
    
"--color" => "BACK#00000000",
    
"--color" => "GRID#00000000",
    
"--color" => "MGRID#00000000"
));
?>

In nature of php it's same as

<?php
$graphObj
->setOptions(array(
    
"--color" => "MGRID#00000000"
));
?>
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/rrdgraph.setoptions.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3