View unanswered posts | View active topics It is currently Fri Jun 21, 2024 3:29 pm

Reply to topic  [ 1 post ] 
Bug in pBubble::drawBubbleChart & pData::setPalette (v2.1.3) 
Author Message
New pChart user
New pChart user

Joined: Fri Jul 13, 2012 2:11 pm
Posts: 1
Post Bug in pBubble::drawBubbleChart & pData::setPalette (v2.1.3)

i think i've found a bug in above-named functions.
My issue was to create a bubble chart with several series.


1 serie for the abscissa + 8 mentioned series
In this case i'll get an error:
E_NOTICE [8] Undefined offset:  8 in line 102 of file /htdocs/develop3/pub/berichtsplugins/pChart_v2/class/pBubble.class.php

Around line 102, the pBubble::resetSeriesColors() method is defined. resetSeriesColors will be called from drawBubbleChart() method.
resetSeriesColors calls at the beginning
$Palette = $this->pDataObject->getPalette();

and gets an array with 8 items (defined in pData class) (containing rgb code + alpha).

var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),

In the following lines the method runs through all declared series and overwrites whose rgb codes:
$this->pDataObject->Data["Series"][$SerieName]["Color"]["R"] = $Palette[$ID]["R"];

For the ninth series, the loop will access on $Palette[8]["R"] which will throw above-mentioned error.

To add a new color via:
$this->DataSet->setPalette(array(8=>"Probe8"), array("R"=>220,"G"=>220,"B"=>220,"Alpha"=>50));

will not solve the problem, because the palette of the pData class will never be extended, because of following lines (pData::setPalette):
/* Do reverse processing on the internal palette array */
foreach ($this->Palette as $Key => $Value) {
      if ($Value["R"] == $OldR && $Value["G"] == $OldG && $Value["B"] == $OldB) {
              $this->Palette[$Key]["R"] = $R; $this->Palette[$Key]["G"] = $G; $this->Palette[$Key]["B"] = $B; $this->Palette[$Key]["Alpha"] = $Alpha;

Quick'n'dirty fix would be to remove

in line 135 (pBubble::drawBubbleChart)

Sry for "german" english.

Best regards.

Fri Jul 13, 2012 3:06 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to: