'; //print_r($rot); //echo '';m $w=mysql_query("select p.id,p.product_category_id from ecmproducts as p inner join ecmproductcategories as c on c.id=p.product_category_id where p.deleted='0' order by c.name asc"); while($r=mysql_fetch_array($w)){ $qty=0; $ww=mysql_query("select quantity,price from ecmstockstates where deleted='0' and product_id='".$r['id']."'"); while($rrr=mysql_fetch_array($ww)){ $qty+=$rrr['quantity']*$rrr['price']; } $cats[$r['product_category_id']]+=$qty; if($cats[$r['product_category_id']]>$temp)$temp=$cats[$r['product_category_id']]; } //$arr_s=multisort($arr_s,array(array('key'=>'value','sort'=>'desc'))); $i=0; foreach($cats as $k=>$v){ $r=mysql_fetch_array(mysql_query("select name from ecmproductcategories where id='".$k."' and deleted='0'")); if($r['name']){ $data_1[$i]=$v; if($v)$data_2[$i]=$rot[$k]; else $data_2[$i]=0; $cn[$i]=repl($r['name']); $i++; } } $g = new graph(); //$g->title( 'Stocks', '{font-size:20px; color: #000000; margin: 5px; background-color: #ffffff; padding:5px; padding-left: 20px; padding-right: 20px;}' ); $g->bg_colour = '#ffffff'; $d1 = new bar( 75, '#D54C78' ); $d2 = new bar( 75, '#3334AD' ); $d1->key( 'Inventory valueee', 10 ); $d2->key( 'Rotation', 10 ); for($i=0;$iadd_data_tip($data_1[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2)); //$d2->add_data_tip($data_2[$i],"Value: ".$data_1[$i]."\nRotation: ".round($data_2[$i],2)); } $g->data_sets[]=$d1; //$g->data_sets[]=$d2; $g->set_tool_tip( '#x_label#
#tip#
' ); $g->attach_to_y_right_axis(2); $g->x_axis_colour( '#909090', '#ADB5C7' ); $g->y_axis_colour( '#909090', '#ADB5C7' ); $g->y_right_axis_colour( '#909090' ); $g->set_x_labels( $cn ); $g->set_x_label_style( 10, '#000000', 2 ); $g->set_y_max( $temp ); $g->set_y_right_max( $tempr); $g->y_label_steps( 20 ); //$g->y_right_label_steps( 5 ); $g->set_y_legend( 'Inventory value', 12, '#D54C78' ); $g->set_y_right_legend( 'Rotation' ,12 , '#3334AD' ); echo $g->render(); mysql_close($sql); ?>