Chart ActiveX MSChart VB6 VB Visual Basic Visual Studio

ActiveX Charting MS Chart Alternative

 

VB6 ActiveX Charting example adding charts (MSChart alternative) to your Visual Basic software using ActiveX interface and Visual Studio.

[ VB6 Visual Basic Client-Side EXE Development ]

The following demonstrates how to create your first Visual Basic Charting ActiveX implementation. It discusses installation, adding the charting activex to a project, writing your first few lines of code, and shows the final chart in the software you wrote. ProEssentials is the ideal MS Chart alternative due to its simple (property/event/method) api, free technical support, robust charting capabilities, and high quality rendering to screen and printer. Implementing our charting activex is very simple and 99% of your code is simply setting properties; like Pego1.MainTitle = "Hello".

Project / Components... menu Installation...

Adding our MSChart alternative  activex chart to your Visual Basic - Visual Studio project.

When installing the ProEssentials evaluation and/or product, the setup program installs the ProEssentials DLL and ActiveX Charting interfaces into the system directory. These files are:

PEGRP32D.DLL

ProEssentials Pro DLL
PEGO32D.OCX Graph Object
PESGO32D.OCX Scientific Graph Object
PE3DO32D.OCX 3D Scientific Graph Object
PEPSO32D.OCX Polar Object
PEPCO32D.OCX Pie Chart Object

PEGRPDS.DLL

ProEssentials Standard DLL
PEGODS.OCX Graph Object
PESGODS.OCX Scientific Graph Object
PE3DODS.OCX 3D Scientific Graph Object
PEPSODS.OCX Polar Object
PEPCODS.OCX Pie Chart Object
 

PEGRPDL.DLL

ProEssentials Lite DLL
PEGODL.OCX Graph Object
PESGODL.OCX Scientific Graph Object
PE3DODL.OCX 3D Scientific Graph Object
PEPSODL.OCX Polar Object
PEPCODL.OCX Pie Chart Object

The setup program also registers the ActiveXs with the operating system, which prepares Visual Basic for inclusion of ProEssentials components. You can manually register an ActiveX with "REGSVR32.EXE" found in your system/system32 dir. You can also use this utility to manually un-register an ActiveX by using the "-u" command.

After installation, launch Visual Basic and create a new "Standard EXE" project.

Use the Project / Components... menu item to open the [Components] dialog.


Components... Dialog Adding ProEssentials to a VB project...
Charting ActiveXs within the components dialog. Gigasoft' 5 controls beat MSChart's one control.

Within the [Components] Dialog, scroll down until you see the Gigasoft entries and select those shown in the left image. Note that the [Controls] tab is active.

Unlike MSChart's cluttered, limited, and undocumented api, ProEssentials breaks our charting functionality between 5 controls. This makes it easier to find related property, methods, and events as our feature-set is large.

Clicking the [OK] button will close the [Components] dialog and places those items selected into Visual Basic's ToolBox as shown.

Gigasft charting activeXs within the Tool Window just like a MSChart.


Form1... Adding ProEssentials to a Form...
Charting ActiveX within Visual Studio design time window, just like MSChart is used.

Pego1.Subsets = 2
Pego1.Points = 10
For s = 0 To 1
    For p = 0 To 9
       Pego1.YData(s, p) = 5 + Rnd * 5
    Next p
Next s
Pego1.MainTitle = "My Title"
Pego1.SubTitle = ""
Pego1.YAxisLabel = "My Data"
Pego1.XAxisLabel = ""
Pego1.SubsetLabels(0) = "Hello"
Pego1.SubsetLabels(1) = "World"
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_INSET
Pego1.FixedFonts = True
Pego1.LegendStyle = PELS_1_LINE_INSIDE_AXIS
Pego1.PEactions = REINITIALIZE_RESETIMAGE

Pego ActiveX Chart Object. the MSChart alternative. Click the "Pego" control from the ToolBox and then click and drag a rectangle selection on Form1's canvas.

Note, ProEssentials Std uses control name "PegoStd" and ProEssentials Lite uses control name "PegoLite".

The adjacent image shows what you see. This represents the default state of a ProEssentials Graph. 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 (Pesgo), 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.

Use Visual Basic's View / Code menu to open the Code Window. Then select [Form] from the top left drop-down combo box. The event combobox on the top right will switch to [Load]. Enter the code as shown. Writing this small amount of code will improve your understanding and demonstrate the auto-code completion features supported by ProEssentials.


Code Window... Code Comments...
Charting ActiveX source code within Visual Studio. Code is much cleaner than MSChart's code.

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

Next, a nested For-Next loop passes random data into the YData(s, p) 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 REINITIALIZE_RESETIMAGE which tells ProEssentials you're done setting properties.

Results... Congratulations...
MSChart activeX alternative within your charting software!

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

This example is very simple and you'll likely set other properties such as: Width/Height so that the control uses Form1's client area as needed.

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. Chapter 2's .NET Reference is the best mechanism to navigate the large quantity of properties and features.  Walk-Throughs of .NET charting in VB.NET, C#.NET, ASP, VC, VB6, and Delphi get you started quickly.

learn more about activex charting, see Chapter 3

Online interactive demo

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

Our online demo renders ActiveX Charts to the browser

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!