Example code

The following example retrieves some user input from the Web Connection Demo page, creates a cursor from the captured data and then graphs the data with 4 different graphs.

FUNCTION GraphDemo
************************************************************************
* wcDemoServer :: GraphDemo
****************************************
***  Function:
***    Assume:
************************************************************************
LOCAL loGraph

SET PROCEDURE TO wwWebGraphs ADDITIVE

***Create the cursor to chart from
CREATE CURSOR TEMP (Label c(20), values I)

INSERT INTO temp (Label, Values) Values ("Value1",VAL(Request.Form("Value1")) )
INSERT INTO temp (Label, Values) Values ("Value2",VAL(Request.Form("Value2")) )
INSERT INTO temp (Label, Values) Values ("Value3",VAL(Request.Form("Value3")) )
INSERT INTO temp (Label, Values) Values ("Value4",VAL(Request.Form("Value4")) )

loGraph = CREATEOBJECT("wwWebGraphs")
IF VARTYPE(loGraph) # "O"
   THIS.ErrorMsg("Graphing Error","The Office Web Components are not installed on the server.")
   RETURN
ENDIF
   
loGraph.cCaption = "Web Connection Graph Demo"
loGraph.nGraphType = 0  && Bar
loGraph.nImageHeight = 300
loGraph.nImageWidth = 500
loGraph.cPhysicalPath = "d:\westwind\wconnect\temp\" 	&& Required
loGraph.cLogicalPath = "/wconnect/temp/"		&& Required

loGraph.ShowGraphFromCursor()
lcBar = loGraph.GetOutput()    && <img src="/wconnect/temp/img_023RRRATA.gif">

loGraph.Clear()
loGraph.nGraphType = 3   && Horizontal bar
loGraph.ShowGraphFromCursor()
lcBlock = loGraph.Getoutput()

loGraph.Clear()
loGraph.nGraphType = 7   && Line
loGraph.ShowGraphFromCursor()
lcLine = loGraph.GetOutput()

loGraph.Clear()
loGraph.nGraphType = 18   && Pie
loGraph.ShowGraphFromCursor()
lcPie = loGraph.GetOutput()

*** Show them all
THIS.StandardPage("Web Connection Graph Demo",;
                  "This demo uses the Office Web Components to render the data entered " + ;
                  "on the previous link. Images are rendered as GIF files viewable in " +;
                  "any browser.<p>" + ;
                  "<center>" + lcBar + "<p>" +;
                               lcBlock + "<p>" + ;
                               lcLine + "<p>" +;
                               lcPie + "<p>" +;
                               "</center>")

ENDFUNC
*  wcDemoServer :: GraphDemo2

To create a


  Last Updated: 9/23/2001 | © West Wind Technologies, 2008