PDA

View Full Version : مقاله: آموزش ساخت نمودار میله ای ساده با php



reza_alie
دوشنبه 10 فروردین 1394, 20:02 عصر
خدمت دوستان



<html>

<head>
<style type="text/css">
.bar {
background:#33F;
color: #fff;
height: 20px;
width: auto;
min-width: 2px;
clear: both;
margin-bottom: 5px;
padding: 5px;
font-weight: bold;
}
</style>
</head>
<body>
<?php

$vals = array(
'dell' => 12,
'asus' => 55,
'samsung' => 40,
'hp' => 1400,
'fujistu' => 20,
);


foreach ($vals as $key => $val) {
$test=floatval(($val/100));
echo $test;
echo'<br>';

echo('<div class="bar" style="width: '.$test.'px" title="'.$key.' = '.$test.'">'.$key."</div>");

}

?>
</body>
</html>

Pedram77
دوشنبه 10 فروردین 1394, 20:11 عصر
یه سایت پیدا کردم فقط برای انواع نمودار توی PHP :
PHP Chart (http://phpchart.org/examples/complete-phpchart-examples/)

reza_alie
دوشنبه 10 فروردین 1394, 20:16 عصر
البته یکسری همه توابع داره که میشه از اونا استفاده کرد