<BODY> <CENTER> <h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts Free</a> Examples</h2> <h4>Simple Column 3D Chart</h4> <p> </p> <?php //This page demonstrates the ease of generating charts using FusionCharts PHPClass. //For this chart, we've cread a chart object used FusionCharts PHP Class //supply chart data and configurations to it and render chart using the instance //Here, we've kept this example very simple. # Create column 3d chart object $FC = new FusionCharts("Column3D", "600", "300"); # Set Relative Path of swf file. $FC->setSwfPath("../../FusionCharts/"); # Store Chart attributes in a variable $strParam = "caption=Monthly Unit Sales;xAxisName=Month;yAxisName=Units;decimalPrecision=0; formatNumberScale=0"; # Set Chart attributes $FC->setChartParams($strParam); #add chart data values and category names $FC->addChartData("462", "name=Jan"); $FC->addChartData("857", "name=Feb"); $FC->addChartData("671", "name=Mar"); $FC->addChartData("494", "name=Apr"); $FC->addChartData("761", "name=May"); $FC->addChartData("960", "name=Jun"); $FC->addChartData("629", "name=Jul"); $FC->addChartData("622", "name=Aug"); $FC->addChartData("376", "name=Sep"); $FC->addChartData("494", "name=Oct");
$basic = 0; $count = "01"; while ($count < $total + 1) { $arrData[$basic][0] = $count; $arrData[$basic][1] = $visitors[$count]; $count++; $basic++; if ($count < 10) { $count = "0" . $count; } } $FC = new FusionCharts("Column3D", "800", "300"); /* set Relative Path of chart swf file. */ $FC->setSwfPath("../" . MODS_DIRECTORY . "/charts/"); /* store chart attributes in a variable. */ $strParam = "caption={$month} " . _("Statistics") . ";formatNumberScale=0;decimalPrecision=0"; /* set chart attributes. */ $FC->setChartParams($strParam); $FC->addChartDataFromArray($arrData); /* displaying the traffic chart by fetching the data directly from the analytics server. */ echo "<div>" . $FC->renderChart() . "</div>"; } else { echo "<div class=\"alert alert-error\"><strong>" . _("Settings not configured.") . "</strong><br/>" . _("It seems that your Google analytics settings are not configured properly. Please configure them properly.") . "</div>"; } } else { echo "<div class=\"alert alert-error\"><strong>" . _("Unauthorized Access.") . "</strong><br/>" . _("You are not authorized to access this page.") . "</div>"; } } else { echo "<meta http-equiv=\"refresh\" content=\"0;url={$website}/" . USER_DIRECTORY . "/login\" />";
<?php /** * Created by PhpStorm. * User: Allan Wiz * Date: 4/17/15 * Time: 4:48 PM */ include '../classes/aardb_conn.php'; include '../charts/JSClass/FusionCharts_Gen.php'; global $session, $database; global $conn; $FC = new FusionCharts("FC_Line.swf", "900", "450"); $FC->setDataBaseType("Oracle"); $FC->setSwfPath("../Charts/"); $strParam = "caption=INTEREST VIEW REPORT (for the last 14 days);subCaption=BY APPLICABLE DATE ; showNames='1';pieSliceDepth=30;showBorder=1;numberSuffix= %; formatNumberScale='0'; xAxisName=Date; pYAxisName=Net Asset Value;sYAxisName=BalancedFund"; $FC->setChartParams($strParam); $start = date("d/M/Y", strtotime('-50 days')); $today = date("d/M/Y"); $sql = "SELECT I_RATES.RATE_ID, I_RATES.RATE_DATE AS DATEY, I_RATES.RATE AS RATE, SECURITIES.DESCRIPT AS DESCRIPTION FROM I_RATES INNER JOIN\r SECURITIES ON I_RATES.SECURITY_CODE = SECURITIES.SECURITY_CODE WHERE I_RATES.CONFIRMD = 1 AND I_RATES.RATE_DATE BETWEEN '{$start}' AND '{$today}' ORDER BY I_RATES.RATE_DATE"; $result = oci_parse($conn, $sql) or die(""); oci_execute($result); if ($result) { //$FC->addCategoryFromDatabase($result,"DESCRIPTION"); $FC->addDataFromDatabase($result, "RATE", "DATEY"); } print $FC->getXML();
$strQuery = "select sum(clicks) as TotOutput from kw_log where timestamp BETWEEN {$i} AND {$end}"; $result2 = mysql_query($strQuery) or die(mysql_error()); $ors2 = mysql_fetch_array($result2); $FC->addChartData($ors2['TotOutput'], "name=" . date("d/m/y", $i)); mysql_free_result($result2); } mysql_close($dbh); $FC->renderChart(); } // end if type is clicks if ($type == "rep") { $categories = array("Revenue", "Expense"); $revenue = array(); $expense = array(); $FC = new FusionCharts("MSColumn3D", "800", "400"); $FC->setSwfPath("graphs/FusionCharts/"); $strParam = "caption=Revenue/Expense/Profit;xAxisName=Date/Time;yAxisName=\$;decimalPrecision=2; formatNumberScale=\$0.00; rotateNames=1"; $FC->setChartParams($strParam); for ($i = $start_time; $i <= $end_time; $i += 86400) { $FC->addCategory(date("d/m/Y", $i)); } foreach ($categories as $cat) { $FC->addDataset($cat); if ($cat == "Revenue") { $field_name = "revenue"; } elseif ($cat == "Expense") { $field_name = "cost"; } $dbh = mysql_connect($db_location, $username, $password); // or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db($database);