Home > Article > Backend Development > PHP function for making line graph_PHP tutorial
PHP function for making line graphs
Keywords: PHP
/*
Function description
$data: y-axis data (array)
$graphdata: y-axis data --Percentage (array)
$label: x-axis data (array)
$height: image height
$width: image width
$font: font size
$dot: decision point size
$bg: background color
$line: line color
$text: text color
$dotcolor: dot color
$file: output image file name
*/
function qximage($data ,
$graphdata,
$label ,
$height,
$width ,
$font,
$dot,
$ bg,
$line,
$text,
$dotcolor,
$file)
{
$jc=$height/100;
$fontwidth= imagefontwidth ($ font);
$fontheight=imagefontheight($font);
$image= imagecreate ($width,$height+20);
$bg= imagecolorallocate($image ,$bg[0 ],$bg[1],$bg[2]);
$line=imagecolorallocate($image ,$line[0],$line[1],$line[2]);
$text =imagecolorallocate($image ,$text[0],$text[1],$text[2]);
$dotcolor=imagecolorallocate($image ,$dotcolor[0],$dotcolor[1],$$ dotcolor[2]);
imageline ($image,0,0,0,$height,$line);
imageline($image,0,$height,$width,$height,$line);