Hi everyone,
Please look at these two pages first :
http://ixedix.x10hosting.com/MathRec/ (fourth problem)
http://ixedix.x10hosting.com/MathRec/plotit.htm
What I want to do on the second page is to plot the
function (time versus landing point) with default values,
and allow the visitor to try different W, L, VW, VL.
After clicking "Plot it", he should get the same page
with the new plot. That's the part that doesn't work
right now (
Do I need session functions to do that, or is there
a simpler way ?
Here is mrfishplot.php :
Thanks for any help you can provide.
Please look at these two pages first :
http://ixedix.x10hosting.com/MathRec/ (fourth problem)
http://ixedix.x10hosting.com/MathRec/plotit.htm
What I want to do on the second page is to plot the
function (time versus landing point) with default values,
and allow the visitor to try different W, L, VW, VL.
After clicking "Plot it", he should get the same page
with the new plot. That's the part that doesn't work
right now (
Do I need session functions to do that, or is there
a simpler way ?
Here is mrfishplot.php :
Code:
<?php
//Include the plotting code
require_once '/home/rocambol/librairies/phplot.php';
$W = 0 + $_REQUEST['W'];
$VW = 0 + $_REQUEST['VW'];
$L = 0 + $_REQUEST['L'];
$VL = 0 + $_REQUEST['VL'];
$data = array();
for($x = 0; $x <= $L; $x+=20)
{
$t = sqrt(pow($W, 2) + pow($x, 2)) / $VW + ($L - $x) / $VL;
$data[] = array('', $x, $t);
}
//Define the plot object
$plot = new PHPlot(700, 425);
$plot->SetBackgroundColor(array(64,64,128));
$plot->SetDataColors('yellow');
$plot->SetTitleColor('white');
$plot->SetTextColor('white');
$plot->SetTickColor('white');
$plot->SetPlotType('lines');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
//$plot->SetPlotAreaWorld(0, 1000, $L, 1200);
$plot->SetXDataLabelPos('none');
$plot->SetXTickIncrement(400);
$plot->SetXLabelType('data');
$plot->SetPrecisionX(0);
$plot->SetDrawXGrid(True);
$plot->SetYTickIncrement(100);
$plot->SetYLabelType('data');
$plot->SetPrecisionY(0);
$plot->SetDrawYGrid(True);
$plot->SetGridColor('white'); // Misnamed, sets the axis color..
$plot->SetUseTTF(TRUE);
$plot->SetFont('generic', 'COURBD.TTF', 14);
$plot->SetFont('title', 'TIMESBD.TTF', 24);
$plot->SetFont('x_label', 'COURBD.TTF', 10);
$plot->SetFont('y_label', 'COURBD.TTF', 10);
$plot->SetFont('x_title', 'COURBD.TTF', 14);
$plot->SetFont('y_title', 'COURBD.TTF', 14);
$plot->SetTitle("The hungry fisherman");
$plot->SetXTitle("Landing point x (meters)");
$plot->SetYTitle("time (seconds)");
//Draw it
$plot->SetPrintImage(FALSE); //We will add to it in a moment...
$plot->SetFileFormat('jpg');
$plot->DrawGraph();
$img = $plot->img;
$palegreen=imagecolorallocate($img,120,255,120);
$fontfile = '/home/rocambol/public_html/images/VERDANA.TTF';
imagettftext($img,18,0,300,100,$palegreen,$fontfile,
"W = $W m VW = $VW m/s");
imagettftext($img,18,0,300,140,$palegreen,$fontfile,
"L = $L m VL = $VL m/s");
//Now send it
$plot->PrintImage();
?>
Thanks for any help you can provide.