MichelBR

I Need A Help - Stackedcolumn3D Model

Recommended Posts

Srs. good afternoon

I need a help on fusionchart tool - StackedColumn3D model.

I'm trying make a chart using this fields:

 

month, team, order

 

The problem I have found is the order value by each team is not appear in the correct month.

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">
<html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<?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("../Includes/FusionCharts.php");
     ?>
     <HTML>
        <HEAD>
       <TITLE>FusionCharts - Database Example</TITLE>
       <script LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
    </HEAD>
    <BODY>
    <CENTER>



<?php

$servidor = "localhost";
$usuario = "root";
$senha = "";
$banco = "plantap";


$con = mysql_connect($servidor, $usuario, $senha);
mysql_select_db ($banco);



 $strQueryCategories = " select distinct month as mes from medicao order by month ";       

 $resultCategories = mysql_query($strQueryCategories) or die(mysql_error());

 $strQueryData = " SELECT team, month, count(order) as total FROM medicao GROUP BY team, month 
ORDER BY team, month ";  



 $resultData = mysql_query($strQueryData) or die(mysql_error());



 $strXML = "<chart legendPostion='' caption='Factory Output report' subCaption='By Quantity' xAxisName='Factory' yAxisName='Units' showValues='0' formatNumberScale='0' rotateValues='1' animation='1' bgSWF='ChartBg.jpg' canvasBgAlpha='30' canvasBorderColor='333333' canvasBorderThickness='0' divLineColor='333333' >";

$strXML .= buildCategories ($resultCategories, "mes" );

$strXML .= buildDatasets ( $resultData, "total", "team");




 $strXML .= "</chart>";


echo renderChart("../../FusionCharts/StackedColumn3D.swf", "", $strXML, "FactorySum", 700, 400, false, true);



 mysql_close($con);


function buildCategories ( $result, $labelField )
{
 $strXML = "";
 if ($result) {
   $strXML = "<categories>";
   while($ors = mysql_fetch_array($result)) {
     $strXML .= "<category label='" . $ors[$labelField]. "'/>";
   }
   $strXML .= "</categories>";
 }
 return $strXML;
}



function buildDatasets ($result, $valueField, $controlBreak )
{
 $strXML = "";
 if ($result) {
   $controlBreakValue ="";
   while( $ors = mysql_fetch_array($result) ) {
     if( $controlBreakValue != $ors[$controlBreak] ) 
     {
       $controlBreakValue =  $ors[$controlBreak];
       $strXML .= ( $strXML =="" ? "" : "</dataset>") . ( "<dataset seriesName='" . $controlBreakValue . "'>" ) ;
     }
     $strXML .= "<set value='" . $ors[$valueField] . "'/>";
   }
   $strXML .= "</dataset>";
 }
 return $strXML;
}
?>


 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now