In-depth introduction to CChart daily lesson-Lesson 6: a pie chart of Old foxes

Source: Internet
Author: User

This lesson is easy and will soon be out of school.

I have always liked to eat cookies.

I remember when I was a child, 2B was just a pencil, not synonymous with some young people. The people in China were not wealthy. the most stupid thing was to put a piece of fat meat in a group of flour, then put it in the hot ash in the stove at home. When the rice is cooked, the cake is also baked, and a bite of fat oil is taken out. It's sweet, and now I think of it, it's just a bit of water.

Years are killing pig knives, purple grapes, black fungus, soft bananas. Now the people throughout the country are building a well-off society under the great leadership of Xi. They are no longer stupid enough to eat the grayed-out barbecue cakes of the year. Now, the dumb's favorite is Xi'an's meat folder and mutton soup.

This article introduces the pie chart function of CChart. It is a widely used chart. Of course, because our tool is CChart, simplicity is inevitable.

Use VC6 to create a project named Lesson06 according to the method of Lesson 1. The following is a response routine for modifying the WM_CREATE message.

case WM_CREATE:chartWnd.Attach(hWnd, kTypePie);chartWnd.GetChart()->AddPie(28);chartWnd.GetChart()->AddPie(39);chartWnd.GetChart()->AddPie(21);chartWnd.GetChart()->AddPie(22);break; 

Note that the pie chart code is kTypePie.

Run the program.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130917183016906? Watermark/2/text/plain =/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA =/dissolve/70/gravity/SouthEast "alt =" SouthEast "/>

Here, we use AddPie to add the pie chart data.

Apieceofcake!

The bad thing is that the name of each pie is not set. Modify the WM_CREATE response routine again.

Case WM_CREATE: chartWnd. attach (hWnd, kTypePie); chartWnd. getChart ()-> AddPie (28); chartWnd. getChart ()-> AddPie (39); chartWnd. getChart ()-> AddPie (21); chartWnd. getChart ()-> AddPie (22); chartWnd. getChart ()-> SetPieTitle (_ T ("Zhao Min"), 0); chartWnd. getChart ()-> SetPieTitle (_ T ("weekly success if"), 1); chartWnd. getChart ()-> SetPieTitle (_ T ("Yin Li"), 2); chartWnd. getChart ()-> SetPieTitle (_ T ("Xiao Zhao"), 3); break;

Running effect.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130917183223937? Watermark/2/text/plain =/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA =/dissolve/70/gravity/SouthEast "alt =" SouthEast "/>

You can use SetPieTitle to set the title of a pie.

Finally, we set the title of the pie chart before the break line above.

ChartWnd. GetChart ()-> SetTitle (_ T ("Zhang Wuji inner world "));

Running effect.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130917183346312? Watermark/2/text/plain =/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA =/dissolve/70/gravity/SouthEast "alt =" SouthEast "/>

At last, this figure exposes the psychology of being stupid and wishing to walk together. It's a pity that I am stupid, not Han er. I don't have the ability to pull dry films. I don't have the level of "I am a son of Lao Tzu, Han; my wife is Ma Zi, and I am a relative", alas.

Please note that the title of each pie chart can be dragged at will. When the title and the corresponding pie are separated, the color and color of the title are the same. When the title and the corresponding pie are in the intersection state, the title of the pie will change color for identification ., "Xiao Zhao" has changed the color.

650) this. width = 650; "src =" http://img.blog.csdn.net/20130917183422890? Watermark/2/text/plain =/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA =/dissolve/70/gravity/SouthEast "alt =" SouthEast "/>

In addition, the pie chart itself can be dragged freely. You can try it with your mouse.

This lesson is very easy and class is ready.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.