View unanswered posts | View active topics It is currently Wed May 08, 2024 5:04 pm



Reply to topic  [ 3 posts ] 
Few questions about radar charts 
Author Message
New pChart user
New pChart user

Joined: Wed Jan 19, 2011 2:06 pm
Posts: 2
Post Few questions about radar charts
Hi all, I discovered today this amazing library and it's perfect for a project I'm working on. I'm using a radar chart with 5 labels and I managed to create the graph in few minutes but now I can't find certain features in the documentation. I have 3 questions:
1 - I would like to set a certain range(max-min) for each label since I am comparing values in a 1-10 scale with number up to 100 and the chart get deformed if the range is always given from the highest value.

2 - Is there a way to set the polygon color? I tried differen configuration but couldn't find one to set it

3 - Is there a way not to show each notch value? The only text I want on my chart area are labels

Thanks

This is an example of my code if needed
Code:
<?php

/* pChart library inclusions */
include("extra_lib/pChart/class/pData.class");
include("extra_lib/pChart/class/pDraw.class");
include("extra_lib/pChart/class/pRadar.class");
include("extra_lib/pChart/class/pImage.class");

/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(5,130,5,7,29),"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");

/* Define the absissa serie */
$MyData->addPoints(array("LABEL1","LABEL2","LABEL3","LABEL4","LABEL5"),"Labels");
$MyData->setAbscissa("Labels");

/* Create the pChart object */
$width=300;
$height=200;

$myPicture = new pImage($width,$height,$MyData);

/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>"extra_lib/pChart/fonts/verdana.ttf","FontSize"=>6,"R"=>80,"G"=>80,"B"=>80));

/* Create the pRadar object */
$SplitChart = new pRadar();

/* Draw a radar chart */
$myPicture->setGraphArea(0,0,$width,$height);
$Options['LabelPos'] = RADAR_LABELS_HORIZONTAL;
$Options['Layout'] = RADAR_LAYOUT_STAR;
$Options['PointRadius']=0;
$Options['AxisR']=0;
$Options['AxisG']=122;
$Options['AxisB']=9;
$Options['LabelPadding']=1;
$Options['AxisRotation'] = -17;
$Options['DrawPoly']= TRUE;
$Options['PolyAlpha'] = 50;
$Options['FontSize'] = 6;
$SplitChart->drawRadar($myPicture,$MyData,$Options);

/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.radar.png");
?>


Wed Jan 19, 2011 2:29 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Few questions about radar charts
Hi Michelle,

I'm not sure to catch what you mean in point #1. If you fix the scale to 0-10 and draw values that are going over this range, the chart will be completely deformed. If you add the following configuration :

Code:
$Options['SegmentHeight'] = 2;
$Options['Segments'] = 5;

The chart will go from 0 to 10 with 5 segments that have an height of 2 (0 -> 2x5)

The polygon color is determined by the serie color, if you have only one serie then you have only one color ;o)

To remove the notch value try :

Code:
$Options['DrawAxisValues'] = FALSE;
$Options['AxisBoxRounded'] = FALSE;

seems there is a bug here that I'll correct in the next version : DrawAxisValues should be enougth.

JD.


Wed Jan 19, 2011 3:29 pm
Profile WWW
New pChart user
New pChart user

Joined: Wed Jan 19, 2011 2:06 pm
Posts: 2
Post Re: Few questions about radar charts
Thanks for the answer, your solution for point #3 worked and I managed to change the serie color so #2 is solved as well.

For point #1, I found a solution simply normalizing values and using the segment feature. Thank you very much for your work!


Wed Jan 19, 2011 6:25 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

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