由于公司要用.NET 1.1做一个图,在网上没有找到好的插件的情况下。
于是从网上找了些GDI的代码自己画了个图。
采用Vs 2003中ArrayList作数据源
效果如下:
Code:
使用方法:
System.Random rd=new Random();
Color [] colorList=new Color []{Color.PaleGoldenrod, Color.RosyBrown, Color.Plum, Color.SaddleBrown};
string [] TypeNameList=new string[]{"International", "DES. Local", "SHA. Local", "DUTY"};
string fileName = DateTime.Now.ToString("yyyyMMddHHss") + rd.Next(2000, 8888888).ToString()+ ".gif";
DrawChart.DrawHistogram chart2=new DrawChart.DrawHistogram("test",400,400,Color.White);
chart2.BindValue("SUN",new float[]{20,30,11,22});
chart2.BindValue("DELL",new float[]{40,10,21,52});
chart2.FilePath = "TempImage";
chart2.ColorList = colorList;
chart2.TypeNameList = TypeNameList;
chart2.FileName = fileName;
chart2.FontName = "Arial";
chart2.Precision = 2;
chart2.Distance = 40;
chart2.Scale = 100;
chart2.DrawChart();
chart2.ID="SSS";
chart2.ShowTip = true;
Panel1.Controls.Add(chart2);