GDI—绘图之-曲线图-柱状图-直方图
使用VS2003-GDI绘制的曲线图
使用VS2003-GDI绘制的柱状图
使用VS2003-GDI绘制的直方图
使用VS2003-GDI绘制的曲线图
曲线图
DrawChart.PolyLine chart4=new DrawChart.PolyLine("趨勢圖",800,320,System.Drawing.Color.FromArgb(241, 241, 241));
chart4.BindValue("A",232.33f);
chart4.BindValue("B",83.30f);
chart4.BindValue("C",200f);
chart4.BindValue("D",100f);
chart4.FilePath = "TempImage";
chart4.FileName = fileName+"chart4";
chart4.FontName = "Arial";
chart4.Precision = 2;
chart4.Distance = 40;
chart4.Scale = 50f;
chart4.ShowTip = true;
chart4.PointDiameter=2f;
chart4.LineWidth=2f;
chart4.LineColor=Color.Green;
chart4.PointColor=Color.Red;
//chart2.DrawChart();
chart4.ID="SADADA";
Panel1.Controls.Add(chart4);
DrawChart.PolyLine chart4=new DrawChart.PolyLine("趨勢圖",800,320,System.Drawing.Color.FromArgb(241, 241, 241));
chart4.BindValue("A",232.33f);
chart4.BindValue("B",83.30f);
chart4.BindValue("C",200f);
chart4.BindValue("D",100f);
chart4.FilePath = "TempImage";
chart4.FileName = fileName+"chart4";
chart4.FontName = "Arial";
chart4.Precision = 2;
chart4.Distance = 40;
chart4.Scale = 50f;
chart4.ShowTip = true;
chart4.PointDiameter=2f;
chart4.LineWidth=2f;
chart4.LineColor=Color.Green;
chart4.PointColor=Color.Red;
//chart2.DrawChart();
chart4.ID="SADADA";
Panel1.Controls.Add(chart4);
使用VS2003-GDI绘制的柱状图
柱状图
DrawChart.ArrayHistogram chart3=new DrawChart.ArrayHistogram("趨勢圖",800,320,System.Drawing.Color.FromArgb(241, 241, 241));
chart3.BindValue("A",232.33f);
chart3.BindValue("B",83.30f);
chart3.BindValue("C",200f);
chart3.BindValue("D",100f);
chart3.FilePath = "TempImage";
chart3.ColorList = colorList;
chart3.TypeNameList = TypeNameList;
chart3.FileName = fileName+"chart3";
chart3.FontName = "Arial";
chart3.Precision = 2;
chart3.Distance = 40;
chart3.Scale = 50f;
chart3.ShowTip = true;
chart3.IsGradient=true;
chart3.ID="SADADA";
Panel1.Controls.Add(chart3);
DrawChart.ArrayHistogram chart3=new DrawChart.ArrayHistogram("趨勢圖",800,320,System.Drawing.Color.FromArgb(241, 241, 241));
chart3.BindValue("A",232.33f);
chart3.BindValue("B",83.30f);
chart3.BindValue("C",200f);
chart3.BindValue("D",100f);
chart3.FilePath = "TempImage";
chart3.ColorList = colorList;
chart3.TypeNameList = TypeNameList;
chart3.FileName = fileName+"chart3";
chart3.FontName = "Arial";
chart3.Precision = 2;
chart3.Distance = 40;
chart3.Scale = 50f;
chart3.ShowTip = true;
chart3.IsGradient=true;
chart3.ID="SADADA";
Panel1.Controls.Add(chart3);
使用VS2003-GDI绘制的直方图
直方图
System.Random rd=new Random();
Color cr=Color.FromArgb(44,18,126);
Color [] colorList=new Color []{Color.FromArgb(41, 83, 206), Color.FromArgb(155, 155, 0), Color.FromArgb(93, 124, 124), Color.FromArgb(180, 73, 0)};
string [] TypeNameList=new string[]{"T1", "T2", "T3", "T4"};
string fileName = DateTime.Now.ToString("yyyyMMddHHss") + rd.Next(2000, 8888888).ToString()+ ".gif";
DrawChart.DrawHistogram chart2=new DrawChart.DrawHistogram("趨勢圖",800,420,System.Drawing.Color.FromArgb(241, 241, 241) );
chart2.BindValue("A",new float[]{0.3322f,0.1670f,0.2508f,0.2500f});
chart2.BindValue("B",new float[]{0.1000f,0.1002f,0.1998f,0.600f});
chart2.BindValue("C",new float[]{0.1f,0.25f,0.0f,0.65f});
chart2.BindValue("D",new float[]{0.205f,0.3f,0.0f,0.495f});
chart2.FilePath = "TempImage";
chart2.ColorList = colorList;
chart2.TypeNameList = TypeNameList;
chart2.FileName = fileName;
chart2.FontName = "Arial";
chart2.Precision = 2;
chart2.Distance = 40;
chart2.Scale = 1f;
chart2.ShowTip = true;
chart2.IsPercent=true;
chart2.IsGradient=true;
//chart2.DrawChart();
chart2.ID="SSS";
Panel1.Controls.Add(chart2);
System.Random rd=new Random();
Color cr=Color.FromArgb(44,18,126);
Color [] colorList=new Color []{Color.FromArgb(41, 83, 206), Color.FromArgb(155, 155, 0), Color.FromArgb(93, 124, 124), Color.FromArgb(180, 73, 0)};
string [] TypeNameList=new string[]{"T1", "T2", "T3", "T4"};
string fileName = DateTime.Now.ToString("yyyyMMddHHss") + rd.Next(2000, 8888888).ToString()+ ".gif";
DrawChart.DrawHistogram chart2=new DrawChart.DrawHistogram("趨勢圖",800,420,System.Drawing.Color.FromArgb(241, 241, 241) );
chart2.BindValue("A",new float[]{0.3322f,0.1670f,0.2508f,0.2500f});
chart2.BindValue("B",new float[]{0.1000f,0.1002f,0.1998f,0.600f});
chart2.BindValue("C",new float[]{0.1f,0.25f,0.0f,0.65f});
chart2.BindValue("D",new float[]{0.205f,0.3f,0.0f,0.495f});
chart2.FilePath = "TempImage";
chart2.ColorList = colorList;
chart2.TypeNameList = TypeNameList;
chart2.FileName = fileName;
chart2.FontName = "Arial";
chart2.Precision = 2;
chart2.Distance = 40;
chart2.Scale = 1f;
chart2.ShowTip = true;
chart2.IsPercent=true;
chart2.IsGradient=true;
//chart2.DrawChart();
chart2.ID="SSS";
Panel1.Controls.Add(chart2);
希望在无法使用了VS2003以后版本的能用上
代码如下: