Asp.net generation curve (2)

Source: Internet
Author: User
G. drawrectangle (new pen (color. White, 400), 0, 0, IMG. Width, IMG. Height );
// Define the black transition paint brush
Lineargradientbrush brush = new lineargradientbrush (New rectangle (0, 0, IMG. Width, IMG. Height), color. Black, color. Black, 1.2f, true );
// Define the blue transition paint brush
Lineargradientbrush bluebrush = new lineargradientbrush (New rectangle (0, 0, IMG. Width, IMG. Height), color. Blue, color. Blue, 1.2f, true );
// Draw a large title
G. drawstring (Ds. tables [0]. rows [0] ["sendid"]. tostring () + "number order delivery curve", bfont, brush, 40, 5 );
// Obtain the current sending volume
Int Nums = 0;
For (INT I = 0; I <count; I ++)
{
Nums + = convert. toint32 (Ds. Tables [0]. Rows [I] ["sendnum"]);
}
// Create an information briefing
String info = "order sending time:" + Ds. tables [0]. rows [0] ["sendtime"]. tostring () + "Graph Generation Time:" + datetime. now. tostring () + "total orders:" + tnum. tostring () + "Total number of sent messages:" + nums. tostring ();
G. drawstring (Info, tfont, bluebrush, 40, 25 );
// Draw the image border
G. drawrectangle (BP, 0, 0, IMG. Width-1, IMG. Height-1 );

// Draw the vertical coordinate line
For (INT I = 0; I <count; I ++)
{
G. drawline (SP, 40 + 20 * I, 60, 40 + 20 * I, 360 );
}
// Draw the timeline coordinate tag
For (INT I = 0; I <count; I + = 2)
{
String ST = convert. todatetime (Ds. Tables [0]. Rows [I] ["sendtime"]). tostring ("HH: mm ");
G. drawstring (St, Font, brush, 30 + 20 * I, 370 );
}
// Draw the abscissa line
For (INT I = 0; I <10; I ++)
{
G. drawline (SP, 40, 60 + 30 * I, 40 + 20 * (count-1), 60 + 30 * I );
Int S = 2500-50 * I * 5;
// Draw the dispatch axis coordinate label
G. drawstring (S. tostring (), Font, brush, 10, 60 + 30 * I );
}

// Draw the vertical axis
G. drawline (BP, 40, 55, 40,360 );
// Draw the horizontal axis
G. drawline (BP, 40,360, 45 + 20 * (count-1), 360 );

// Define the curve turning point
Point [] P = new point [count];
For (INT I = 0; I <count; I ++)
{
P [I]. x = 40 + 20 * I;
P [I]. Y = 360-convert. toint32 (Ds. Tables [0]. Rows [I] ["sendnum"])/5*3/5;
}
// Draw the sending Curve
G. drawlines (RP, P );

For (INT I = 0; I <count; I ++)
{
// Draw the number of sending records
G. drawstring (Ds. tables [0]. rows [I] ["sendnum"]. tostring (), Font, bluebrush, P [I]. x, p [I]. y-10 );
// Draw the sending Record Point
G. drawrectangle (RP, P [I]. X-1, P [I]. Y-1, 2, 2 );
}
// Draw the vertical coordinate title
G. drawstring ("sent volume", tfont, brush, 5, 40 );
// Draw the abscissa title
G. drawstring ("sending time", tfont, brush, 40,385 );

// Save the drawn Image
Memorystream stream = new memorystream ();
IMG. Save (stream, imageformat. JPEG );
// Image output
Page. response. Clear ();
Page. response. contenttype = "image/JPEG ";
Page. response. binarywrite (stream. toarray ());

}
}

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.