转自老方的博客
//Title:绘制曲线图
//Author:williamfang
//PubDate:2005-8-31
//定义绘制图片的宽/高
int width=246,height=200;
//定义绘制曲线的颜色
Pen greenPen = new Pen(Color.Green, 1);
//定义PointF数组(点)
ArrayList a = new ArrayList();
a.Add(new System.Drawing.PointF(50,50));
a.Add(new System.Drawing.PointF(100,100));
a.Add(new System.Drawing.PointF(150,200));
a.Add(new System.Drawing.PointF(200,560));
object[] p = a.ToArray();
Bitmap image = new Bitmap(width,height);
Graphics g = Graphics.FromImage(image);
//定义底色
g.Clear(Color.White);
//绘制边框
Rectangle outline=new Rectangle(0,0,width-1,height-1);
//定义边框颜色
g.DrawRectangle(new Pen(Color.Black,1.0f),outline);
//定义文字字体、大小和brush
Font drawFont = new Font("Arial", 8);
SolidBrush drawBrush = new SolidBrush(Color.Black);
//定义字的格式(居中、居坐……)
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Center;
//开始绘制曲线
for(int i = 0;i < p.Length-1;i++)
{
g.DrawLine(greenPen,((PointF)p[i]).X,((PointF)p[i]).Y,((PointF)p[i+1]).X,((PointF)p[i+1]).Y);
}
//绘制字体,这里绘制的是竖线
for(int i = 0;i < p.Length;i++)
{
g.DrawString("|",drawFont,drawBrush,((PointF)p[i]).X,height-10,drawFormat);
}
//在aspx页面输出图象
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);