Click here to Skip to main content
15,892,059 members
Articles / Desktop Programming / MFC
Article

Chart and Pie for data with hole

Rate me:
Please Sign up or sign in to vote.
4.25/5 (5 votes)
3 May 2002 84.6K   3.3K   42   5
Chart and Pie for data with hole.

Sample Image - chartnpie.jpg

Introduction

In my work, I always want to display several data series with hole together. Massimo Colurcio has developed a control to display data with hole, but it is not an easy way to use, especially when the data is very sparse, so I decide to develop my own control based on his work. And at the same time, I also want to show these data series in Pie.

How to use?

  1. Add the files in the source package to your project.
  2. Do initialization, see CChartView::OnInitialUpdate().
  3. Call Add of CDataChart to add datasets to the control.
    void Add( int nDatasetID, int nIndex, double nData );
  4. SetStyle(STYLE_LINE) for line chart.
  5. SetStyle(STYLE_PIE) for pie showing.

and that's all.

License

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


Written By
Researcher
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionBug: GetClientRect In CalcData On WINCE Pin
JiaTang4-Sep-12 14:30
JiaTang4-Sep-12 14:30 
QuestionMemory Leak!?!? Pin
wumme21-Nov-05 4:39
wumme21-Nov-05 4:39 
GeneralBug in calculating Max values Pin
Nicolas Stuardo2-Jul-05 19:21
Nicolas Stuardo2-Jul-05 19:21 
Excellent job! But I have found a little bug.

You can use your own demo project to reproduce it.

1.- Use STYLE_LINE style
2.- Run the project
3.- Maximize the window
4.- Restore the window
5.- Maximize the window
6.- Restore the window
7.- And so on...

You will notice that the Max Y value was increasing each time the window was resized.
I have solved it by calling CalcDatas() method (in OnPaint handler) only the first time. This has the inconvenience that the chart cannot be resized, but for me it isn't a problem since I have placed the control over a dialog box with a fixed size.

If you update your control, please, let us know.

Thanks again for the control!

Jaime

QuestionHow can I change the label of the X axis Pin
nikisoft27-Oct-04 1:16
nikisoft27-Oct-04 1:16 
GeneralGood job! Pin
guya2-Sep-04 20:59
guya2-Sep-04 20:59 

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.