Back Home Up Next

Creating a fast VBScript Program

Using VBScript, programmers can quickly develop a simple plotting software as follows.

First, create a SXY/COM application.

Set sxy = CreateObject("sXY.Application")

Then, create a graph with the desired attributes. Note that enumerations are not available in VBScript. You should use the correspondent numeric constant (at the following example, 0 represent a linear graph for the constructor).

Set sg = sxy.createSimpleGraph( 0, 600, 400 )
sg.setWindowTitle "SXY/COM - My Test"
sg.setTitle "My Graph"
sg.setStatusLine "Hi! A new graph is here!"
sg.setSubTitle "I am an example"


After setting the basic attributes, the developer can change some of them.

sg.setAxesLayout 1
sg.setHorizontalAxisTitle "X"
sg.setVerticalAxisTitle "Y"

Now, the programmer is ready to create a curve and insert its points.

Set sc = sxy.createArrayCurve()
sc.insertPoint 0, 0
sc.insertPoint 1, 1
sc.insertPoint 2, 2
sc.insertPoint 3, 3
sc.setTitle "Curve (read-only)"
sc.setReadOnly true
sc.setRGBColor 100,255,0


As stated at the documentationsection, all curves can be referenced by its id.

sg.attachCurveById sc.getId()

Using mask visibility control functions, the programmer is able to adjust the desired masks.

sc.setMaskVisibility 2, false
sc.setMaskVisibility 3, false


At last, the programmer is able to perform automatic fitting and/or repaint.

sg.fitAllScales
sg.redrawGraph

by André Clinio