Click here to Skip to main content
11,930,069 members (56,206 online)
Click here to Skip to main content
Add your own
alternative version


54 bookmarked

Pie Chart Control

, 18 Aug 2001
Rate this:
Please Sign up or sign in to vote.
This control creates a simple Pie Chart in a dialog
<!-- Download Links --> <!-- Article image -->

Sample Image - pie_chart_ctrl.gif

<!-- Main HTML starts here -->


This control class CPieChartCtrl is derived from CWnd. The purpose is to create a simple 2D pie chart in a dialog. The code is created and compiled with Visual C++ 5.0 SP3 under Windows 98.

How to use

  1. Use the MS Visual C++ dialog editor to place a custom control on the dialog, and enter "PIE_CHART_CTRL" as the Class name.

  2. Add a CPieChartCtrl class member in the header file
    #include "PieChartCtrl.h"
    CPieChartCtrl m_wndChart;
  3. Subclass the class member with the control in InitDialog()
    m_wndChart.SubclassDlgItem(IDC_PIECHART1, this); //IDC_PIECHART1 is the control ID
  4. Use these functions to edit to chart
    // SetTitle(CString) - Set the chart title text
    m_wndChart.SetTitle("Chart Title");
    // Reset() - Reset the chart and delete all pieces
    // AddPiece(COLORREF colorBack, COLORREF colorText, 
    //            int nAngle, int strInfo = "");
    // Add one piece into the chart
    m_wndChart.AddPiece(colorBack, colorText, nAngle, strInfo);


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Yuheng Zhao
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralFix to draw complete circle Pin
bkowald27-Oct-04 6:30
memberbkowald27-Oct-04 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 Aug 2001
Article Copyright 2001 by Yuheng Zhao
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid