SQL - PHP Multi-Series Chart.
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



SQL - PHP Multi-Series Chart. Expand / Collapse
Author
Message
Posted 5/3/2008 5:07:55 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 5/4/2008 7:23:18 AM
Posts: 1, Visits: 12
Hi, I was able to create a chart using a single series but spent nights trying to create a multi-series chart with no good result. If anyone can help me with this it would be of great help.

Here are my tables.

2 SQL tables:

Engineers & Disks

ENGINEERS
- eng_id
- first_name
- last_name

DISKS
- job_no
- model_no
- status (value of either Complete of Fail)

What I would like to do is create a query that would display total number of Engineer's Complete and Fail job.
probably would look like this: (I only edited the image so you'll understand what i want).




If its gonna help I also have posted the code for single series chart.

<

require_once ('./mysql_connect.php'); // Connect to the db.

//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = "";

//Fetch all factory records
$strQuery = "select * from engineers";
$result = mysql_query($strQuery) or die(mysql_error());


//Iterate through each engr

if ($result) {
while($ors = mysql_fetch_array($result)) {
//Now create a second query to get details for this engr
$strQuery = "SELECT COUNT(disk_id) AS TotOutput FROM disks WHERE eng_id=" . $ors['eng_id'];
$result2 = mysql_query($strQuery) or die(mysql_error());
$ors2 = mysql_fetch_array($result2);
//Generate
$strXML .= "";
//free the resultset
mysql_free_result($result2);
}
}
mysql_close(); // Close the database connection.

//Finally, close element
$strXML .= "
";

//Create the chart - Pie 3D Chart with data from $strXML
echo renderChart("./charts/Column3D.swf", "", $strXML, "FactorySum", 650, 400, false, false);



Many Thanks foryour help.
Post #6081
Posted 6/15/2008 7:45:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/23/2008 8:50:48 AM
Posts: 4, Visits: 11
What kind of problem do you exactly have with your MS chart? Can you post the code for it here? Or have you tried turning DebugMode on to see what your xml would look like...If you are getting all the data from the database (which i think is the hardest part :-)) then the rest should be ok...unless you mess up xml formatting which the debugger will tell you about
Post #6855
Posted 6/21/2008 1:10:26 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 8:30:13 AM
Posts: 92, Visits: 711
Hi,
For Multi-series charts the XML structure is a bit different from single series XML. Hence, would you need to design the process of fetching data from database as per the XML structure. Could you please refer to the MS XML structure from :
http://fusioncharts.com/docs/Contents/MultiSeries.html.
 
Please also refer to the code that we provide below which might suit you needs. Please note that since we do not know what value might be there in status field you might need to modify the code as per the value in it.


Thanks,
Arindam

FusionCharts Team
www.fusioncharts.com


  Post Attachments 
MS_Test.php.txt (3 views, 2.23 KB)
Data.xml.txt (2 views, 368 bytes)

Post #6980
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 9:20pm


Execution: 0.094.