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 Minimal C++ QT Charting Walk-through includes instructions for Visual Studio. For a C++ MFC walkthrough see: Click here for VS2019 MFC Walkthough.
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 [Windows Desktop Application]. Accept the default project name of [WindowsProject1].
2) First manually copy 'PEGRPAPI.H' and 'PEGRP32G.LIB' from the C:\ProEssentials9\VC demo directory to where the WindowsProject1 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 WindowsProject1 project.
The image shows the existing files being added to your project.
3) Open the file 'WindowsProject1.cpp' and near the top add the lines:
#include “Pegrpapi.h“
HWND hPE;
The include statement adds the ProEssentials header file which contains constants and function declarations.
The variable hPE is used to store the Window handle for the ProEssentials chart control.
4) Also within the file 'WindowsProject1.cpp' add this line to the InitInstance function:
hPE = NULL;
This will initialize our window handle to NULL at the start of the process, and we will later set to a valid handle in WM_CREATE. The chart we create will be a standard Window; as if we called the CreateWindow API call.
5) Near the top of WndProc, add variables used later to initialize the chart.
RECT r;
int s, p;
int dwColor;
float f[] = {10, 30, 20, 40, 30, 50, 15, 63, 74, 54, 25, 34};
6)Add the below message switch statements. See images below for clarity.
case WM_CREATE: creates and initialzes a chart after parent window is created.
::GetClientRect(hWnd, &r);
// PEcreate is similar to CreateWindow API call, returns a Window Handle //
hPE = PEcreate(PECONTROL_GRAPH, 0, &r, hWnd, 1000);
PEszset(hPE, PEP_szMAINTITLE, (LPWSTR) L"Hello World");
PEszset(hPE, PEP_szSUBTITLE, (LPWSTR) L"");
PEnset(hPE, PEP_nSUBSETS, 2); // Subsets = Rows //
PEnset(hPE, PEP_nPOINTS, 6); // Points = Columns //
PEvsetcell(hPE, PEP_szaPOINTLABELS, 0, (LPVOID) TEXT("Jan"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 1, (LPVOID) TEXT("Feb"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 2, (LPVOID) TEXT("Mar"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 3, (LPVOID) TEXT("Apr"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 4, (LPVOID) TEXT("May"));
PEvsetcell(hPE, PEP_szaPOINTLABELS, 5, (LPVOID) TEXT("June"));
PEvsetcell(hPE, PEP_szaSUBSETLABELS, 0, (LPVOID) TEXT("For .Net Framework"));
PEvsetcell(hPE, PEP_szaSUBSETLABELS, 1, (LPVOID) TEXT("or MFC, ActiveX, VCL"));
PEszset(hPE, PEP_szYAXISLABEL, (LPWSTR) L"Simple Quality Rendering");
PEszset(hPE, PEP_szXAXISLABEL, (LPWSTR) L"");
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);
case WM_DESTROY: clean up chart resource at same time parent is cleaned up
if (hPE) { PEdestroy(hPE); hPE = 0; }
case WM_SIZE: this causes chart to always fill client rect of parent
if (hPE)
{
RECT r; ::GetClientRect(hWnd, &r);
::MoveWindow(hPE, 0, 0, r.right, r.bottom, FALSE);
}
case WM_COMMAND: 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, (LPWSTR) L“DataPoint %d value %.2f“, hsd.w2, yvalue);
::MessageBox(hWnd, buffer, (LPWSTR) L“Hello World“, 0);
}
break;
}
Your project code files 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.
我们的首要目标是通过为您的机构和终端用户提供最简单、最专业的服务,达成您的成功。
ProEssentials是由需要自定义图表组件的专业电气工程师创立的。加入使用ProEssentials的顶级工程公司名单。
感谢您成为ProEssentials的客户,也感谢您研究ProEssentials图表引擎。