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



Reply to topic  [ 3 posts ] 
Label angle in drawLineChart 
Author Message
New pChart user
New pChart user

Joined: Mon Jun 20, 2011 2:24 pm
Posts: 2
Post Label angle in drawLineChart
Hi, I'm new here

Im working with a linechart and I have rotate the name of the axis values, actually are no values, are names, and some names are very
long, maybe if is possible change the angle will be great.

here is the code and the var $nombres contains the names that I want to ratote 45 or 90 degree
Code:
include("pChart/class/pData.class");
include("pChart/class/pDraw.class");
include("pChart/class/pRadar.class");
include("pChart/class/pImage.class");

$MyData = new pData();
$MyData->addPoints($puntos, "serie1"); // dibuja la linea de la marca
$MyData->setSerieDescription("serie1", $nombre1);
$MyData->setSerieWeight("serie1", 1);

if ($tipo != "empresa") {
   $MyData->addPoints($puntos2, "serie2");
   $MyData->setSerieDescription("serie2", $nombre2);   
    $MyData->setSerieWeight("serie2", 1);
}

/* Define the absissa serie */
$MyData->addPoints($nombres, "Dimensiones");      <------------------------------ this is the array of names
$MyData->setAbscissa("Dimensiones");

/* Create the pChart object */
$myPicture = new pImage(850, 330, $MyData);

/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../../fonts/calibri.ttf", "FontSize" => 9));

/* Draw the scale and the 1st chart */
$myPicture->setGraphArea(60, 50, 600, 250);

$myPicture->drawScale(array("DrawSubTicks" => TRUE));
$myPicture->setFontProperties(array("FontName" => "../../fonts/calibri.ttf", "FontSize" => 11));
$myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));

/* Write the chart legend */
$myPicture->drawLegend(610, 205, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));

$name_1 = $_s->getId() . "_graficoLineas.png";

$myPicture->Stroke();


please help

ty


Mon Jun 20, 2011 2:37 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Label angle in drawLineChart
Hi,

You can use the LabelRotation parameter of the drawScale() function to specify the angle of the rotation you want to apply :

Code:
$myPicture->drawScale(array("LabelRotation"=>45,"DrawSubTicks" => TRUE));


BTW, you can remove the pRadar class inclusion as you're not calling any member function from this script.

Kind regards,
JD.


Mon Jun 20, 2011 3:14 pm
Profile WWW
New pChart user
New pChart user

Joined: Mon Jun 20, 2011 2:24 pm
Posts: 2
Post Re: Label angle in drawLineChart
:mrgreen: :mrgreen: :mrgreen:

ty ty so much


Mon Jun 20, 2011 3:22 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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