SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    blank webpage - displaying graphs using sql server

    Dear all,

    I am currently and learning and implementing a asp graphs webpage. I have problem, where the output is blank screen on the webpage. I have tried many possibilities to resolve this issue but I can not seem to find a solution.

    Code:
       <BODY>
    
       <%   
       'In this example, we show how to connect FusionCharts to a database.
       'For the sake of ease, we've used an Access database which is present in
       '../DB/FactoryDB.mdb. It just contains two tables, which are linked to each
       'other. 
    
       'Database Objects - Initialization
       Dim oRs, oRs2, strQuery
       'strXML will be used to store the entire XML document generated
       Dim strXML
    
       'Create the recordset to retrieve data
        Set oRs = Server.CreateObject("ADODB.Recordset")
    
       'Generate the chart element
        strXML = "<graph caption='Factory Output report' subCaption='By Quantity'         decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>"
    
     'Iterate through each factory
      strQuery = "select * from deal_price"
      Set oRs = oConnection.Execute(strQuery)
    
      While Not oRs.Eof
      'Now create second recordset to get details for this factory
      Set oRs2 = Server.CreateObject("ADODB.Recordset")
      strQuery = "select sum(price) as TotOutput from deal_price where deal_id=" &  ors("deal_id")
      Set oRs2 = oConnection.Execute(strQuery) 
      'Generate <set name='..' value='..'/> 
      strXML = strXML & "<set name='" & ors("name") & "' value='" & ors2("TotOutput") & "' />"
    
    
     'Close recordset
      Set oRs2 = Nothing
      oRs.MoveNext
    Wend
    
    
    
    
     'Finally, close <chart> element
      strXML = strXML & "</chart>"
    Response.Buffer=true
    
      response.write strXML
    response.flush
    response.end 
      Set oRs = nothing
    
    'Create the chart - Pie 3D Chart with data from strXML
     Call renderChart("MyWeb/includes/FCF_Pie2D.swf", "", strXML, "FactorySum", 650, 450)
    %>
    </BODY>
    I have also dipslayed my DDL statements, which show the table I am using, for further reference.

    Code:
    SELECT [deal_id]
          ,[name]
          ,[cusip]
          ,[isin]
          ,[size]
          ,[orig_price]
          ,[price]
          ,[cmbs_spread]
          ,[cmbs_price]
          ,[price_type]
          ,[deal_type]
          ,[date]
      FROM [dbo].[deal_price]
    GO


    Any help would be very much appreciated. Thank you for your time and help.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do a view source of the page, do you see any xml diplayed ?

    You have a response.end before the renderchart call, comment it and try again

  3. #3
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for suggestion and help. There is data in the xml but I still can not get the chart to display on the webpage.

    I am trying to display line graph which shows prices at given dates. I have sql server table which has the following fields:

    Code:
    LECT [deal_id]
          ,[name]
          ,[cusip]
          ,[isin]
          ,[orig_price]
          ,[price]
          ,[size]
          ,[price_type]
          ,[date]
      FROM [dbo].[deal_price2]
    GO
    Code:
    <%   
       'In this example, we show how to connect FusionCharts to a database.
       'For the sake of ease, we've used an Access database which is present in
       '../DB/FactoryDB.mdb. It just contains two tables, which are linked to each
       'other. 
    
       'Database Objects - Initialization
       Dim oRs, oRs2, strQuery
       'strXML will be used to store the entire XML document generated
       Dim strXML
    
       'Create the recordset to retrieve data
        Set oRs = Server.CreateObject("ADODB.Recordset")
    	
       'Generate the chart element
        strXML = strXML = "<graph caption='Deals Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1'  numberSuffix=' Units'  pieSliceDepth='30' formatNumberScale='0'>"
    	
     'Iterate through each factory
      strQuery = "select * from deal_price2"
      Set oRs = oConnection.Execute(strQuery)
    
      While Not oRs.Eof
    
      'Now create second recordset to get details for this factory
      Set oRs2 = Server.CreateObject("ADODB.Recordset")
      strQuery = "select sum(price) as TotOutput from deal_price where deal_id=" &  ors("deal_id")
      Set oRs2 = oConnection.Execute(strQuery) 
      'Generate <set name='..' value='..'/> 
      strXML = strXML & "<set name='" & ors("date") & "' value='" & ors2("TotOutput") & "' />"
    	
     'Close recordset
      Set oRs2 = Nothing
      oRs.MoveNext
    Wend
    
     'Finally, close <chart> element
      strXML = strXML & "</chart>"
    Response.Buffer=true
    response.write strXML
    response.flush
    'response.end 
      Set oRs = nothing
    
    'Create the chart - Line Chart with data from strXML
     Call renderChart("MyWeb/includes/FCF_Line.swf", "", strXML, "FactorySum", 650, 450)
    %>
    the xml data looks like the following below:
    Code:
    BODY>
     
       False<set name='2012-09-28' value='75' /><set name='2012-09-29' value='97' /><set name='2012-09-30' value='60' /><set name='2012-10-01' value='67' /><set name='2012-10-02' value='50' /><set name='2012-10-03' value='70' /><set name='2012-10-04' value='52' /><set name='2012-10-05' value='81' /><set name='2012-10-06' value='72' /><set name='2012-10-07' value='93.5' /><set name='2012-10-08' value='101.35' /><set name='2012-10-09' value='99' /><set name='2012-10-10' value='63.5' /><set name='2012-10-11' value='88' /><set name='2012-10-12'
    As output I am getting a the word 'charts' and 'false' on the screen. There is data in the xml tags but the chart is not picking it up for some reason.

    Thank you for your time and help. I really appreciate your help and response.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This Line:

    Code:
    'Generate the chart element
        strXML = strXML = "<graph caption='Deals Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1'  numberSuffix=' Units'  pieSliceDepth='30' formatNumberScale='0'>"
    is, as you can see, wrong, and that line is adding the "false." to your strXML.

    correct it to:

    Code:
    'Generate the chart element
    strXML = "<graph caption='Deals Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1'  numberSuffix=' Units'  pieSliceDepth='30' formatNumberScale='0'>"

    have not used graphs myself, but i think that should fix it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •