C++ Chart Source Code

CPP Chart source code to print and export images and data to Excel and MS Word.

 

MFC Charting Source Code Interface in C++ / CPP

[ For the ultimate in charting robustness and seamless integration within your native Windows applications.]
   

The ProEssentials C++ MFC based source code comes as a Visual Studio VS2003 project. The code contains approximately 10,000 lines. The code compiles into vanilla DLL "PEUIMFC.DLL" with a simple C interface. This DLL is then easily integrated into your projects by including a header file and import LIB.

The ProEssentials' user interface source is nearly identical to the embedded user interface integrated into the ProEssentials DLL.

ProEssentials popup menus:

  • Right-Click Popup menus provide quick customizations and access to export and maximization.
  • All properties effecting menu behavior are supported, including the CustomMenu features.
  • In the image to right, note "Category A" and "Option" items are implemented via ProEssentials Custom Menu features (example 127 in the PeDemo).
  • Given you have the source, the use of the Custom Menu features is now optional and still provides an easy method to add a quick item to our menus. But if you need full control of the menus, the source code provides the means.
Vb.net Chart source code within Visual Studio.
   

Mfc chart source code within Visual Studio.

Customization Dialog:

  • The customization dialogs allow the end user to adjust the chart's look, plotting style, select and/or deselect subsets/series/points/data, change axis ranges, change fonts, change chart and subset colors and subset styles.
  • All properties effecting dialog behavior are supported, including the showing of various tabs and dialog sections.
  • The Color tab implements owner-draw custom color selection controls. The Style tab implements owner draw combo boxes to allow line-style and point-symbol-style adjustments.
  • Having the source allows for the easy addition of more tabs and/or altering their contents.
   

Export Dialog:

  • The export dialog allows end-user to export EMF, WMF, JPG, PNG images to clipboard or file. Export Text-Data to clipboard or file which is easily imported into Excel. And allows end-user to print high quality hard copies.
  • All properties effecting dialog behavior are supported.
  • Having the source allows for better integration with your software. The best advantages would be allowing custom page headers/footers on printouts, adding custom images/watermarks on printouts and image exports, and adding logic to automate multiple exports and printouts.

Mfc C++ chart source code export dialog

   

C++ chart source code for printing.

Print Dialog:

  • The print dialog allows end-user to print a hard-copy of a chart. ProEssentials has many properties that effect the printing process. This dialog takes advantage of these features.
  • Our print dialog allows for quickly adjusting the color / monochrome setting and immediately shows a WYSIWYG representation of the chart being printed.
  • Our full low level printing source is included. This allows for maxium quality and robustness with modifications that add headers, footers, and watermarks to your printouts.
   

Text-Data Export Dialog:

  • The Text-Data export dialog allows end-user to export the chart's data in a text form in either tab or comma delimited format to clipboard or file destinations. The tab delimited form easily imports into MS Excel and MS Word via the clipboard or a file.
  • All properties effecting text export behavior are supported. This allows for easily controlling default dialog settings so end user can store their common export settings within your application.

C++  chart source code for exporting data to excel and ms word.

 

GENERAL HOW-TO

ProEssentials v6 version 6.0.0.74 or later is needed as new property interfaces are used with the new UI API.

To implement the user interface DLL...

1) include PEUIMFCAPI.H

2) include latest PEGRPAPI.H (supplied with your license of ProEssentials)

3) project should reference libs, PEUIMFC.LIB and PEGRP32D.LIB (PEGRP32D.LIB supplied with your license of ProEssentials)

note: substitute PEGRPDS.LIB or PEGRPDL.LIB for ProEssentials Standard and Lite users.

4) Call functions within PEUIMFCAPI.H similar to respective PEGRP32D calls.

For example, PEUIlaunchcustommize is similar to PElaunchcustomize.

For example, within your project, respond to PEWM_DOUBLECLK notification event to call PEUIlaunchcustomize(m_hPE, 0)

See below for an example of duplicating ProEssentials current user interface mouse and keyboard triggers.

Disable built-in user interface with ...

PEnset(m_hPE, PEP_bUSINGUISOURCECODE, TRUE);

5) When the parent window of a ProEssentials chart is destroyed, call PEUIdestroy(hPE)

In your MFC app you are already calling PEdestroy(hPE), just add a call PEUIdestroy(hPE) prior.

Like..

PEUIdestroy(hPE);
PEdestroy(hPE);

This is needed to clean up menu resources.
You can should also call PEUIdestroy if changing chart properties which effect menu characteristics so
a new menu is allocated and constructed on next call to PEUIlaunchpopupmenu.

BOOL YourWindow::OnCommand(WPARAM wp, LPARAM lp)
{
    POINT pt;

    if (lp == (LPARAM) m_hPE)
    {
       if ((HIWORD(wp) == PEWN_RBUTTONCLK)) { PEvgetW(m_hPE, PEP_ptLASTMOUSEMOVE, &pt); PEUIlaunchpopupmenu(m_hPE, &pt); }

       if ((HIWORD(wp) == PEWN_DBLCLICKED))
       {
          if (PEnget(m_hPE, PEP_nOBJECTTYPE) != PECONTROL_3D) // 3D objects usually rotate on double click
              PEUIlaunchcustomize(m_hPE, 0);
       }
   
       if ((HIWORD(wp) == PEWN_KEYDOWN))
       { 
           KEYDOWNDATA kdd;
           PEvget(m_hPE, PEP_structKEYDOWNDATA, &kdd);

           // 'Space' opens Customization Dialog //
           if (kdd.nChar == ' ') { PEUIlaunchcustomize(m_hPE, 0); return TRUE; }

           // 'X' opens Export Dialog //
           if (kdd.nChar == 'X' || kdd.nChar == 'x' ) { PEUIlaunchexport(m_hPE); return FALSE; }

           // 'P' opens Print Dialog //
           if (kdd.nChar == 'P' || kdd.nChar == 'p' ) { PEUIlaunchprintdialog(m_hPE, TRUE, NULL); return TRUE; }

           // 'D' opens Text Export Dialog //
           if (kdd.nChar == 'D' || kdd.nChar == 'd' ) { PEUIlaunchtextexportW(m_hPE, FALSE, NULL); return TRUE; }

           // 'M' opens Maximize Dialog //
           if (kdd.nChar == 'M' || kdd.nChar == 'm' ) { PEUIlaunchmaximize(m_hPE); return TRUE; }
        }
    } // processing only m_hPE messages in this section

    return CDialog::OnCommand(wp, lp);
}

 
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 mfc charting, see Chapter 5

Online interactive demo

Interactive 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!