<?
global $vis_language;
$chart_area = "#channel_report";
 
?>
<div class="col-sm-12 portlet">
	<div class="panel-body">		
		<div id="channel_report" style="height:300px">
		</div>
	</div>      
</div>
 
 
<? 
 $a=10;
  $temp1 = $temp2 =$temp3 = $temp4 = $temp5 ="";
 $totalticket1 = $openticket1 =$closeticket1 =$otherticket1 =$xaxisLabel1 =array();
 $totalticket = $openticket =$closeticket =$otherticket =$xaxisLabel =array();
 $totalc=count($report);
  for($i=0;$i<$totalc;$i++)
  {
  $temp1 = $temp2 =$temp3 = $temp4 = $temp5 = array();
  $temp1[]=$temp2[]=$temp3[]=$temp4[]=$temp5[]=$a;
  $temp1[]=$report[$i]['department_name'];
  $temp2[]=$report[$i]['total'];
  $temp3[]=$report[$i]['openicket'];
 	$temp4[]=$report[$i]['closeticket'];
  $temp5[]=$report[$i]['waitticket'];
  $xaxisLabel1[]=$temp1;
  $totalticket1[]=$temp2;
  $openticket1[]=$temp3;
  $closeticket1[]=$temp4;
  $otherticket1[]=$temp5;   

$a=$a+10;
  }

		$xaxisLabel=json_encode($xaxisLabel1);
		$totalticket=json_encode($totalticket1);
		$openticket=json_encode($openticket1);
	  	$closeticket=json_encode($closeticket1); 
		$otherticket=json_encode($otherticket1);
   

  ?> <script>
		var domain = $('.domain_id option:selected').text();$('.otherSelected').val(domain);
		var durationID = $('#duration option:selected').val(); if(durationID == 4){var custom = $('#vis_graphical_domain_report_from_date').val()+ " to " +$('#vis_graphical_domain_report_to_date').val(); $('.durationSelected').val(custom);}else{var duration = $('#duration option:selected').text();$('.durationSelected').val(duration);}
		</script>
  
    <?
echo "<script>display_bar_chart('".$chart_area."',".str_replace('"','',$totalticket).",".str_replace('"','',$openticket).",".str_replace('"','',$closeticket).",".str_replace('"','',$otherticket).",$xaxisLabel);</script>";
 ?> 
 
 <script>
 
function display_bar_chart(chartArea,totalticket,openticket,closeticket,otherticket,xaxisLabel)
{     
var DomainData = [
{label: "Total Ticket", data: totalticket, bars:{show: true,fill: true,lineWidth: 1,order: 1,fillColor: { colors: [{ opacity: 0.5 }, { opacity: 0.9}] }},color: "#CCCCCC"},
{label: "Open Ticket", data: openticket, bars:{show: true,fill: true,lineWidth: 1,order: 2,fillColor: { colors: [{ opacity: 0.5 }, { opacity: 0.9}] }},color: "#FFFF00 "},
{label: "Close Ticket", data:closeticket, bars:{show: true,fill: true,lineWidth: 1,order: 3,fillColor: { colors: [{ opacity: 0.5 }, { opacity: 0.9}] }},color: "#D2B48C"},
{label: "Other Ticket", data: otherticket, bars:{show: true,fill: true,lineWidth: 1,order: 4,fillColor: { colors: [{ opacity: 0.5 }, { opacity: 0.9}] }},color: "#ADFF2F"}
 ];
  $(chartArea).length && $.plot($(chartArea), DomainData, {
  
 xaxis: {ticks:xaxisLabel}, yaxis: {},
   
 grid: {
 hoverable: false,
 clickable: false,
 borderWidth: 0
 },
 legend: {
 labelBoxBorderColor: "none",
 position: "left"
 },
 series: {
 shadowSize: 1
 },
 tooltip: false,
 });
 $('#pdfDiv').show();
} 
      


</script>
 <input class="durationSelected" type="hidden">
<input class="otherSelected" type="hidden">

 
