index | search | no replies | posting guidelines | help login | register
Index » Products » ASP Report Wizard v2
search this forum:
:: Graph properties ::    show all messagesPost a New Message | Post a Reply
Oct 28 2005, 7:30 AM
 Re: Graph propertiesPost a Reply
 whichman

View this author's profile Send this author a private message Visit author's homepage

from: Laurel, MD

<%
  
'declare variables
  Dim objGraph
  Dim i, aData
  
aData = GetData("SELECT TOP 10 ProductName, UnitPrice FROM Products")
  
' Create an instance of SimpleGraph
  Set objGraph = Server.CreateObject("AspWebSolution.SimpleGraph")  
  
  With objGraph  
  
    'Add some data  
     For i=0  To  UBound(aData, 2)
           Call .AddRowData(aData(0, i), aData(1, i))
     Next
        
    'Add some variables
    .XScaleValues = "Products"
    .xALign = "center"
    .yLabel = "Price"
    .Title = "Most Expensive Products"
        
    'You can chage the colors if you want
    '.Colors = "green,  red,  yellow,  blue,  orange,  fuchsia"
  End  With  
  
'Draw your graph
objGraph.Draw  
  
  Set objGraph =  Nothing  
  
  Function GetData(strSQL)
      Dim objConn, objRS, strConn
      
     strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE= "
     strConn = strConn & "C:\Program Files\Microsoft Visual Studio\VB98\nwind.mdb;"
  
      Set objConn = Server.CreateObject("ADODB.Connection")
     objConn.Open strConn
      
      Set objRS = objConn.Execute(strSQL)
      If Not objRS.EOF  Then
          GetData = objRS.GetRows
          objRS.Close
      End  If
     Set objRS =  Nothing
      
     objConn.Close  
      Set objConn =  Nothing
      
  End  Function
%>



-------------------------
Master of the Game
Pages: (1)   [1]

search this forum: