Hi, Php generates line with 0,0 coordinate from top-left. Is there any easy way to draw line with 0,0 from bottom-left. You know that we generally draw graph 0,0 from bottom-left. i know that i can think of multiplying or dividing etc. for replacing this. But you guys how you work with this problem when you drawing grahp using line ??
thanks for your reply. but i did not understand where you are trying to direct me. Can you please tell me what i can do in my graph code? May be then i can get it. <?php header("content-type:image/png"); $x1=$_POST[x1]; $x2=$_POST[x2]; $x3=$_POST[x3]; $x4=$_POST[x4]; $x5=$_POST[x5]; $y1=$_POST[y1]; $y2=$_POST[y2]; $y3=$_POST[y3]; $y4=$_POST[y4]; $y5=$_POST[y5]; $im = @imagecreate(500,500) or die("Can not Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255,255,0); $white=imagecolorallocate($im, 255,255,255); $black=imagecolorallocate($im, 0,0,0); imageline($im,$x1,$y1,$x2,$y2,$black); imageline($im,$x2,$y2,$x3,$y3,$black); imageline($im,$x3,$y3,$x4,$y4,$black); imageline($im,$x4,$y4,$x5,$y5,$black); imageline($im,$x5,$y5,500,500,$black); imagepng($im); ?> PHP:
yeah. all graphs are generally made with low to high value by drawing bottom to top. when i place values (because it's easy) at co-ordinates in line function it really generates graph but it's upside down (low at top and high at bottom). i want to set low at bottom and high at top is real life graph we use in our daily life.
I do not think you are able to change the reference coordinates (0,0) from the default corner. The way I see it, you have 2 options: You change all your $y coordinates to $height-$y You create your image and before saving it you flip is vertically. Use imagecopyresized for this.