In-depth introduction to CChart daily course-Lesson 10 split view, malformed personality of Xiao Ge

Source: Internet
Author: User

Starting from this lesson, I am stupid to introduce the complex views supported by several ccharts.

This section first introduces the split view.

The split here is of course not the split of the Wan. The so-called split view, that is, the partition view, is to divide the drawing area into several parts, each of which is to draw a separate image.

The following describes the content of this course as an example.

Create a VC6 project named lesson10. Next we only need to pay attention to the response routine of WM_CREATE. Enter the following information first.

case WM_CREATE:chartWnd.Attach(hWnd, kTypeSplit);chartWnd.GetChart()->ResizePlots(2, 2, 2);double pX[20], pY[20];int i;for(i=0; i<20; i++){pX[i] = i;pY[i] = i;}chartWnd.GetChart()->AddCurve(pX, pY, 20, 0);for(i=0; i<20; i++){pY[i] = i*i/20.0;}chartWnd.GetChart()->AddCurve(pX, pY, 20, 1);for(i=0; i<20; i++){pY[i] = i*i*i/20.0/20.0;}chartWnd.GetChart()->AddCurve(pX, pY, 20, 2);break; 

The code of the split view is kTypeSplit.

The function that needs to be explained in the above Code is ResizePlots. The function is defined as follows.

voidResizePlots(int mode, int nRows, int nCols); 


This function has three parameters.

The first parameter "mode" indicates the split mode. View Chart. code commented out in the hfile header: mode = 0 indicates no split; mode = 1 indicates row and column splitting; mode = 2 indicates split from the left to the right; mode = 3 indicates split on the left and right. mode = 3 indicates split on the last two. mode = 4 indicates split on the second.

The second parameter nRows indicates the number of lines to split, and the third parameter nCols indicates the number of columns to split. These two parameters only take effect when mode = 1, and are ignored in other cases.

The preceding Code splits the view on the left and right.

Run the program.

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

As a result, three images are created in the partition mode from the left to the right.

Add a title to the view on the left. Enter the following code in the previous line of the break; code above.

ChartWnd. GetChart ()-> SetTitle (_ T ("first subgraph title"), 0 );


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

Next, we will add a general title to the entire view. Enter the following code in the next line of the previous Code.

ChartWnd. GetChart ()-> SetTitle (_ T ("general title "));


Running effect.

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

In the interaction function implemented by split view, you can drag the split line. You can try it with your mouse.

The following is a result of dragging.

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

This course uses the CChartWnd class for programming. Students can try to use the CChart class instead.

This lesson ends now.

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.