View unanswered posts | View active topics It is currently Fri May 10, 2024 9:38 pm



Reply to topic  [ 1 post ] 
Y display problems? 
Author Message
New pChart user
New pChart user

Joined: Fri Apr 29, 2011 7:32 am
Posts: 1
 Y display problems?
Dear ladies and gentlemen
How to realize the y axis in reverse chronological order shown?
Thank you very much!


Code:
<?php
/* CAT:Line chart */

/* pChart library inclusions */
include("pchart/class/pData.class.php");
include("pchart/class/pDraw.class.php");
include("pchart/class/pImage.class.php");

/* Create and populate the pData object */
$MyData = new pData();
$google=array(3,12,15,8,5,100);
$yahoo=array(1,7,5,18,19,1);


$MyData->addPoints($google,"Google");
//$MyData->reverseSerie("Google");
$MyData->addPoints($yahoo,"Yahoo");
//$MyData->setSerieTicks("Google",1);
$MyData->setSerieWeight("Google",1);
//$MyData->setSerieTicks("Yahoo",1);
$MyData->setSerieWeight("Yahoo",1);
$MyData->setAxisName(0,"#Rank");

$MyData->addPoints(array("Jan","Feb","Mar","Apr","May","Jun"),"Labels");

$MyData->setSerieDescription("Labels","Months");
$MyData->setAbscissa("Labels");





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

/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;

/* Add a border to the picture */
$myPicture->drawRectangle(0,0,550,229,array("R"=>0,"G"=>0,"B"=>0));

/* Write the chart title */
//$myPicture->setFontProperties(array("FontName"=>"pchart/fonts/verdana.ttf","FontSize"=>8));
//$myPicture->drawText(60,35,"keyword",array("FontSize"=>14,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));

/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>"pchart/fonts/verdana.ttf","FontSize"=>8));

/* Define the chart area */
$myPicture->setGraphArea(60,40,530,200);

/* Draw the scale */
$AxisBoundaries = array(0=>array("Min"=>1,"Max"=>100));
$scaleSettings = array("Mode"=>SCALE_MODE_MANUAL,"ManualScale"=>$AxisBoundaries,"XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
//$scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
$myPicture->drawScale($scaleSettings);

/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;

/* Draw the line chart */
$myPicture->drawLineChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO));

/* Write the chart legend */
$myPicture->drawLegend(425,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));

$myPicture->Render("test.png");

/* Render the picture (choose the best way) */
$myPicture->autoOutput("pchart/examples/pictures/example.drawLineChart.simple.png");




?>


Fri Apr 29, 2011 7:36 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

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