For some reason the graphs I built for my website many years ago no longer work in Chrome. They work when viewed on their own... they work even when embedded in the website (for a few seconds), then they disappear?? Seem to work fine in IE.
The graphs are on this page.... at the bottom....
http://finestfootball.co.uk/predictionleague/wycombewanderers
Here is the code from one of the graphs... any ideas??
to embed them on the page I use the following code..
The graphs are on this page.... at the bottom....
http://finestfootball.co.uk/predictionleague/wycombewanderers
Here is the code from one of the graphs... any ideas??
PHP:
<?php
// This array of values is just here for the example.
$wins = $_GET['wins'];
$draws = $_GET['draws'];
$losses = $_GET['losses'];
$values = array($wins, $draws, $losses);
// Get the total number of columns we are going to plot
$columns = count($values);
// Get the height and width of the final image
$width = 300;
$height = 200;
// Set the amount of space between each column
$padding = 5;
// Get the width of 1 column
$column_width = $width / $columns ;
// Generate the image variables
$im = imagecreate($width,$height);
$gray = imagecolorallocate ($im,75,166,221);
$gray_lite = imagecolorallocate ($im,0xee,0xee,0xee);
$gray_dark = imagecolorallocate ($im,10,37,66);
$white = imagecolorallocate ($im,0xff,0xff,0xff);
// Fill in the background of the image
imagefilledrectangle($im,0,0,$width,$height,$white);
$maxv = 0;
// Calculate the maximum value we are going to plot
for($i=0;$i<$columns;$i++)$maxv = max($values[$i],$maxv);
// Now plot each column
for($i=0;$i<$columns;$i++)
{
$column_height = ($height / 100) * (( $values[$i] / $maxv) *100);
$x1 = $i*$column_width;
$y1 = $height-$column_height;
$x2 = (($i+1)*$column_width)-$padding;
$y2 = $height;
imagefilledrectangle($im,$x1,$y1,$x2,$y2,$gray);
// This part is just for 3D effect
imageline($im,$x1,$y1,$x1,$y2,$gray_dark);
imageline($im,$x1,$y2,$x2,$y2,$gray_dark);
imageline($im,$x2,$y1,$x2,$y2,$gray_dark);
imageline($im,$x2,$y1,$x1,$y1,$gray_dark);
}
imageline($im,0, 199, 400, 199,$gray_dark);
imagettftext($im, 18, 90, 50, 190, $gray_dark, "arial.ttf", "Wins " . $wins);
imagettftext($im, 18, 90, 150, 190, $gray_dark, "arial.ttf", "Draws " . $draws);
imagettftext($im, 18, 90, 250, 190, $gray_dark, "arial.ttf", "Losses " . $losses);
// Send the PNG header information. Replace for JPEG or GIF or whatever
header ("Content-type: image/png");
imagepng($im);
?>
to embed them on the page I use the following code..
PHP:
$total = $wins + $draws + $losses;
$winspercentage = number_format($wins / $total * 100, 1 );
$drawspercentage = number_format($draws / $total * 100, 1 );
$lossespercentage = number_format($losses / $total * 100, 1 );
echo "<br /><img src=\"graph.php?wins=$wins&losses=$losses&draws=$draws\" /><br />";