<html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<head>
<title>TestMonitor</title>
<?php
//We've included ../Includes/FusionCharts.php and ../Includes/DBConn.php, which contains
//functions to help us easily embed the charts and connect to a database.
include("../monitor/Includes/FusionCharts.php");
include("../monitor/Includes/DBConn.php");
?>
</head>
<body>
<HTML>
<HEAD>
<TITLE>
</TITLE>
<?php
//You need to include the following JS file, if you intend to embed the chart using JavaScript.
//Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
//When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.
?>
<SCRIPT LANGUAGE="Javascript" SRC="../../monitor/FusionCharts/FusionCharts.js"></SCRIPT>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.text{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</HEAD>
<BODY>
<CENTER>
<h2>Monotor Output report</h2>
<h4>à¡ÃÕ¹ on any pie slice to see detailed data.</h4>
<!-- <p class='text'>, </p> -->
<?php
//In this example, we show how to connect FusionCharts to a database.
//For the sake of ease, we've used an MySQL databases containing two
//tables.
// Connect to the DB
$link = connectToDB();
//We also keep a flag to specify whether we've to animate the chart or not.
//If the user is viewing the detailed chart and comes back to this page, he shouldn't
//see the animation again.
$animateChart = $_GET['animate'];
//Set default value of 1
if ($animateChart=="")
$animateChart = "1";
//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "<chart caption='Monotor Output report' subCaption='By WD5000' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units' animation=' " . $animateChart . "'>";
// Fetch all factory records
// $strQuery = "select * from Factory_Master";
// $result = mysql_query($strQuery) or die(mysql_error());
$strQuery = "select distinct(type) as type_name , sum(amount) as count_amt from data1 group by type_name";
$result2 = mysql_query($strQuery) or die(mysql_error());
//Iterate through each factory
if ($result2) {
while($ors2 = mysql_fetch_array($result2)) {
$strXML .= "<set label='" . $ors2['type_name'] . "' value='" . $ors2['count_amt'] . "' />";
}
}
mysql_close($link);
//Finally, close <chart> element
$strXML .= "</chart>";
$fp = fopen("data.xml", "w");
fwrite($fp, $strXML);
fclose($fp);
//Create the chart - Pie 3D Chart with data from strXML
echo renderChart("../../monitor/FusionCharts/Column3D.swf", "", $strXML, "FactorySum", 800, 400, false, false);
?>
<BR><BR>
<!-- <a href='../NoChart.html' target="_blank">Unable to see the chart above?</a> -->
</CENTER>
</BODY>
</HTML>