Doc #65756 [Asn->Csd]: RRDGraph->setOptions wont accept multiple --color options

From: Date: Mon, 13 Jan 2014 22:33:27 +0000
Subject: Doc #65756 [Asn->Csd]: RRDGraph->setOptions wont accept multiple --color options
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10840@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65756&edit=1 ID: 65756 Updated by: koubel@php.net Reported by: shaun dot reitan at ndchost dot com Summary: RRDGraph->setOptions wont accept multiple --color options -Status: Assigned +Status: Closed Type: Documentation Problem Package: rrd Operating System: Linux/CentOS/RHEL PHP Version: Irrelevant Assigned To: koubel Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2014-01-13 22:31:23] 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 ------------------------------------------------------------------------ [2013-10-01 08:15:58] 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. ------------------------------------------------------------------------ [2013-09-28 21:36:27] 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-09-28 21:28:58] 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-24 22:06:34] 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(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65756&edit=1

« previous php.doc.bugs (#10840) next »