php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65756 RRDGraph->setOptions wont accept multiple --color options
Submitted: 2013-09-24 22:06 UTC Modified: 2014-01-13 22:36 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shaun dot reitan at ndchost dot com Assigned: koubel (profile)
Status: Closed Package: rrd (PECL)
PHP Version: Irrelevant OS: Linux/CentOS/RHEL
Private report: No CVE-ID: None
 [2013-09-24 22:06 UTC] shaun dot reitan at ndchost dot com
Description:
------------
For obvious reasons the setOptions() method of RRDGraph doesnt seam to accept multiple --color switches.  Since an array is passed this makes sense being that you cant have multiple keys with the same name.  I tried to not use the key => value method and pass mutliples using array( '--color BACK#00000000', '--color GRID#00000000', ...); but that doesnt appear to work either.

Not really sure what the option is to resolve this...

Test script:
---------------
$rrdgraph = new RRDGraph("-");
$rrdgraph->setOptions( array(
   '--color' => 'BACK#00000000',
   '--color' => 'GRID#00000000',
   '--color' => 'MGRID#00000000',
));
$rrddata = $rrdgraph->saveVerbose();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-28 21:28 UTC] bryandamage at gmail dot com
i've been able to get multiple color switch using this format.

$rrdgraph = new RRDGraph("-");
$rrdgraph->setOptions( array(
   '--color=BACK#00000000',
   '--color=GRID#00000000',
   '--color=MGRID#00000000',
));
$rrddata = $rrdgraph->saveVerbose();
 [2013-09-28 21:36 UTC] shaun dot reitan at ndchost dot com
Bryan,

I just figured it out the other day that I could simply do the following.  

array('--color', 'BACK#00000000', '--color', 'GRID#00000000', ...);

As much as i liked using a key/value pair for easy reading, I decided to just 
stick with each option being an array value like above.

Also, maybe we should update the php docs to show an example of this?
 [2013-10-01 08:15 UTC] koubel@php.net
-Status: Open +Status: Assigned -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: koubel
 [2013-10-01 08:15 UTC] koubel@php.net
You declare array with same key multiple times, hence your argument for the setOption call like:

array(
   '--color' => 'BACK#00000000',
   '--color' => 'GRID#00000000',
   '--color' => 'MGRID#00000000',
);

is in fact only:

array(
   '--color' => 'MGRID#00000000'
);

this is the nature of php arrays.

Solution is suggested by Brian. I agree with the better docs, but I need to find the repo with the php-docs, it takes some time, it's little bit complicated for me modifying the php-docs one per many years.
 [2014-01-13 22:31 UTC] koubel@php.net
Automatic comment from SVN on behalf of koubel
Revision: http://svn.php.net/viewvc/?view=revision&revision=332610
Log: rrd: more examples for RRDGraph::setOptions #65756
 [2014-01-13 22:33 UTC] koubel@php.net
-Status: Assigned +Status: Closed
 [2014-01-13 22:33 UTC] koubel@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-01-13 22:36 UTC] koubel@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC