In-depth introduction to the CChart daily course-the cloud map of 13th lessons that seem to have known each other, and the flowers gradually become fascinating

Source: Internet
Author: User

In the third lesson, I am stupid to show you the function of using CChart to draw a contour map. I have implemented a contour map with very little code.

This course uses the cloud map function of CChart to change the contour map of Lesson 3 to a cloud map.

Follow the method in the first lesson to create a VC6 project Lesson13.

Create a cloud map field function before the WndProc function in the Lesson13.cpp file. Select the same function as the function in Lesson 3.

double f(double x, double y){return 1.0/((x-1.0)*(x-1.0)+y*y+1.0);} 

Modify the response function of WM_CREATE as follows.

Case WM_CREATE: chartWnd. attach (hWnd, ktype1_map); chartWnd. getChart ()-> SetFieldFcn (f); {double xRange [2], yRange [2]; xRange [0] =-2.0; xRange [1] = 2.0; yRange [0] =-2.0; yRange [1] = 2.0; chartWnd. getChart ()-> SetPlotRange (xRange, yRange);} chartWnd. getChart ()-> SetTitle (_ T ("test cloud map"); break;

The code here is familiar.

It is easy to find that, compared with the code in the third lesson, except for the last line of the title, there is only a change in the first sentence. The ktype1_line is changed to ktype1_map, and the latter is the code of the cloud map.

Run the program.

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


The color of the cloud map is gorgeous, and the effect is indeed better than that of the contour map.

The legend of the cloud map is different from that seen in the previous course. This is a gradient color.

Next, let's modify the cloud map field function so that it has two maximum values to see if the CChart result is correct.

double f(double x, double y){return 1.0/((x-1.0)*(x-1.0)+y*y+1.0) + 1.0/((x+1.0)*(x+1.0)+y*y+1.0);} 


Running effect.

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

As we expected, the current image has two maximum points.

This lesson introduces the cloud map function of CChart. The cloud maps and the contour maps described above have their own characteristics. In fact, dumb also implements a view that combines the contour map with the cloud map. Of course, this is perfect. This new view is not detailed here.

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.