Show jason data in chart
-
im want to create a dynamic chart. The main problem is that the picture is not displayed.
The Code should just show the Background of the chart. Later i will add some more code to show the values.I would be very happy about help. If someone has a ready-made code for a line diagram that would be perfect.
Greetings from a beginner from Germany.
`
<?php
header(“Content-type: image/png”);
$imgWidth = ‘200’;
$imgHeight = ‘100’;
$theImage = imagecreate($imgWidth, $imgHeight);
$colorWhite = imagecolorallocate($theImage, 255, 255, 255); #Hintergrund
$colorGrey = imagecolorallocate($theImage, 210, 210, 210);imageline($theImage, 0, 0, $imgWidth, 0, $colorGrey); #oben
imageline($theImage, $imgWidth-1, 0, $imgWidth-1, $imgHeight-1, $colorGrey); #rechts
imageline($theImage, 0, $imgHeight-1, $imgWidth, $imgHeight-1, $colorGrey); #unten
imageline($theImage, 0, 0, 0, $imgHeight, $colorGrey); #links$pxRaster = ’20’; #Größe des Rasters
$pxWidth = round($imgWidth / $pxRaster, 0);
for($i=1; $i<$pxWidth; $i++){
imageline($theImage, $i*$pxRaster, 0, $i*$pxRaster, $imgHeight, $colorGrey); #vertikal
imageline($theImage, 0, $i*$pxRaster, $imgWidth, $i*$pxRaster, $colorGrey); #horizontal
}
//Ausgabe
imagepng($theImage); #ausgeben des Bildes als PNG
//imagedestroy($theImage); #freigeben und zerstören des Bildes
?><?php
echo ‘Unser Raster-Bild<br />
‘;
?>
The topic ‘Show jason data in chart’ is closed to new replies.