MichelBR

Chart Stackedcolumn3D

Recommended Posts

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>



 

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Thanks for your post.

 

It seems from your code that there might be an issue with the foreach loop.

 

Could you please send us the generated XML and a screenshot of the chart you are getting?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for your post.

 

It seems from your code that there might be an issue with the foreach loop.

 

Could you please send us the generated XML and a screenshot of the chart you are getting?

 

Awaiting for your response.

 

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?

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

You are actually generating the XML using the code:

 

//Initialize <chart> element<div>       	$strXML = "<chart caption='Sales by Product' numberPrefix='' formatNumberScale='1' rotateValues='0' placeValuesInside='1' decimals='0' >";</div>

 

..............................................

 

//Close <categories> element</div><div>       	$strCategories .= "</categories>";</div><div>       	//Close <dataset> elements</div><div>       	$strDataCurr .= "</dataset>";</div><div>       	//Assemble the entire XML now</div><div>       	$strXML .= $strCategories . $strDataCurr . "</chart>";

 

The generated XML is stored in $strXML variable.

 

You can generate the XML code in your browser using from view-source option.

 

Hope this helps.smile.gif

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