|
|
Page 1 of 1
|
[ 3 posts ] |
|
Help on Scattered chart with threshold
Author |
Message |
doufu
New pChart user
Joined: Fri Feb 24, 2012 9:12 pm Posts: 3
|
Help on Scattered chart with threshold
When I was trying to add threshold to a scattered spline chart, the threshold lines won't show up and got error like this: "Undefined index: Orientation in /home/user/www/pchart/class/pDraw.class.php on line 2933 " Code: <?php //xdebug_disable(); //error_reporting(0); /* Library settings */ define("CLASS_PATH", "./pchart/class"); define("FONT_PATH", "./pchart/fonts"); /* pChart library inclusions */ include(CLASS_PATH."/pData.class.php"); include(CLASS_PATH."/pDraw.class.php"); include(CLASS_PATH."/pImage.class.php"); include(CLASS_PATH."/pScatter.class.php");
/* get data from a data base. omitted */ $result=$rs[0][1]; /* Create the pData object */ $myData = new pData(); $myData->setAxisName(0,"Monthly Deposit"); $myData->setAxisXY(0,AXIS_X); $myData->setAxisPosition(0,AXIS_POSITION_BOTTOM); $miny=1; $maxy=100; /* Create the Y axis and the binded series */ for ($i=$miny;$i<=$maxy;$i=$i+1) { if ($i > $maxy ) $value = VOID; elseif ($i <$miny ) $value = VOID; else $value = $i; $myData->addPoints($value,"Percentages"); } $myData->setSerieOnAxis("Percentages",1); $myData->setAxisName(1,"Percentages"); $myData->setAxisXY(1,AXIS_Y); $myData->setAxisUnit(1,"$"); $myData->setAxisPosition(1,AXIS_POSITION_LEFT); for ($i=0;$i<=4;$i=$i+1) { /* Create the 1st scatter chart binding */ $myData->setScatterSerie($result[$i][0],"Percentages",$i); $myData->setScatterSerieDescription($i,$result[$i][0]); $myData->setScatterSerieColor($i, array("R"=>100+$i*100,"G"=>50+$i*30,"B"=>$i*10+100)); }
/* Create the pChart object */ $myPicture = new pImage(900,400,$myData);
/* Turn of Antialiasing */ $myPicture->Antialias = FALSE;
/* Retrieve the image map */ if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) $myPicture->dumpImageMap("ImageMapScatterSplineChart",IMAGE_MAP_STORAGE_FILE,"ScatterSplineChart","tmp");
/* Set the image map name */ $myPicture->initialiseImageMap("ImageMapScatterSplineChart",IMAGE_MAP_STORAGE_FILE,"ScatterSplineChart","tmp");
/* Draw the background */ $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107); $myPicture->drawFilledRectangle(0,0,900,400,$Settings);
/* Overlay with a gradient */ $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50); $myPicture->drawGradientArea(0,0,900,400,DIRECTION_VERTICAL,$Settings);
/* Add a border to the picture */ $myPicture->drawRectangle(0,0,899,399,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */ $myPicture->setFontProperties(array("FontName"=>FONT_PATH."/pf_arma_five.ttf","FontSize"=>8)); /* Set the graph area */ $myPicture->setGraphArea(50,30,850,330);
/* Create the Scatter chart object */ $myScatter = new pScatter($myPicture,$myData);
/* Draw the scale */ $myScatter->drawScatterScale();
/* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); /* Draw two thresholds */ $myPicture->drawThreshold(50,array("AxisID"=>1,"Alpha"=>70,"Ticks"=>1)); $myPicture->drawThreshold(75,array("AxisID"=>1,"Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255)); /* Turn of Antialiasing */ $myPicture->Antialias = TRUE; /* Draw a scatter plot chart */ $myScatter->drawScatterSplineChart(array("RecordImageMap"=>TRUE)); $myScatter->drawScatterPlotChart();
/* Draw the legend */ $myScatter->drawScatterLegend(160,375,array("Mode"=>LEGEND_HORIZONTAL,"Style"=>LEGEND_NOBORDER));
/* Render the picture (choose the best way) */ $myPicture->autoOutput("ScatterSplineChart.png");
I tried to add AXIS_X , Y or 0, 1 as AxisID to the Threshold but still no line shows.
|
Fri Feb 24, 2012 9:23 pm |
|
|
doufu
New pChart user
Joined: Fri Feb 24, 2012 9:12 pm Posts: 3
|
Re: Help on Scattered chart with threshold
I know it's probably simpler just adding two lines but something native would be nice
|
Fri Feb 24, 2012 9:33 pm |
|
|
shd93
pChart user
Joined: Sun May 19, 2013 10:40 pm Posts: 4
|
Re: Help on Scattered chart with threshold
For any one else who also finds this thread when searching for the following errors when trying to draw a threshold: Code: PHP Notice: Undefined index: Orientation in /var/www/default/mm/woto/pchart/class/pDraw.class.php on line 2903 PHP Notice: Undefined index: Orientation in /var/www/default/mm/woto/pchart/class/pDraw.class.php on line 2933 The answer? Make sure you are drawing your scale BEFORE you try and draw the threshold! And, this wouldn't have fixed it here either as doufu was drawing a scatter graph, they needed to use http://wiki.pchart.net/doc.scatter.drawscatterthreshold.html instead.
|
Thu Jul 18, 2013 11:06 am |
|
|
|
Page 1 of 1
|
[ 3 posts ] |
|
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
|
|
|