Sign in to follow this  
FusionCharts Support

help multiserie chart with php mysql

Recommended Posts

hi

i want to create a multiserie chart but this code is not true

in sigle serie the code is good but i want a multiserie

thanks for your help

?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='Intervention' subCaption='Par Mois'  xAxisName='' showBorder='1' formatNumberScale='0' showValues='1' numberSuffix=''  animation=' " . $animateChart . "'>";

  // Fetch all factory records

  $strQuery = "select * from delai_inter " ; 

  $result = mysql_query($strQuery) or die(mysql_error());

  //Iterate through each factory

if ($result) {

  while($ors = mysql_fetch_array($result)) {

  //Here, we convert date into a more readable form for set label.

  //$strXML .= "<set label='" . datePart("d",$ors['DatePro']) . "/" . datePart("m",$ors['DatePro']) . "' value='" . $ors['Quantity'] . "'/>";

$strXML .= "<set label='".  $ors['mois'] .  "'  value='" . $ors['4h'] ."'/>";

  $strXML .= "<set label='".  $ors['mois'] .  "' value='" . $ors['8h'] .  "'/>";

  $strXML .= "<set label='".  $ors['mois'] .  "' value='" . $ors['+8h'] .  "'/>";

 //$strXML .= "<set label='".  $ors['mois'] "'/>";

  // $strXML .= "<set value='".  $ors['8h']   "'/>";

// $strXML .= "<set value='".  $ors['+8h']   "'/>";-

 

  // $strXML .= "<set label= '" value='" . $ors['Quantity'] . "'/>";

 

 

  }

  }

  mysql_close($link);

 

  //Finally, close <chart> element

  $strXML .= "</chart>";

  //Create the chart - Pie 3D Chart with data from strXML

  echo renderChart("../../FusionCharts/mscolumn3D.swf", "", $strXML, "NewChart", 650, 300, false,false);

?>

<BR><BR>

</CENTER>

</BODY>

</HTML>

Share this post


Link to post
Share on other sites

Hi,

For multiseries charts you would need to build the XML which is different from XML structure of single series charts.

Where as single series charts has XML format like this:

<chart>

<set value='...' label='...'/>

  <set value='...' label='...'/>

  <set value='...' label='...'/>

</chart>

 

The XML structure of Multiseries chart is like this:

<chart>

  <categories>

  <category label='...'/>

  <category label='...'/>

  <category label='...'/>

 </categories>

  <dataset seriesName='...'>

  <set value='...' />

  <set value='...' />

  <set value='...' />

  </dataset>

 

  <dataset seriesName='...'>

  <set value='...' />

  <set value='...' />

  <set value='...' />

  </dataset>

</chart>

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
Sign in to follow this