C#绘制曲线图和柱状图
矩形图
//Render是图形大标题,图开小标题,图形宽度,图形长度,饼图的数据集和饼图的数据集
public Image Render(string title, int width, int height, DataTable chartTable)
{
Bitmap bm = new Bitmap(width, height);
Graphics g = (bm);
();
DataTable dt = chartTable;
const int top = 30;
const int left = 35;
if (width < left * 2 || height < top * 2)
{
("绘图区域太小", new Font("Tahoma", 8),
, new PointF(0, 0));
return bm;
}
//计算最高的点
float highPoint = 1;
foreach (DataRow dr in )
{
if (highPoint < (dr[0]))
{
highPoint = (dr[0]);
}
if (highPoint < (dr[1]))
{
highPoint = (dr[1]);
}
}
try
{
//画大标题
(title, new Font("Tahoma", 12), , new PointF(2, 2));
StringFormat drawFormat = new StringFormat();
= ;
("[红
C#绘制曲线图和柱状图 来自淘豆网www.taodocs.com转载请标明出处.