View unanswered posts | View active topics It is currently Thu Mar 28, 2024 1:07 pm



Reply to topic  [ 1 post ] 
Label overlap with chart, dynamic label height 
Author Message
New pChart user
New pChart user

Joined: Mon Nov 28, 2011 4:13 am
Posts: 1
Post Label overlap with chart, dynamic label height
Hello,

I was using pChart v1 for a long time. I found there is also v2 available recently, so I'm trying to switch to this new version, but i have some problems with chart rendering.

1. Labels are overlaping with chart, when they're rotated in 45 angle. I was looking for parameter like margin (either chart bottom or label top) to move labels little down, but unsuccessfull. Is there

2. Is there a way, how to dynamically resize label (or chart) area? I'm using names as labels and sometimes the name is longer and doesn't fit in the chart. I can make pImage larger, but then it looks strange when there is a lot of space at the bottom (in case of shorter names).

Here's example:
Image

Code:
<?php
include("class/pData.class.php");
include("class/pDraw.class.php");
include("class/pImage.class.php");

$myData = new pData();
$myData->addPoints(array(80,44,41,38,61,20,25,16),"Serie1");
$myData->setSerieDescription("Serie1","Serie 1");
$myData->setSerieOnAxis("Serie1",0);

$myData->addPoints(array("Nysam, Dandra","Hat-yerond, Logedi","Lorad, Dranal","Zodar, Chagha","Nail, Anuach","Tradckrod, Ustvoro","Entur, Attano","Ackehon, Therlny Ranrak Danelt"),"Absissa");
$myData->setAbscissa("Absissa");

$myData->setAxisPosition(0,AXIS_POSITION_LEFT);
$myData->setAxisName(0,"Productivity");
$myData->setAxisUnit(0,"");

$myPicture = new pImage(700,300,$myData);
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,700,300,$Settings);

$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,700,300,DIRECTION_VERTICAL,$Settings);

$myPicture->drawRectangle(0,0,699,299,array("R"=>0,"G"=>0,"B"=>0));

$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>20));

$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50,50,675,220);
$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/Bedizen.ttf","FontSize"=>8));

$Settings = array("Pos"=>SCALE_POS_LEFTRIGHT
, "Mode"=>SCALE_MODE_FLOATING
, "LabelingMethod"=>LABELING_ALL
, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0, "TickG"=>0, "TickB"=>0, "TickAlpha"=>50, "LabelRotation"=>45, "CycleBackground"=>1, "DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255, "SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50, "DrawYLines"=>ALL);
$myPicture->drawScale($Settings);

$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>10));

$Config = array("DisplayValues"=>1, "Gradient"=>1, "AroundZero"=>1);
$myPicture->drawBarChart($Config);

$Config = array("R"=>0, "G"=>0, "B"=>0, "Alpha"=>50, "AxisID"=>0, "Ticks"=>4, "WriteCaption"=>1, "Caption"=>"Average", "DrawBox"=>1);
$myPicture->drawThreshold(40,$Config);

$myPicture->stroke();
?>


Thank you in advance for all advices!


Mon Nov 28, 2011 4:23 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

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