JPgraph question or other example for line chart in php

i wanna a example which can show different element agianst time  in a pine chart ,
do u all have any example?

the data is from the table in MySQL
table element1
table element2 etc
Who is Participating?
agamalConnect With a Mentor Commented:
try this

           header("Content-type: image/jpeg");
        // read the data from table and put it in array
        $data = array('3400','2570','245','473','1000','3456','780');
        $sum = array_sum($data);
        $height = 255;
        $width = 320;
        $im = imagecreate($width,$height); // width , height px
        $white = imagecolorallocate($im,255,255,255);
        $black = imagecolorallocate($im,0,0,0);
        $red = imagecolorallocate($im,255,0,0);
        imageline($im, 10, 5, 10, 230, $black);
        imageline($im, 10, 230, 300, 230, $black);
        $x = 15;
        $y = 230;
        $x_width = 20;
        $y_ht = 0;
        for ($i=0;$i<7;$i++){
//          $y_ht = ($data[$i]/$sum)* $height;
              imagestring( $im,2,$x-1,$y+10,$data[$i],$black);
          $x += ($x_width+20);

Open in new window

Loganathan NatarajanLAMP DeveloperCommented:
ftpphptest1Author Commented:
i know there is a lot~~~but i want to have some sample code for reference to use the free chart provider
Loganathan NatarajanLAMP DeveloperCommented:
Please download the JPGraph and see the lot of examples in it. You can easily convert them as mYSQL based.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.