Hi below is my yes or no BAR,
For bar i have three image..
image_left is left side curve image, image_center is the center square image image right is right side curve image,
This below is my php function , am just increasing the center square image width , no other extra stuff i did for bar graph
function recommend_chart_yes_no($chartData,$img_path_is=NULL){
global $tableSize;
$span_no_left;
global $span_no_right;
$img_path = $img_path_is."chart/style";
$maxValue = 0;
// First get the max value from the array
foreach ($chartData as $item) {
if ($item['value'] > $maxValue) $maxValue = $item['value'];
}
// Now set the theoretical maximum value depending on the maxValue
$maxBar = 1;
while ($maxBar < $maxValue) $maxBar = $maxBar * 10;
// Calculate 1px value as the table is 300px
$pxValue = ceil($maxBar/$tableSize);
// Now display the table with bars
echo "<table width='150' border='0' cellspacing='0' cellpadding='0'>";
foreach ($chartData as $item) {
$width = ceil($item['value']/$pxValue);
if($item['title']=="Yes"){
echo "<tr><td width='24'><span class='feed-survey-yes-txt'>".$item['title']."</td>";
echo "<td width='100' height='25' class='feed-survey-percentage-bg'><div class='feed-survey-percent-container'> <span class='feed-survey-percent-green-left'></span> <span class='feed-survey-percent-green-center' style='width:".$width."px;'></span> <span class='feed-survey-percent-green-right'></span> </div></td>";
echo "<td width='21' align='left' class='feed-survey-percentage-txt'>".$item['value'].'%</td></tr>';
}else{
echo "<tr><td width='24'><span class='feed-survey-no-txt'>".$item['title']."</td>";
echo "<td width='100' height='25' class='feed-survey-percentage-bg'><div class='feed-survey-percent-container'> <span class='feed-survey-percent-red-left'></span> <span class='feed-survey-percent-red-center' style='width:".$width."px;'></span> <span class='feed-survey-percent-red-right'></span> </div></td>";
echo "<td width='21' align='left' class='feed-survey-percentage-txt'>".$item['value'].'%</td></tr>';
}
}
echo '</table>';
}
recommend_chart_yes_no($chartData,$img_path_is=NULL)
$chartData is the array , passing the width size for YEs and No Bar
My problem is ,
if YES reached the 79% means the bar showed in the graph somthing like 98%, This is wrong...So How to show the grpah correctly,
Please guide..
