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