Asp.net generation curve (1)

Source: Internet
Author: User
The effect is as follows:

This is a graph generated from the data in dataset.
My dataset is the data read from the sendrec table, which has the following fields: ID, sendid (Order Number), sendtime (record time), and sendnum (sent per unit time/here I am five minutes ).

The process is as follows:
Public void draw (page, dataset ds, int tnum ){}
The page is used to pass the page that references this process, so that the page is directly output to the client in JPG mode.
DS is the retrieved dataset.
Tnum is just a parameter I want to use here. I don't want this class to touch the read process, so I will retrieve the total amount of orders and pass it to it.

Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;

Using system. Web. UI. htmlcontrols;
Using system. Drawing. drawing2d;
Using system. Drawing. imaging;
Using system. drawing;
Using system. IO;

Public class imgdraw
{
Public imgdraw ()
{

}< br> Public void draw (page, dataset ds, int tnum)
{< br> // number of records retrieved
int COUNT = Ds. tables [0]. rows. count;
// calculate the chart width
int WD = 80 + 20*(count-1 );
// set the minimum width to 800
If (WD <800) WD = 800;
// generate a bitmap image
bitmap IMG = new Bitmap (WD, 400);
// generate a drawing image
graphics G = graphics. fromimage (IMG);
// defines the black paint brush
pen BP = new pen (color. black);
// defines the red paint brush
pen Rp = new pen (color. red);
// defines the silver-gray paint brush
pen sp = new pen (color. silver);
// define the title Font
font bfont = new font ("Arial", 12, fontstyle. bold);
// define the general font
Font font = new font ("Arial", 6 );
// define the font of a large dot
font tfont = new font ("Arial", 9);
// draw the background color

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.