Back to Home
Visual Graph Home
TriSun Software Inc. Home

Visual Graph Site Menu
Home
What is Visual Graph?
Screenshots
50 Technical Features
Getting Started
Abundant Graphic Libraries
File Format
FAQ
Online Demo (IE Only)
Common Applications
Visual Graph Getting Started
Use VG Component in Delphi 6
Use VG Component in VB6
Use Graphic Library
Change Element's Shape
Customize Property
Make Graphic Button
Get the Selected Elements
Dynamically Create Graph
Movable Label
Link Point
Access Properties
Use Line Vertexes
Call Windows API Functions
Call Visual Graph Functions
Callback Control Event in Script
Drag Graph in Run Mode
Detail Report
Make and Use Dialog Box

Visual Graph Getting Started - Dynamically Create Graph

Each graph has the corresponding description string, so we can use SaveToBuffer() to save a graph to memory by string, also can use LoadFromBuffer() to generate a graph by string.

1. Create a new file in Visual Graph IDE, and then click Table -> New table... menu item to create a table with 2 columns and 3 rows. Now, please fill this table as below:

circle <circle name="circle1" bounds="0,0,84,50" origin="42,25" pattern="1"/>
line <line name="line1" origin="52,25" pattern="1" points="0,24,6 48,0,2 104,50,2"/>
Traffic Lights <TrafficLights name="s" bounds="0,0,60,200" origin="30,100">
<circle name="Circle1" bounds="0,0,60,60" origin="30,35" backcolor="$FF" pattern="1"/>
<circle name="Circle2" bounds="0,70,60,130" origin="30,105" pattern="1"/>
<circle name="Circle3" bounds="0,140,60,200" origin="30,175" pattern="1"/>
</TrafficLights>


2. Click Program -> Command line... menu item, input the following script in the Command line window and press <Enter>:

d=AddUnit( 0, "circle" );d.loadfrombuffer(text2.text)

Please note that text2 is the 2nd cell in first row.

Now, a circle will appear in current sheet according to text2.text like this:

Dynamically Create Graph 1

3. Input the following script in the Command line window and press <Enter>:

d=AddUnit( 0, "line" );d.loadfrombuffer(text4.text)

Please note that text4 is the 2nd cell in second row.

Now, a graph will appear in current sheet according to text4.text like this:

Dynamically Create Graph 2

4. Input the following script in the Command line window and press <Enter>:

d = AddUnit( 0, "traffic lights" ); d.LoadFromBuffer( text6.text )

Please note that text6 is the 2nd cell in third row.

Now, the traffic lights will appear in current sheet according to text6.text like this:

Dynamically Create Graph 3

5. Refer to this example, we can save graph's description string in file or database, once we need one, just simply call LoadFromBuffer() to generate it by using its description string.

Sitemap | Legal Notices | Privacy Policy | Contact Us | About Us
Copyright© 2004-2017 TriSun Software Inc. All rights reserved.