Visual Basic VB6-Diagrammtutorial mit ActiveX und Visual Basic

point 1
symbol 2

Visual Basic VB6 ACTIVEX CHART COMPONENT (MSChart alternative) Walk Through

ProEssentials ActiveX Charting components are used when creating stand-alone client-side EXEs or within containers that accept ActiveX components. This ActiveX Charting Walk-through includes instructions for Microsoft Visual Basic 6 VB6 and should apply to any container that accepts activex components.
For Access, Click here for Access Charting ActiveX Walkthrough
For Excel, Click here for Excel Charting ActiveX Walkthrough

Siehe die Demo...
Best WPF Chart to download, evaluate, and choose for your Financial Scientific Charting.
Best .NET Chart download for Scientific Charting, Engineering Charting.
Hello World - Walk Through - Tutorial

For help finding ActiveX specific features in our help system, the .Net Reference section is the best source for researching properties. Our help topics show ActiveX OCX specific syntax in the OCX/VCL header near top of topic.

When installing ProEssentials, the setup program installs the ProEssentials 32 bit DLL into the System32 directory on 32 bit systems. On 64 bit systems, the 32 bit DLL is installed in SysWow64 and the 64 bit DLL is installed in System32.

The setup also installs the following Charting OCX files into the same system folders as DLLs and registers them. Note, you do not register our DLLs. Note, the 32 bit and 64 bit OCXs have the same file names and classIDs and the OS will correctly invoke the appropriate version based on the run time need. The relevant files are:

Pro Components:

  • PEGOG.OCX : Graph Component
  • PESGOG.OCX : Scientific Graph Component
  • PE3DOG.OCX : 3D Scientific Graph Component
  • PEPSOG.OCX : Polar Smith Component
  • PEPCOG.OCX : Pie Chart Component
  • PEGRP32G.DLL : 32 bit Pro DLL
  • PEGRP64G.DLL : 64 bit Pro DLL

Standard Components:

  • PEGOSG.OCX : Graph Component
  • PESGOSG.OCX : Scientific Graph Component
  • PE3DOSG.OCX : 3D Scientific Graph Component
  • PEPSOSG.OCX : Polar Smith Component
  • PEPCOSG.OCX : Pie Chart Component
  • PEGRPSG.DLL : 32bit Standard DLL
  • PEGRP6SG.DLL : 64bit Standard DLL
Chart ActiveX Gigasoft OCX in VB6

The following demonstrates how to create your first Visual Basic 6 Charting ActiveX implementation. It discusses using the OCX charting components to add interactive engineering and scientific charting content to your project, writing your first few lines of code, and shows the final chart. 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.

Please see the other charting examples provided within the product/evaluation.

The setup 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 system32 or syswow64 on 64 bit systems. You can also use this utility to manually un-register an ActiveX by using the "-u" command.

Creating new charting project...

1) After installing ProEssentials, launch Visual Basic 6 and create a new "Standard EXE" project.

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

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

ProEssentials separates charting functionality between 5 controls. This makes it easier to find related property, methods, and events.

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

Gigasoft ActiveX Chart OCX in VB6

VB6 Gigasoft charting component toolbar items
Adding Gigasoft chart to the blank form...

3) VB6 Gigasoft charting component toolbar item
Click the"Pego"component from the 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 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.

4) 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.

Adding new form to hold Gigasoft chart activex.
Visual Basic [Code]...

Enter the code as shown below. You may copy and paste, but also try to write a few lines that use enums to see intellisense.

'// Simple to code = simple to implement and maintain //
Pego1.MainTitle = "Hello World"
Pego1.SubTitle = ""
Pego1.Subsets = 2  '// Subsets = Rows //
Pego1.Points = 6  '// Points = Columns //

