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

Min value of the Y axis
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=29458
Page 1 of 1

Author:  fleurette [ Tue Jul 31, 2012 1:52 pm ]
Post subject:  Min value of the Y axis

Hi I'd like the minimal value of the Y axis of my graph to be zero, but even though I use the START0 option in
the draw scale
$myPicture->drawScale($Data,$DataDescription,SCALE_START0,0,0,0);
my scale still begins with the -10 value.
Can someone help me out?


Code:
<?php
/* Include all the classes */
include("../../pChart2.1.3/class/pDraw.class.php");
include("../../pChart2.1.3/class/pImage.class.php");
include("../../pChart2.1.3/class/pData.class.php");



$url = "http://www.theverge.com/2012/7/30/3201879/htc-closing-south-korean-office";

/* Create your dataset object */

$myData = new pData();




/* Add data in your dataset */
$myData->addPoints(array(0.1,1,2,3,3),"Facebook Count");
$myData->addPoints(array(0.1,45,50,3,1),"Google Count");
$myData->addPoints(array(0,1,12,30,10),"LinkedIn Count");
$myData->addPoints(array(0,12,45,4,2),"Twitter Count");
$myData->setAxisName(0,"Social Interactions");


/* Create a pChart object and associate your dataset */
$myPicture = new pImage(700,230,$myData);

/* Choose a nice font */
$myPicture->setFontProperties(array("FontName"=>"C:\\WINDOWS\\Fonts\\SIMKAI.TTF","FontSize"=>8));


/* Define the boundaries of the graph area */
$myPicture->setGraphArea(60,40,670,190);

/* Draw the background */
$Settings = array("R"=>100, "G"=>100, "B"=>100, "Dash"=>0, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,700,230,$Settings);

/* Draw the scale, keep everything automatic */
$myPicture->drawScale($Data,$DataDescription,SCALE_START0,0,0,0); 

/* Draw the scale, keep everything automatic */
$myPicture->drawSplineChart();
   
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));

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

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

/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>"C:\\WINDOWS\\Fonts\\SIMKAI.TTF","FontSize"=>10));
$myPicture->drawText(5,15,"Social interactions for article at url ",array("R"=>50,"G"=>0,"B"=>50));
$myPicture->drawText(15,30,$url,array("R"=>50,"G"=>0,"B"=>50));


/* Build the PNG file and send it to the web browser */
$myPicture->stroke();


?>

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