<?php

ob_start();
error_reporting(0);
include("connect.php");
session_start(); 
$dataPoints = array( 
	array("y" => 3373.64, "label" => "Germany" ),
	array("y" => 2435.94, "label" => "France" ),
	array("y" => 1842.55, "label" => "China" ),
	array("y" => 1828.55, "label" => "Russia" ),
	array("y" => 1039.99, "label" => "Switzerland" ),
	array("y" => 765.215, "label" => "Japan" ),
	array("y" => 612.453, "label" => "Netherlands" )
);
/* $ver = $_SESSION["admin_id"];
$admin_id = $_SESSION["admin_id"];
$dis_id = $_SESSION["manager_id"];
$user_type = $_SESSION["user_type"];
$user_session = $_SESSION["user_session"];

$id1 = base64_decode($_GET['id']);

date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d");
	
	$dataPoints = array();
//Best practice is to create a separate file for handling connection to database
try{
	
    $handle = $link->prepare("select * from tbl_insurance_company where admin_id='$admin_id"); 
    $handle->execute(); 
    $result = $handle->fetchAll(\PDO::FETCH_OBJ);
		
    foreach($result as $row){
        array_push($dataPoints, array("x"=> $row->x, "y"=> $row->y));
    }
	
}
catch(\PDOException $ex){
    print($ex->getMessage());
}
	 */
	
	
	/* $admin_id = $_POST['admin_id'];
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d");
	$ctime = date('h:i:sa');
	$select_product = mysqli_query($con,"select * from tbl_insurance_company where admin_id='$admin_id'");
	if(mysqli_num_rows($select_product)>0)
	{     
		$ftd_deatil=array();
		while($fetch_product=mysqli_fetch_assoc($select_product))
		{
			$ftd_deatil['company_id']=$fetch_product['company_id'];
			$ftd_deatil['company_name']=$fetch_product['company_name'];
			$comp_id=$fetch_product['company_id'];
			$actual_amt=0;
			$select_detail = mysqli_query($con,"select sum(tbl_customer_premium.premium_amt) as final_net_amt from tbl_customer,tbl_customer_premium,tbl_policy_master where tbl_customer.customer_id=tbl_policy_master.customer_id and tbl_customer_premium.customer_id=tbl_customer.customer_id and tbl_customer_premium.policy_no=tbl_policy_master.policy_no and tbl_policy_master.company_id='$comp_id' and tbl_customer_premium.status='Complete' and tbl_customer_premium.complete_date='$cdate' group by tbl_policy_master.company_id");
			while($fetch_data=mysqli_fetch_assoc($select_detail))
			{
				$actual_amt=$fetch_data['final_net_amt'];
			}
			$ftd_deatil['total_amt']=$actual_amt;
			$response['ftd_detail'][]=$ftd_deatil;
		} */
	
	
?>
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
 
var chart = new CanvasJS.Chart("chartContainer", {
	animationEnabled: true,
	theme: "light2",
	title:{
		text: "Gold Reserves"
	},
	axisY: {
		title: "Gold Reserves (in tonnes)"
	},
	data: [{
		type: "column",
		yValueFormatString: "#,##0.## tonnes",
		dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
	}]
});
chart.render();
 
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</body>
</html>   