Delphi Chart-Graph example code for VCL Charting

Delphi Charting and Graphing

 

Walk-through, source-code of adding delphi charts and graphs to your EXE via VCL interface and pascal language.

[ Delphi Client-Side EXE Development ]

The following demonstrates your first ProEssentials VCL Delphi Chart implementation.

installing into Delphi is pointing Delphi to install package gigasoft.dpk.

gigasoft.dpk... Installation of the Delphi Charting DPK...

Gigasoft Delphi Chart package contents.

When installing the ProEssentials evaluation and/or product, the setup program installs the ProEssentials DLL into the system32 dir. It also installs the ProEssentials charting VCL interfaces into C:\ProEssentials7\Delphi. Your relevant files are:

PEGRP32E.DLL

ProEssentials Pro DLL
GIGASOFT.DPK Delphi Charting Package
PEGRPAPI.PAS ProEssentials Constants and Declarations
PEGVCL.PAS Graph Object
PESGVCL.PAS Scientific Graph Object
PE3DVCL.PAS 3D Scientific Graph Object
PEPSVCL.PAS Polar Object
PEPCVCL.PAS Pie Chart Object
 

PEGRPDS.DLL

ProEssentials Standard DLL

PEGRPDL.DLL

ProEssentials Lite DLL

After installation, launch Delphi and use the File / Close All, and then File / Open menu to open the file "GIGASOFT.DPK" found in the C:\ProEssentials7\Delphi directory. You see a window as shown to the left. Click the "Install" button and the PAS interfaces are compiled and ProEssentials Delphi Charts components installed into the "Additional" tab.

Delphi Chart buttons on the toolbar.


Project / Options... Dialog Adding Gigasoft's Delphi Chart to the project...
Gigasoft Delphi Charts within Search Path.

After the components are installed, use the File / Close All menu item and save the "Gigasoft" delphi charting package when prompted.

Next, use the File / New Application menu item to create a new EXE project.

Next, use the Project / Options... menu to open the "Project Options" dialog as shown to the left. Add "C:\ProEssentials7\Delphi" to the "Search path" field and select "OK".


Form1... Adding ProEssentials to a Form...

Gigasoft Delphi Chart within the designer.

Gigasoft Delphi Chart icon on toolbar. Click the "PEGraph" control from the Additional ToolBox and then click and drag a rectangle selection on Form1's canvas.

The adjacent image shows what you see. This represents the default state of a ProEssentials Delphi Chart. The default state has one subset with four data points. In the course of constructing your own charts, you'll set the properties Subsets and Points which define the quantity of data your chart will hold. You'll then pass data via the YData[subset, point] two dimensional property array. The following section shows example code of passing data. Note, if we were constructing a Scientific Graph (PESGraph1), we'd also set XData[subset, point].

ProEssentials uses the terms Subsets and Points but you can think of these as Rows and Columns. Passing data is as simple as filling each Subset with Points worth of data.


Unit1.pas... Code Comments...
Delphi Charting source code.

Delphi charting property window. Use Delphi's Object Inspector to add the FormShow event handler to the project. Enter the code as shown to the left.

The first two lines set Subsets and Points. These define the amount of data you'll be passing.

Next, a nested For-Do loop passes random data into the YData[s,p] two dimensional property array.

Next, MainTitle and SubTitle are set. Note that setting SubTitle to an empty string hides the subtitle. The YAxisLabel and XAxisLabel are set similarly.

SubsetLabels[0] sets the first subset label. [1] sets the second subset label.

Next, we set various other properties controlling visual aspects.

Finally, PEactions is set to gReinitAndReset which tells ProEssentials you're done setting properties.

Results... Congratulations...
Gigasoft's Dephi charting within your software!

Use Delphi's Run / Run Menu (short cut F9) and you'll see the resulting form to the left. Congratulations, you've just completed your first ProEssentials Delphi Charting implementation.

This example is very simple and you'll likely set other properties such as:

PointLabels which will replace the "1,2,3..." along x axis.

SubsetLineTypes which controls line styles.

SubsetColors which controls line colors.

PlottingMethod which controls the type of chart created, Line, Bar, Area, Point, etc.

 

Online developer reference

Complete online technical reference to the ProEssentials product. The .NET Reference is the best mechanism to navigate the large quantity of properties and features.  Walk-Throughs of charting in VB.NET, C#.NET, ASP, VC, VB6, and Delphi get you started quickly.

learn more about Delphi Charts, see Chapter 4

Online interactive demo

Financial, Engineering, Scientific, and Business examples give you an instant taste of ProEssentials' power.

view our online Charting Demo

Letter from the President

CONGRATULATIONS! Reading this page means you're likely a product manager, product owner, or should be one.

Charting Component Strengths, print it, read it!