如何利用.net 绘制一个饼图?
我根据这个例子:
http://www.opent.cn/a/101/2367.shtml
绘制了柱形图,
请问如何绘制饼图?
------解决方案--------------------
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" Debug="true" %>
<!-- for .Net Framework 2.0 -->
<%@ Import Namespace="System.Drawing" %>
<script runat="server" language="c#">
void Page_Load(object sender, EventArgs e){
  Bitmap image = new Bitmap(440,300);
  Graphics g = Graphics.FromImage(image);    
  g.Clear(Color.White);    
  Rectangle outline = new Rectangle(10, 10, 420, 240);    
  g.DrawEllipse(new Pen(Color.Black, 4f), outline);
  //create data  
  int[] b = new int[]{1565, 486, 5896, 1449};
  float count = b[0] + b[1] + b[2] + b[3];
  float[] c = new float[]{(b[0]/count), (b[1]/count), (b[2]/count), (b[3]/count)};
  float[] a = new float[]{(360 * c[0]), (360 * c[1]), (360 * c[2]), (360 * c[3])};    
  //make   area pie
  g.FillPie(new SolidBrush(Color.Red), outline, 0f, a[0]);
  g.FillPie(new SolidBrush(Color.Yellow), outline, a[0], a[1]);
  g.FillPie(new SolidBrush(Color.Blue), outline, (a[0] + a[1]), a[2]);
  g.FillPie(new SolidBrush(Color.Green), outline, (a[0] + a[1] + a[2]), a[3]);    
  //make color note start---
  g.DrawRectangle(new Pen(Color.Black, 1f), new Rectangle(10, 260, 10, 10));
  g.FillRectangle(new SolidBrush(Color.Red), 10, 260, 10, 10);
  g.DrawString("1item:" + b[0].ToString(), new Font("Black", 10), new SolidBrush(Color.Black), 25, 260);    
  g.DrawRectangle(new Pen(Color.Black, 1f), new Rectangle(110, 260, 10, 10));
  g.FillRectangle(new SolidBrush(Color.Yellow), 110, 260, 10, 10);
  g.DrawString("2item:" + b[1].ToString(), new Font("Black", 10), new SolidBrush(Color.Black), 125, 260);    
  g.DrawRectangle(new Pen(Color.Black, 1f), new Rectangle(210, 260, 10, 10));
  g.FillRectangle(new SolidBrush(Color.Blue), 210, 260, 10, 10);
  g.DrawString("3item:" + b[2].ToString(), new Font("Black", 10), new SolidBrush(Color.Black), 225, 260);    
  g.DrawRectangle(new Pen(Color.Black, 1f), new Rectangle(310, 260, 10, 10));
  g.FillRectangle(new SolidBrush(Color.Green), 310, 260, 10, 10);
  g.DrawString("4item:s" + b[3].ToString(), new Font("Black", 10), new SolidBrush(Color.Black), 325, 260);
  //make color note end---    
  //mark string
  g.DrawString(".Net Drawing", new Font("Arial Black", 20), new SolidBrush(Color.White), 100, 80);    
  image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
  //Response.Write(a[0]+"/"+a[1]+"/"+a[2]+"/"+a[3]);
  //Response.Write((b[0]/(float)count*100));
  Response.ContentType="Image/Gif";
}
</script>
------解决方案--------------------zedgraph,ms chart,OWC都可
柱状图, 折线图, 扇形图
------解决方案--------------------我用的是webchart.dll控件,根据从数据库中读出的数据,可以生成饼图或其它的图形。