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

Radar Charts
http://wiki.pchart.net/forum/viewtopic.php?f=5&t=147
Page 1 of 1

Author:  yoh [ Tue Jan 25, 2011 3:58 pm ]
Post subject:  Radar Charts

Hi again :D

I noticed another minor bug on radar charts, and it's visible in my first post too ^^
The color of the axis changes :

Image

In the bottom-right corner (in fact on the part with the labels), the color is darker than on the rest of the chart.

I don't know if it's on purpose or not ^^

Here is a code for a radar chart :
Code:
$etiquettes = array('1','2','3','4');
// $etiquettes2 = array('1','2','3','4','5');

$valeurs = array('Serie 1', array(1,2,1,2));
// $valeurs2 = array('Serie 1', array(1,2,1,2,1));

$titre = 'Titre';

$MyData = new pData();

$MyData->addPoints($valeurs[1],"Serie1");
$MyData->setSerieDescription("Serie1",$valeurs[0]);
// $MyData->addPoints($valeurs2[1],"Serie1");
// $MyData->setSerieDescription("Serie1",$valeurs2[0]);

/* Définition des noms de branches */
$MyData->addPoints($etiquettes,"Labels");
// $MyData->addPoints($etiquettes2,"Labels");
$MyData->setAbscissa("Labels");

/* Création de l'objet pChart */
$myPicture = new pImage(400,350,$MyData);
$RectangleSettings = array("R"=>180,"G"=>180,"B"=>180,"Alpha"=>100);

/* Titre du graph */
$myPicture->setFontProperties(array("FontName"=>"./pChart2/fonts/verdana.ttf","FontSize"=>10));
$myPicture->drawText(195,20,$titre,array("R"=>100,"G"=>100,"B"=>100,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
$myPicture->drawRoundedRectangle(5,5,395,40,5,array("R"=>100,"G"=>100,"B"=>100));

/* Définition de la police par défaut */
$myPicture->setFontProperties(array("FontName"=>"./pChart2/fonts/verdana.ttf","FontSize"=>9,"R"=>80,"G"=>80,"B"=>80));

/* Création de l'objet pRadar */
$SplitChart = new pRadar();

/* Dessin du graph radar */
$myPicture->setGraphArea(10,50,390,310);
$Options = array("SegmentHeight"=>1,"Segments"=>5,"DrawPoly"=>true,"DrawPoints"=>false,"Layout"=>RADAR_LAYOUT_STAR,"LabelsBGR"=>240,"LabelsBGG"=>240,"LabelsBGB"=>240,"LabelPos"=>RADAR_LABELS_HORIZONTAL,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>235,"EndG"=>235,"EndB"=>235,"EndAlpha"=>20));
$SplitChart->drawRadar($myPicture,$MyData,$Options);

/* Sortie du graph (fichier) */
$myPicture->Render('radar.png');

If you have a solution... Again :D

Thanks ! :D

Author:  jean-damien [ Tue Jan 25, 2011 4:59 pm ]
Post subject:  Re: Radar Charts

You're right, there is an issue here ;o) The patch is included below. --this is added to the 2.1.0 that will be published today or tomorrow.

Line 200 of the pRadar.class file :

Replace :
Code:
         for($i=0;$i<=360;$i=$i+(360/$Points))

by
Code:
         for($i=0;$i<360;$i=$i+(360/$Points))


Line 259 of the pRadar.class file :

Replace :
Code:
     for($i=0;$i<=360;$i=$i+(360/$Points))

by
Code:
     for($i=0;$i<360;$i=$i+(360/$Points))

Author:  yoh [ Wed Jan 26, 2011 9:20 am ]
Post subject:  Re: Radar Charts

Thanks a lot ! :)

Author:  jean-damien [ Wed Jan 26, 2011 3:00 pm ]
Post subject:  Re: Radar Charts

This has been fixed in the 2.1.0 that you can get from here : download.

Kind regards,
JD.

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