Pego1.YData(0, 0) = 10
Pego1.YData(0, 1) = 30
Pego1.YData(0, 2) = 20
Pego1.YData(0, 3) = 40
Pego1.YData(0, 4) = 30
Pego1.YData(0, 5) = 50
Pego1.YData(1, 0) = 15
Pego1.YData(1, 1) = 63
Pego1.YData(1, 2) = 75
Pego1.YData(1, 3) = 54
Pego1.YData(1, 4) = 25
Pego1.YData(1, 5) = 34

Pego1.PointLabels(0) = "Jan"
Pego1.PointLabels(1) = "Feb"
Pego1.PointLabels(2) = "Mar"
Pego1.PointLabels(3) = "Apr"
Pego1.PointLabels(4) = "May"
Pego1.PointLabels(5) = "June"

Pego1.SubsetLabels(0) = "For .Net Framework"
Pego1.SubsetLabels(1) = "or MFC, ActiveX, VCL"
Pego1.YAxisLabel = "Simple Quality Rendering"
Pego1.SubsetColors(0) = Pego1.PEargb(60, 0, 180, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(180, 0, 0, 130)

'// Quick way to set many colors via QuickStyle property //
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.DeskColor = Pego1.PEargb(255, 255, 255, 255)

Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = PEDP_NODECIMALS
Pego1.LabelBold = True
Pego1.PlottingMethod = GPM_BAR
Pego1.GradientBars = 8
Pego1.BarGlassEffect = True
Pego1.LegendLocation = PELL_LEFT
Pego1.DataShadows = PEDS_3D
Pego1.FixedFonts = True
Pego1.FontSize = PEFS_LARGE

'// You will likely set these for all charts //
Pego1.PrepareImages = True
Pego1.CacheBmp = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True

'// Setting this True will enable Data HotSpots, //
'// but we need to add code to respond to hot spot event //

Pego1.AllowDataHotSpots = True

'// Always finish your property settings with this setting //

Your project code should look similar to...

Visual Basic 6 charting active example code
Adding a DataHotSpot event...

5) The code above enabled the DataHotSpot event, so we should place some appropriate code in the DataHotSpot event.

To add the DataHotSpot event, we need to be inside the Visual Basic editor.

Now use the top drop down list boxes to 1, select Pego1 and 2, select the DataHotSpot event.

Visual Basic Chart adding hotspot event

Add the following code to the Pego1_DataHotSpot event.

Call MsgBox("Subset " + Str$(SubsetIndex) + _
", Point " + Str$(PointIndex) + _
" with a value of " + Str$(Pego1.YData(SubsetIndex, PointIndex)))


6) Save the project, accept all the default names and run the project. Your results should be similar as shown. Move the mouse over a bar and click to trigger the DataHotSpot event.

This completes this walkthrough.

Please read the remaining sections within Chapter 3 and review the demo code and documentation that's installed with the eval/product.

Once installed, the demo program can be accessed via shortcut...

Start / ProEssentials v9 / PeDemo

Note that our main charting demo is replicated in WPF and Winform C#.NET,  VB.NET, VC++ MFC, Delphi, Builder all accessible from where you installed ProEssentials.   These are great for modifying an existing demo to test potential modifications before implementing within your applications.

MS VB6 Gigasoft Chart ActiveX within your custom software!

Thank you for researching. Please contact our engineers if you have a question.

VB Visual Basic Chart ActiveX OCX Tutorial VB6 Chart

Unsere Aufgabe

Ihr Erfolg ist unser höchstes Ziel, indem wir Ihrem Unternehmen und Ihren Endbenutzern den einfachsten und professionellsten Nutzen bieten.

Wir sind Ingenieure

ProEssentials wurde von professionellen Elektroingenieuren erschaffen, die ihre eigenen Charting-Komponenten benötigten. Treten Sie unserer großen Liste von Top-Engineering-Unternehmen bei, die ProEssentials einsetzen.

Danke sehr

Vielen Dank, dass Sie ein ProEssentials-Kunde sind, und vielen Dank, dass Sie die ProEssentials-Charting-Engine recherchieren.