Click on any pie slice to open linked chart
<%
'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.
Dim result, oRs2, strQuery
Dim strXML
'Create the recordset to retrieve data
Set result = Server.CreateObject("ADODB.Recordset")
'strXML will be used to store the entire XML document generated
'Generate the chart element
strXML = "
"
' Fetch all factory records
strQuery = "select fm.FactoryId, fm.FactoryName, sum(fo.Quantity) as TotOutput from Factory_Output fo, Factory_Master fm where fm.FactoryId=fo.FactoryId group by fm.FactoryId, fm.FactoryName"
Set result = oConn.Execute(strQuery)
' Iterate through each factory
If Not result Is Nothing Then
While Not result.Eof
'Generate
'Note that we're setting link as newchart-xmlurl-url
'This link denotes that linked chart would open
'The source data for each each is defined in the URL which will get data dynamically from the database as per the fctory id
strXML = strXML & ""
result.MoveNext
Wend
End If
'Finally, close element
strXML = strXML & ""
'Create the chart - Pie 3D Chart with data from strXML
Call renderChart("../../FusionCharts/Pie3D.swf", "", strXML, "FactorySum", 500, 250, false, true)
%>
Click on a pie slice above to see the linked chart appear here |
Or, right click on any pie to enable slicing or rotation mode.