Drawing graphs with C # (curve graph, increasing automatic adaptation and multi-curve drawing)

Source: Internet
Author: User

In the N long ago, I sent a drawing curve of the article first sent a plot of the graph: the use of ASP.net with C # drawing graphs (curve diagram) inside the simple method of drawing graphs. I have been leafing through this article recently. In a great mood, I have revised the drawing method again, Increase the processing of automatic adaptive data and can draw multiple curves based on incoming data

As usual, picture above:

More cool than before, huh? Oh, in fact, according to the data automatically calculate margins and fonts.

<summary>///automatically adjusts image size based on parameters///</summary> public void Fit () {
            Calculate font Distance intfontspace = fontsize + 5;
            Calculate image margin Float fltspace = math.min (WIDTH/6, HEIGHT/6);
            Xspace = Fltspace;
            Yspace = Fltspace;
            Calculates the x-axis scale width Xslice = (Width-2 * xspace)/(KEYS.LENGTH-1);
            Calculates the y-axis tick width and the y-axis tick start value float fltminvalue = 0;
            float Fltmaxvalue = 0; 
                    for (int i = 0; i < values.length i++) {if (Values[i] < Fltminvalue) {
                Fltminvalue = Values[i];
                else if (Values[i] > Fltmaxvalue) {fltmaxvalue = values[i]; } if (Yslicebegin > Fltminvalue) {yslicebegin = Flt
            MinValue; int intyslicecount = (int)
            (Fltmaxvalue/yslicevalue);
            if (fltmaxvalue% yslicevalue!= 0) {intyslicecount++;
        } Yslice = (Height-2 * yspace)/intyslicecount; }

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.