说明:此示例代码在我做的一个项目中 不过还是可以学习一下
一:直角坐标系显示数据
先看效果图:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAiYAAAHmCAIAAADIrNI4AAAcc0lEQVR4nO3d204j2fnw4ffy+oK4HM4xwvJnSMUOkQChPz3dmQnKRiQHIUJmIwgbmwMugO+gB9p4hze1ynbV82g0AhqWlw2sH7VxOR7fvAJASiE5ABRDcgAoiOQAUBDJAaAgkgNAQSQHgIIsOTkR8elHACiHaZMTY3z6CcOf+drXlQlvAFAyM2/ljEvC5FSM25rp//804wCwvkYkZ/KmzNiBZkzOuI9P2DYCYK1N2sr5dL/ZuE+eYyibOwClN0NyJvzr64zHcl7H7FiTHIASmzk5I/Mw/O6EoSaMJjkAJbaE5Ex+e9z4AKy75WzlfPpBvQEonzyTM+WxnE//dXhwAEpgaVs5Ew7b6A1AKX2SnPdNkE8P7893+sAcQwGwpuL+/v7p6WnkU0FHfPb4vV6zJmfy1pLqAJRPZFl2eno6sJXzaVQm7yib/LX9Hxw3juQAlE+cnJxcXFxMc1nPyR+Z/vSB/s9/HV8y1QEomTg+Pj4/P5+cnHGr//SFGD5jbfhfZ91yAmC9RLvdvrq68hJtAKQWe3t7//vf/yQHgNSi2Wze3t4uMTn2ngFURGRZ1u12l/hC1ONOyAagZOLg4OD5+VlyAEgtDg8Pl5WcyWdRA1Ay0W63x13wJvltSw5AlUS9Xr+5uSk+OdM8XRSAMolGo3F/fy85AKQWrVar+GM5018XB4DSiN3d3eK3ciQHoIKiVqvd3d0VmZwJvVEdgBKTHAAKEtvb20Ve8ObT3qgOQFlFvV4v8rKekgNQWVGv1ws7fWDK3qgOQClFrVYrbCtHcgCqLLa2too5ljNTb1QHoHyKS87YGZQnLZ3NL/FlszPrlx1tRMTGUaIJjRr66Gj8rXWOjkbeg87mlwXn2Nn8MvDoHG1EjH/Ejjam/+vkk6kdbUy4HaAwkpOr4eh8XGePNkavfJ3NL+OXzc7ml0+W1HGL84/bGg7MZ4v56N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EcAAoiOQAURHIAKIjkAFAQyQGgIJIDQEEkB4CCSA4ABZEcAAoiOQAURHIAKIjkAFAQyQGgIJIDQEEkB4CCSA4ABfn/P0tjqQZ8CXsAAAAASUVORK5CYII=" alt="" />
代码:
private List<int> Conuts = new List<int>(); public List<int> Conuts1
{
get { return Conuts; }
set { Conuts = value; }
}
protected void Page_Load(object sender, EventArgs e)
{ StaffSystemDataContext dc = new StaffSystemDataContext();
var Deps = dc.PropertyMappings.Where(p => p.PropertyName.Equals("DepartmentID"));
foreach (var dep in Deps)
{
var Pros = dc.Projects.Where(p => p.DepartmentID.Equals(dep.PropertyValue));
Conuts1.Add(Pros.Count());
}
//画图初始化
Bitmap bMap = new Bitmap(, );
Graphics gph = Graphics.FromImage(bMap);
gph.Clear(Color.White);
//中心点
PointF cPt = new PointF(, );
//X轴三角形
PointF[] xPt = new PointF[] { new PointF(cPt.Y + , cPt.Y), new PointF(cPt.Y, cPt.Y - ), new PointF(cPt.Y, cPt.Y + ) };
//Y轴三角形
PointF[] yPt = new PointF[] { new PointF(cPt.X, cPt.X - ), new PointF(cPt.X - , cPt.X), new PointF(cPt.X + , cPt.X) };
//图表标题
gph.DrawString("部门项目汇总图表", new Font("宋体", ), Brushes.Black, new PointF(cPt.X + , cPt.X));
//画X轴
gph.DrawLine(Pens.Black, cPt.X, cPt.Y, cPt.Y, cPt.Y);
gph.DrawPolygon(Pens.Black, xPt);
gph.FillPolygon(new SolidBrush(Color.Black), xPt);
gph.DrawString("部门", new Font("宋体", ), Brushes.Black, new PointF(cPt.Y + , cPt.Y + ));
//画Y轴
gph.DrawLine(Pens.Black, cPt.X, cPt.Y, cPt.X, cPt.X);
gph.DrawPolygon(Pens.Black, yPt);
gph.FillPolygon(new SolidBrush(Color.Black), yPt);
gph.DrawString("项目数", new Font("宋体", ), Brushes.Black, new PointF(, ));
//画Y轴刻度
for (int i = ; i <= ; i++)
{
gph.DrawString(i.ToString(), new Font("宋体", ), Brushes.Black, new PointF(cPt.X - , cPt.Y - i * - ));
gph.DrawLine(Pens.Black, cPt.X - , cPt.Y - i * , cPt.X, cPt.Y - i * );
}
//画X轴项目
int a = ;
foreach (var dep in Deps)
{ gph.DrawString(dep.PropertyMeaning.Substring(, ), new Font("宋体", ), Brushes.Black, new PointF(cPt.X + a * - , cPt.Y + ));
gph.DrawString(dep.PropertyMeaning.Substring(, ), new Font("宋体", ), Brushes.Black, new PointF(cPt.X + a * - , cPt.Y + ));
gph.DrawString(dep.PropertyMeaning.Substring(, ), new Font("宋体", ), Brushes.Black, new PointF(cPt.X + a * - , cPt.Y + ));
a++;
}
for (int i = ; i <= Deps.Count(); i++)
{
//画点
gph.DrawEllipse(Pens.Black, cPt.X + i * - 1.5F, cPt.Y - Conuts1[i - ] * - 1.5F, , );
gph.FillEllipse(new SolidBrush(Color.Black), cPt.X + i * - 1.5F, cPt.Y - Conuts1[i - ] * - 1.5F, , );
//画数值
gph.DrawString(Conuts1[i - ].ToString(), new Font("宋体", ), Brushes.Black, new PointF(cPt.X + i * , cPt.Y - Conuts1[i - ] * ));
//画折线
if (i > )
gph.DrawLine(Pens.Red, cPt.X + (i - ) * , cPt.Y - Conuts1[i - ] * , cPt.X + i * , cPt.Y - Conuts1[i - ] * );
}
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
Response.ClearContent();
Response.ContentType = "image/Png";
Response.BinaryWrite(ms.ToArray());
gph.Dispose();
bMap.Dispose();
Response.End();
}
注意:这里的坐标都是从左上角开始算 而且必须使用最后的一小段代码将其转化为图片
二:绘制圆形效果
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAocAAAKGCAIAAAC3KqYQAAAgAElEQVR4nO3dzY7j1pkG4Lq8uqC6gL4Lb2rrtQ0Y2UZZ2LvMLoskC6MwyDgIHEwSeJwgbSCchVQqiT+Hh5SOznfI5wERlCmKpNhvvldUVVc/dQBADE+1TwAAONHKABCFVgaAKLQyAEShlQEgCq0MAF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CZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2ZJyoBXmFcWEyZaUA60wrygmTLakHGiFeUUxYbIl5UArzCuKCZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2ZJyoBXmFcWEyZaUA60wrygmTLakHGiFeUUxYbIl5UArzCuKCZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2ZJyoBXmFcWEyZaUA60wrygmTLakHGiFeUUxYbIl5UArzCuKCZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2ZJyoBXmFcWEyZaUA60wrygmTLakHGiFeUUxYbIl5UArzCuKCZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2ZJyoBXmFcWEyZaUA60wrygmTLakHGiFeUUxYbIl5UArzCuKCZMtKQdaYV5RTJhsSTnQCvOKYsJkS8qBVphXFBMmW1IOtMK8opgw2Xp6slgslmYWKEO2ACAKrQwAUWhlAIhCKwNAFFoZAKLQygAQhVYGgCi0MgBEoZUBIAqtDABRaGUAiEIrA0AUWhkAotDKABCFVgaAKLQyAEShlQEgCq0MAFFoZQCIQisDQBRaGQCi0MoAEIVWBoAotDIARKGVASAKrQwAUWhlAIhCKwNAFFoZAKLQygAQhVYGgCi0MgBEoZUBIIr/B5q7VDQZx/vDAAAAAElFTkSuQmCC" alt="" />
StaffSystemDataContext dc = new StaffSystemDataContext();
var Deps = dc.PropertyMappings.Where(p => p.PropertyName.Equals("DepartmentID")); //创建画图对象
int width = , height = ;
Bitmap bitmap = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bitmap);
try
{
//清空背景色
g.Clear(Color.White);
Pen pen1 = new Pen(Color.Red); Brush brush1 = new SolidBrush(Color.PowderBlue);
Brush brush2 = new SolidBrush(Color.Blue);
Brush brush3 = new SolidBrush(Color.Wheat);
Brush brush4 = new SolidBrush(Color.Orange);
Brush brush5 = new SolidBrush(Color.Gray);
Brush brush6 = new SolidBrush(Color.Red);
Brush brush7 = new SolidBrush(Color.White);
Brush[] brs = new Brush[] { brush1, brush2, brush3, brush4, brush5, brush6 };
Font font1 = new Font("Courier New", , FontStyle.Bold);
Font font2 = new Font("Courier New", );
g.FillRectangle(brush7, , , width, height); //绘制背景图
g.DrawString("员工部门比例饼形图", font1, brush2, new Point(, )); //书写标题
int piex = , piey = , piew = , pieh = , sum = ;
var Pros = dc.Projects.Where(p => p.DepartmentID != null);
sum = Pros.Count();
int a = ;
float j = ;
foreach (var dep in Deps)
{
var Prods = dc.Projects.Where(p => p.DepartmentID.Equals(dep.PropertyValue));
//计算角度
float angle = Convert.ToSingle(( / Convert.ToSingle(sum)) * Convert.ToSingle(Prods.Count()));
//绘制员工所占比例
//FieldInfo fi = type.GetField("ddd" + i.ToString());
//temp += fi.GetValue(this).ToString();
//Type type = this.GetType();
//Brush fi = (Brush)type.GetField("brush" + a.ToString());
g.FillPie(brs[a], piex, piey, piew, pieh, j, angle);
a++;
j = j + angle;
} //绘制标识
g.DrawRectangle(pen1, , , , ); //绘制范围框
//绘制小矩形
int le = , b = ;
foreach (var dep in Deps)
{
var Prods = dc.Projects.Where(p => p.DepartmentID.Equals(dep.PropertyValue));
g.FillRectangle(brs[b], , le, , );
g.DrawString("" + dep.PropertyMeaning + "员工占公司总人数比例:" + Convert.ToSingle(Prods.Count()) * / Convert.ToSingle(sum) + "%", font2, brs[b], , le);
le += ;
b++;
}
}
catch (Exception ex)
{
throw new Exception("有错!!!");
}
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
Response.ClearContent();
Response.ContentType = "image/Png";
Response.BinaryWrite(ms.ToArray());
g.Dispose();
bitmap.Dispose();
Response.End();