Bu probleme nasıl yaklaşacağım konusunda gerçekten çok uğraşıyorum, bu yüzden daha deneyimli birinden biraz yardım almak için yeni bir soru açılmasını gerektireceğini düşündüm. Aşağıdaki örnekte üzerinde çalışıyorumSaf PHP'de Grafik Oluşturma
saf PHP çok basit bir grafik oluşturmak için http://code.web-max.ca/image_graph.php
Sorun
ben kodunda yaşıyorum sorunları yorumladı kodumu, ekliyorumçoğunlukla büyük harflerle.
sorun $maxv
değişken ben kopyalayıp editörüme sadece örnek yapıştırın ve çalıştırın ancak zaman ... sıfıra bir hata bölünme yol açar 0
ayarlandığında altında meydana gelir, bu yüzden orada olmalı çalışıyor benim kod olarak lutfen bir ekran yerde benim kodunda mantıksal bir sorun bağlama am edilecek ..... herhangi bir yardım çok
//create array retrieved from DB in code ABOVE and add "" and , to each value
foreach($t1Picks as $key => $nr){
$values[] = '"'.$nr.'"'.',';
}
echo '$values are fine'. implode($values);
echo '<br />';
//values are fine.....go ahead
// Get the total number of columns we are going to plot
$columns = count($values);
echo 'COLUMN COUNT IS FINE'.$columns;
echo '<br />';
//columns count is fine continue
// 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;
$column_width = round($column_width, 0);
echo 'COLUMN WIDTH IS FINE'.$column_width;
echo '<br />';
// Generate the image variables
$im = imagecreate($width,$height);
$gray = imagecolorallocate ($im,0xcc,0xcc,0xcc);
$gray_lite = imagecolorallocate ($im,0xee,0xee,0xee);
$gray_dark = imagecolorallocate ($im,0x7f,0x7f,0x7f);
$white = imagecolorallocate ($im,0xff,0xff,0xff);
// Fill in the background of the image
imagefilledrectangle($im,0,0,$width,$height,$white);
$maxv = 0; //I DONT UNDERSTAND THIS
//WHY MAX VAL 0?
// Calculate the maximum value we are going to plot
for($i=0;$i<$columns;$i++)$maxv = max($values[$i],$maxv); //WHY NO BRACE { ON FOR
echo 'MAXV TEST IS'.$maxv; //THE FIRST LOOP IS 9 AND THEN ZEROS
echo'<br />';
// Now plot each column
Teşekkür yo OF
takdir Okumak için çok fazla!
Çok teşekkür ederim, kontrol edeyim, sonra size geri döneceğim kısa bir süre sonra –
ps Sadece bölümün bir bölümünü ekledim, çünkü bölüm bölümden hata ayıklama bölümünden dolayı bölüm yok, örnek linke bakın. t mind –
GÜNCELLEŞTIRME: foreach döngüsünü değiştirdiğinden ve tavsiye edilen ilk $ $ $ değerinden itibaren yankılandığı için echo'ed şu anda doğru yönde bir adım olan 15 ve NOT 9… ancak yine de tüm sıfırlar –