|
|
Page 1 of 1
|
[ 5 posts ] |
|
Author |
Message |
gladder
New pChart user
Joined: Sat Aug 13, 2011 6:03 pm Posts: 3
|
Bug in pDraw.class.php
Hi Board,
I think pDraw.class.php is messed up. Using custom colors for lincharts is not working. using config array( "DisplayColor" => DISPLAY_MANUAL, "DisplayR"=>100, "DisplayG"=>100, "DisplayB"=>100 )
does not take effect.
To fix this you have to change: $this->drawLine($LastX,$LastY,$X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
to $this->drawLine($LastX,$LastY,$X,$Y,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight));
Maybe line 3372 should get changed from $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL;
to $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_AUTO;
to implement a better default value? This could have side effects for sure and is an idea only.
Bye!
|
Sat Aug 13, 2011 6:31 pm |
|
|
gladder
New pChart user
Joined: Sat Aug 13, 2011 6:03 pm Posts: 3
|
Re: Bug in pDraw.class.php
Hi Board,
this FIX I've just posted has bad side-effects. the palette of the series gets ignored now. So the fix has to be different: Be sure to fix the original file - the fix above has to be ignored...
change line 3372 from $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; to $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_AUTO;
change line 3392 from if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } to if ( $DisplayColor == DISPLAY_MANUAL ) { $R = $DisplayR; $G = $DisplayG; $B = $DisplayB; }
change line 3417 from $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); to $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$R,"G"=>$G,"B"=>$B,"Align"=>$Align));
change line 3445 from { $this->drawText($X+$DisplayOffset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); } to { $this->drawText($X+$DisplayOffset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$R,"G"=>$G,"B"=>$B,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); }
NOTE: This whole issue does also regard to many other functions in pDraw.class.php. It seems to be a kind of a design error regarding the manual color definition of charts not using the setPalette function of the drawn series...
Bye!
|
Sat Aug 13, 2011 6:57 pm |
|
|
jean-damien
Site Admin
Joined: Thu Dec 02, 2010 2:31 pm Posts: 409 Location: France
|
Re: Bug in pDraw.class.php
There is no bug there ;o) The color of the lines on the line chart depends of the color mapped to the data serie. The DisplayR, DisplayG, DisplayB parameters only apply to the labels. ( http://wiki.pchart.net/doc.chart.drawlinechart.html) Kind regards, JD.
|
Sat Aug 13, 2011 7:00 pm |
|
|
jean-damien
Site Admin
Joined: Thu Dec 02, 2010 2:31 pm Posts: 409 Location: France
|
Re: Bug in pDraw.class.php
I think that you are looking for the setPalette() function. JD.
|
Sat Aug 13, 2011 7:02 pm |
|
|
gladder
New pChart user
Joined: Sat Aug 13, 2011 6:03 pm Posts: 3
|
Re: Bug in pDraw.class.php
hum... Well, i should RTFM instead of reading the source code. setPalette() works fine though... But in my opinion, declaring manual RGB values should also overwrite the chart colors defined with setPalette - maybe this is a feature request Thanks for your reply! Bye
|
Tue Aug 16, 2011 7:05 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 9 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
|