<%@ LANGUAGE="VBScript" %> <% 'This page is invoked when the user clicks on a region on the employment distribution map 'contained in Detailed.asp. 'Here, we show detailed charts for the region. %> FusionMaps v3 - Database Example <% 'You need to include the following JS file to embed the chart using JavaScript 'Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer 'When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors. you would get JavaScript errors. %>
 
Employment Statistics
<< Click here to go back to Region Map
<< Or, click here to go back to US Map
<% 'strXML will be used to store the entire XML document generated dim strXML,sumdata,i 'We need to build three charts here. So, we use a loop to iterate through data 'and build XML on the fly. i=1 strQuery ="select * from fcmap_group_master" set rs1 = Server.CreateObject("ADODB.Recordset") rs1.open strQuery,oConn if rs1.bof = false then do while not rs1.eof 'Get the XML for the chart strXML = getChartEmpStatXML(rs1) response.Write "" i=i+1 rs1.movenext loop end if set rs=nothing set rs1=nothing oConn.close set oConn=nothing %>
" 'Create the chart - 2 Pie 3D Chart and 1 Column 3Dwith data from strXML if rs1("group_id")<>3 then response.Write renderChart("../../Charts/Pie3d.swf", "", strXML, "Chart_unemp" & i , 500, 350, false, false) else response.Write renderChart("../../Charts/column3d.swf", "", strXML, "Chart_emp" & i , 500, 350, false, false) end if response.Write "
<% 'getChartEmpStatXML method returns the XML data for the chart for a given subgroup. 'rs1 - Recordset containing details of the sub group Function getChartEmpStatXML(rs1) 'Variable to store XML data Dim strXML 'Local scope database accessors Dim rs, strQuery 'Based on which group we've been pass if (rs1("group_id")<>3) then strXML = "" else strXML = "" end if strQuery = "select a.Internal_Id,a.entity_id,b.group_name,c.subgroup_name,sum(a.data) as datap from fcmap_distribution a, fcmap_group_master b, fcmap_subgroup_master c where a.group_id=b.group_id and a.subgroup_id=c.subgroup_id group by a.Internal_Id,a.entity_id,b.group_name,c.subgroup_name having a.Internal_Id='" & request("Internal_Id") & "' and a.entity_id='" & request("entity_id") & "' and b.group_name='" & rs1("group_name") & "'" set rs = Server.CreateObject("ADODB.Recordset") rs.open strQuery,oConn 'Iterate through each group wise record if rs.bof = false then 'Fetch all Data records do while not rs.eof 'Generate strXML = strXML & "" rs.movenext loop end if 'Add style element for caption strXML = strXML & "