MichelBR

Members
  • Content count

    7
  • Joined

  • Last visited

About MichelBR

  • Rank
    Forum Newbie
  1. Multiseries Chart With Php Mysql

    my chart did not work! could anyone help us??
  2. Multiseries Chart With Php Mysql

    friend, I have a problem same as yours, if you managed to solve, please send me the answer, I need a lot. thanks!
  3. Chart Stackedcolumn3D

    Thanks for the reply! The problem is that I can not generate the XML. The graph shows that this is it. He's just showing a team, when the right teams and the third was to show he is not joining the months and totals. Can you help me?
  4. Chart Stackedcolumn3D

    Hi! People I'm more than two weeks trying to generate the graph StackedColumn3D, please help me! I have 3 teams and need to show the result of each team in the month, but he only does this monster of a team. takes a lot of help from you. the following code: <?php //We've included ../Includes/FusionCharts.php, which contains functions //to help us easily embed the charts. include("../Includes/FusionCharts.php"); ?> <HTML> <HEAD> <TITLE>FusionCharts - Array Example using Multi Series Column 3D Chart </TITLE> <script LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT> </HEAD> <BODY> <?php $servidor = "localhost"; $usuario = "root"; $senha = ""; $banco = "plantap"; $con = mysql_connect($servidor, $usuario, $senha); mysql_select_db ($banco); $busca=mysql_query("select distinct mes, equipe, count(*) as total from medicao group by mes, equipe "); while ($dados=mysql_fetch_array($busca)) { $time[$dados['equipe']][$dados['mes']]=$dados['total']; } //Initialize <chart> element $strXML = "<chart caption='Sales by Product' numberPrefix='' formatNumberScale='1' rotateValues='0' placeValuesInside='1' decimals='0' >"; //Initialize <categories> element - necessary to generate a multi-series chart $strCategories = "<categories>"; //Initiate <dataset> elements foreach($time as $equipe=>$meses){ $strDataCurr = "<dataset seriesName='" .$equipe. "'>"; } //Iterate through the data foreach($meses as $mes=>$total){ //Append <category name='...' /> to strCategories $strCategories .= "<category label='" . $mes . "' />"; //Add <set value='...' /> to both the datasets $strDataCurr .= "<set value='" . $total . "' />"; } //Close <categories> element $strCategories .= "</categories>"; //Close <dataset> elements $strDataCurr .= "</dataset>"; //Assemble the entire XML now $strXML .= $strCategories . $strDataCurr . "</chart>"; //Create the chart - MS Column 3D Chart with data contained in strXML echo renderChart("../../FusionCharts/StackedColumn3D.swf", "", $strXML, "productSales", 900, 400, false, true); ?> </HTML>
  5. Xml Mysql Php

    Angshu, thanks for the reply! below is the complete code. it even generates the graph, but he's messing up the values, the query is right, the problem buildDatasets this function, I can not see the error. that you will be able to help me? <?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 mes as mes from medicao order by equipe, mes asc"; // Query database $resultCategories = mysql_query($strQueryCategories) or die(mysql_error()); // SQL query for factory output data $strQueryData = "select distinct mes, equipe, count(idpedido) as total from medicao group by equipe, mes order by equipe, mes asc"; $resultData = mysql_query($strQueryData) or die(mysql_error()); $strXML = "<chart legendPostion='1' caption='Factory Output report' subCaption='By Quantity' xAxisName='Factory' yAxisName='Units' showValues='0' formatNumberScale='0' rotateValues='1' animation='1'>"; // Build category XML $strXML .= buildCategories ($resultCategories, "mes"); // Build datasets XML $strXML .= buildDatasets ( $resultData, "total", "equipe"); //Finally, close <chart> element $strXML .= "</chart>"; //Create the chart - Pie 3D Chart with data from strXML echo renderChart("../../FusionCharts/StackedColumn3D.swf", "", $strXML, "FactorySum", 1000, 550, false, true); // Free database resource mysql_free_result($resultCategories); mysql_free_result($resultData); mysql_close($con); /*********************************************************************************************** * Function to build XML for categories * @param $result Database resource * @param $labelField Field name as String that contains value for chart category labels * * @return categories XML node */ 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 to build XML for datesets that would contain chart data * @param $result Database resource. The data should come ordered by a control break field which would require to identify datasets and set its value to dataset's series name * @param $valueField Field name as String that contains value for chart dataplots * @param $controlBreak Field name as String that contains value for chart dataplots * * @return Dataset XML node */ 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; } ?>
  6. Xml Mysql Php

    Good day! I'm new to forum and I need a help! I'm not able to create an XML to SQL below: I have to generate a graph Stackedcolumn3D Model. Please help me! $strQueryCategories = "select distinct mes as mes from medicao order by equipe, mes asc"; // Query database $resultCategories = mysql_query($strQueryCategories) or die(mysql_error()); // SQL query for factory output data $strQueryData = "select distinct mes, equipe, count(idpedido) as total from medicao group by equipe, mes order by equipe, mes asc"; $resultData = mysql_query($strQueryData) or die(mysql_error());
  7. 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; } ?>