pChart 2.x forum
http://wiki.pchart.net/forum/

drawBarChart OverrideColors Problem
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=2532
Page 1 of 1

Author:  Starwhooper [ Thu Mar 22, 2012 1:26 pm ]
Post subject:  drawBarChart OverrideColors Problem

Hi,

i try to set own colors with OverrideColors in a Bar Chart.

Code without color setting:
Code:
<?php
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pData.class.php");
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pDraw.class.php");
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pImage.class.php");
$myData = new pData();
$myData->addPoints(array(2,8),"Serie1");
$myData->addPoints(array(4,6),"Serie2");
$myPicture = new pImage(70,30,$myData);
$myPicture->setGraphArea(5,5,65,25);
$myPicture->drawScale($Settings);
$myPicture->drawBarChart($Config);
$myPicture->stroke();
?>

Code with OverrideColors to set own colors:
Code:
<?php
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pData.class.php");
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pDraw.class.php");
include($_SERVER['DOCUMENT_ROOT']."/pchart/class/pImage.class.php");
$Palette[0] = array("R"=>0,"G"=>0,"B"=>255,"Alpha"=>100);
$Palette[1] = array("R"=>255,"G"=>0,"B"=>0,"Alpha"=>100);
$myData = new pData();
$myData->addPoints(array(2,8),"Serie1");
$myData->addPoints(array(4,6),"Serie2");
$myPicture = new pImage(70,30,$myData);
$myPicture->setGraphArea(5,5,65,25);
$myPicture->drawScale($Settings);
$Config = array("OverrideColors"=>$Palette);
$myPicture->drawBarChart($Config);
$myPicture->stroke();
?>


Results:
first code:
Image
second code (with OverrideColors):
Image

My problem is, how can i colorized in my second sample the 1st and 3rd column in blue and the 2nd and 4th in red ?

Regards, Thiemo

Author:  Starwhooper [ Wed Mar 28, 2012 10:25 am ]
Post subject:  Re: drawBarChart OverrideColors Problem

Has nobody any idea how can i fix it ? I try to solve this prob since few days.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/