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

Label angle in drawLineChart
http://wiki.pchart.net/forum/viewtopic.php?f=3&t=1572
Page 1 of 1

Author:  azhagthott [ Mon Jun 20, 2011 2:37 pm ]
Post subject:  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

Author:  jean-damien [ Mon Jun 20, 2011 3:14 pm ]
Post subject:  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.

Author:  azhagthott [ Mon Jun 20, 2011 3:22 pm ]
Post subject:  Re: Label angle in drawLineChart

:mrgreen: :mrgreen: :mrgreen:

ty ty so much

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