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

From: Date: Tue, 01 Oct 2013 08:15:58 +0000
Subject: Bug->Doc #65756 [Opn->Asn]: RRDGraph->setOptions wont accept multiple --color options
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10340@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: Open +Status: Assigned -Type: Bug +Type: Documentation Problem Package: rrd Operating System: Linux/CentOS/RHEL PHP Version: Irrelevant -Assigned To: +Assigned To: koubel Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#10340) next »