ProEssentials DLL interfaces are used when creating stand-alone Desktop or Embedded EXEs to be distributed royalty-free and ran on an end-users machine. This VS2022 - VS2019 MFC C++ Charting Walk-through includes instructions for Visual Studio using MFC. If you prefer an absolutely minimal Win32 Hello World type project without use of MFC, see Win32 C++ Charting Library. The product eval also installs a large MFC example project.
IMPORTANT: For help finding DLL specific features in our help system, click the Contents Tab at the top-left location, then near the bottom click ProEssentials Reference, and then see the Alphabetic Listing. The .Net Reference section is the best source for researching properties and still shows DLL specific syntax.
When installing ProEssentials, the setup program installs the ProEssentials DLL into the System32 directory, SysWow64 on 64 bit systems. It also installs a header file and import library into the C:\ProEssentials9\VC directory. The relevant files are:
1) Start Visual Studio.NET and create a new project targeting [C++] [Windows] [Desktop] and [MFC App]. Enter a project name as name of [MyFirstMfc].
2) After entering the name of your project, the App Wizard will ask for other settings.
3) Select your project settings to match the settings shown.
The items selected were...
The items selected were...
The items selected were...
4) First manually copy 'PEGRPAPI.H' and 'PEGRP32G.LIB' from the C:\ProEssentials9\VC demo directory to where the [MyFirstMfc] project files are located.
Note, if using the Standard version instead of Pro version, use 'PEGRPSG.LIB'.
From the top level Visual Studio menus, use [Project / Add Exiting Item...] menu to add 'PEGRPAPI.H' and 'PEGRP32G.LIB' to the [MyFirstMfc] project.
The image shows the existing files being added to your project.
5) Open the file 'myfirstmfcview.cpp' and near the top add the line:
#include “Pegrpapi.h“
The include statement adds the ProEssentials header file which contains constants and function declarations.
6) Open the file 'myfirstmfcview.h' and add the line:
HWND hPE;
The variable hPE is used to store the Window's handle for the ProEssentials chart control. The chart we create will be a standard Window; as if we called the CreateWindow API call.
Each instance of MyFirstMfcView will have its own copy of this handle.
Then within file 'myfirstmfcview.cpp', find constructor and initialize hPE to NULL.
hPE = NULL;
7) From the top level Visual Studio menus, use [Project / Class Wizard...] menu to open the Class Wizard dialog.
Select Class Name CMyFirstMfcView.
Select the Messages tab and double click messages...
The image shows the message handlers added to your project. Now our view class (parent window to our chart) will look to respond to these messages.
Select the Virtual Functions tab and double click function...
The image shows the virtual function OnCommand added to your project. Now our view class (parent window to our chart) will look to respond to WM_COMMAND messages.
8) Within the recently added OnCreate, OnDestroy, OnSize, and OnCommand sections of MyFirstMfcView.cpp, add the following code that initializes an example chart. See images below for further reference.
OnCreate: creates and initialzes a chart after parent creates it's window
RECT r;
int s, p, dwColor;
float f[] = {10, 30, 20, 40, 30, 50, 15, 63, 74, 54, 25, 34};
GetClientRect(&r);
// PEcreate is similar to CreateWindow API call, returns a Window Handle //
hPE = PEcreate(PECONTROL_GRAPH, 0, &r, this->m_hWnd, 1000);
PEszset(hPE, PEP_szMAINTITLE, TEXT("Hello World"));
PEszset(hPE, PEP_szSUBTITLE, TEXT(""));
PEnset(hPE, PEP_nSUBSETS, 2); // Subsets = Rows //
PEnset(hPE, PEP_nPOINTS, 6); // Points = Columns //
PEvsetcell(hPE, PEP_szaPOINTLABELS, 0, TEXT("Jan"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 1, TEXT("Feb"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 2, TEXT("Mar"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 3, TEXT("Apr"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 4, TEXT("May"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 5, TEXT("June"));
PEvsetcell(hPE, PEP_szaSUBSETLABELS, 0, TEXT("For .Net Framework"));
PEvsetcell(hPE, PEP_szaSUBSETLABELS, 1, TEXT("or MFC, ActiveX, VCL"));
PEszset(hPE, PEP_szYAXISLABEL, TEXT("Simple Quality Rendering"));
PEszset(hPE, PEP_szXAXISLABEL, TEXT(""));
dwColor = PERGB(60, 0, 180, 0); PEvsetcell(hPE, PEP_dwaSUBSETCOLORS, 0, &dwColor);
dwColor = PERGB(180, 0, 0, 130); PEvsetcell(hPE, PEP_dwaSUBSETCOLORS, 1, &dwColor);
// Quick way to set many colors via QuickStyle property //
PEnset(hPE, PEP_bBITMAPGRADIENTMODE, FALSE);
PEnset(hPE, PEP_nQUICKSTYLE, PEQS_LIGHT_SHADOW);
PEnset(hPE, PEP_nGRAPHPLUSTABLE, PEGPT_BOTH);
PEnset(hPE, PEP_nDATAPRECISION, 0);
PEnset(hPE, PEP_bLABELBOLD, TRUE);
PEnset(hPE, PEP_nPLOTTINGMETHOD, PEGPM_BAR);
PEnset(hPE, PEP_nGRADIENTBARS, 8);
PEnset(hPE, PEP_bBARGLASSEFFECT, TRUE);
PEnset(hPE, PEP_nLEGENDLOCATION, PELL_LEFT);
PEnset(hPE, PEP_nDATASHADOWS, PEDS_3D);
PEnset(hPE, PEP_bFIXEDFONTS, TRUE);
PEnset(hPE, PEP_nFONTSIZE, PEFS_LARGE);
// You will likely set these for all charts //
PEnset(hPE, PEP_bPREPAREIMAGES, TRUE);
PEnset(hPE, PEP_bCACHEBMP, TRUE);
PEnset(hPE, PEP_nRENDERENGINE, PERE_DIRECT2D);
PEnset(hPE, PEP_bANTIALIASGRAPHICS, TRUE);
PEnset(hPE, PEP_bANTIALIASTEXT, TRUE);
// Setting this TRUE will enable Data HotSpots, //
// but we need to add code to respond to hot spot message //
PEnset(hPE, PEP_bALLOWDATAHOTSPOTS, TRUE);
// Always finish your property settings with these function calls //
PEreinitialize(hPE);
PEresetimage(hPE, 0, 0);
OnDestroy: clean up chart resource at same time parent is cleaned up
if (hPE) { PEdestroy(hPE); hPE = 0; }
OnSize: this causes chart to always fill client rect of parent
if (hPE)
{
RECT r; GetClientRect(&r);
::MoveWindow(hPE, 0, 0, r.right, r.bottom, FALSE);
}
OnCommand: listen for notification message to handle hot spot
int wmId = LOWORD(wParam);
int wmEvent = HIWORD(wParam);
switch (wmEvent)
{
case PEWN_CLICKED:
HOTSPOTDATA hsd; TCHAR buffer[128]; float yvalue;
PEvget(hPE, PEP_structHOTSPOTDATA, &hsd);
if (hsd.nHotSpotType == PEHS_DATAPOINT)
{
PEvgetcellEx(hPE, PEP_faYDATA, hsd.w1, hsd.w2, &yvalue);
swprintf_s(buffer, TEXT(“DataPoint %d value %.2f“), hsd.w2, yvalue);
::MessageBox(this->m_hWnd, buffer, TEXT(“Hello World“), 0);
}
break;
}
Your project code should look similar to...
8) Save and run the project. Your project will show an image as follows. Move the mouse over a bar and click to trigger the DataHotSpot event.
This completes this walkthrough.
Please read the remaining sections within Chapter 5 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.
Ihr Erfolg ist unser höchstes Ziel, indem wir Ihrem Unternehmen und Ihren Endbenutzern den einfachsten und professionellsten Nutzen bieten.
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.
Vielen Dank, dass Sie ein ProEssentials-Kunde sind, und vielen Dank, dass Sie die ProEssentials-Charting-Engine recherchieren.