首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

百分跪求ASP.net 能画饼图的控件或代码!

2013-03-19 
百分跪求ASP.net能画饼图的控件或代码!!!!!在线等。。。如题,我想在web程序中画一个折线统计图或饼图。。。。跪求

百分跪求ASP.net 能画饼图的控件或代码!!!!!在线等。。。
如题,我想在web程序中画一个折线统计图或饼图。。。。跪求大神出手,源码,第三方控件什么的都行,求实现!!!本人新手一个。。。在线等!!!! asp.net web 统计图??饼图
[解决办法]
在ASP.NET页面中实现数据饼图
[解决办法]
有MSChart控件,你试试
[解决办法]
你可以试试第三方图表控件ChartDirector,使用简单,图表精细,尤其适合用于Web图表开发
参考用ChartDirector绘制饼图
[解决办法]
dotnetCHARTING


[解决办法]
open flash Chart
[解决办法]
MSCHART控件 

 private void draw01()//houdu1
        {
            string connStr = ConfigurationManager.ConnectionStrings["connStr"].ToString();
            using (OleDbConnection conn = new OleDbConnection(connStr))
            {

                conn.Open();
                DataSet ds = new DataSet();
                OleDbDataAdapter da = new OleDbDataAdapter();
                string com = "select top 8 [ID],[DateAndTime],[HouDu1] from [No1Gear] order by [ID] desc ";

                TextBox4.Attributes.Add("onkeypress", "this.value = this.value.replace(/[^0-9]/g,'')");
                string com2 = "select top " + TextBox4.Text.ToString() + " [ID],[DateAndTime],[HouDu1] from [No1Gear] order by [ID] desc";
                int num;
                if (TextBox4.Text.ToString() == "" 
[解决办法]
 TextBox4.Text.ToString() == "0")
                {
                    da.SelectCommand = new OleDbCommand(com, conn);
                    num = 0;
                }
                else
                {
                    da.SelectCommand = new OleDbCommand(com2, conn);


                    num = Convert.ToInt32(TextBox4.Text.ToString());
                }

                da.Fill(ds);
                Chart1.DataSource = ds;
                Chart1.Titles.Clear();
                Chart1.Series.Clear();
                Chart1.ChartAreas.Clear();
                Chart1.Legends.Clear();
                string s1 = "1#测点";
                Chart1.ChartAreas.Add("1#测点");
                Chart1.Series.Add(s1);
                Chart1.Series[s1].ChartType = SeriesChartType.Line;
                Chart1.Series[s1].Color = Color.Tomato;
                if (num > 40)
                {
                    Chart1.Series[s1].IsValueShownAsLabel = false;
                    Chart1.ChartAreas[s1].AxisX.IntervalOffset = 1;
                    Chart1.ChartAreas[s1].AxisX.Interval = 10;
                }
                else if (num >= 20 && num <= 40)
                {
                    Chart1.Series[s1].IsValueShownAsLabel = false;
                    Chart1.ChartAreas[s1].AxisX.IntervalOffset = 1;
                    Chart1.ChartAreas[s1].AxisX.Interval = 5;
                }
                else if (num < 20 && num > 8)
                {
                    Chart1.Series[s1].IsValueShownAsLabel = true;
                    Chart1.ChartAreas[s1].AxisX.IntervalOffset = 1;


                    Chart1.ChartAreas[s1].AxisX.Interval = 2;
                }
                else if (num <= 8)
                {
                    Chart1.Series[s1].IsValueShownAsLabel = true;
                    Chart1.ChartAreas[s1].AxisX.IntervalOffset = 1;
                    Chart1.ChartAreas[s1].AxisX.Interval = 2;
                }

                Chart1.Series[s1].BorderWidth = 2;
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    string colName = ds.Tables[0].Columns[1].ColumnName;
                    string date = row[colName].ToString();
                    string tmp = ds.Tables[0].Columns[2].ColumnName;
                    string test = row[tmp].ToString();


                    Chart1.Series[s1].Points.AddXY(date, test);
                }
                ds.Clear();
            }
        }


这是我以前写的一个折现图 你感受一下 涨涨姿势
[解决办法]
网上看到的,页面只要一个PictureBox控件

private void CreateImage(PictureBox Picturebox)
        {
            float Total = 0.0f, Tmp;
            //转换成单精度。也可写成Convert.ToInt32
            Total = Convert.ToSingle(94.0);
            //设置字体,fonttitle为主标题的字体
            Font fontlegend = new Font("verdana", 9);
            Font fonttitle = new Font("verdana", 10, FontStyle.Bold);
            //背景宽
            int width = 350;


            int bufferspace = 15;
            int legendheight = fontlegend.Height * 10 + bufferspace; //高度
            int titleheight = fonttitle.Height + bufferspace;
            int height = width + legendheight + titleheight + bufferspace;//白色背景高
            int pieheight = width;
            Rectangle pierect = new Rectangle(0, titleheight, width, pieheight);
            //加上各种随机色
            System.Collections.ArrayList colors = new System.Collections.ArrayList(); 
            Random rnd = new Random();
            for (int i = 0; i < 2; i++) colors.Add(new SolidBrush(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))));
            //创建一个bitmap实例
            Bitmap objbitmap = new Bitmap(width, height);
            Graphics objgraphics = Graphics.FromImage(objbitmap);
            //画一个白色背景
            objgraphics.FillRectangle(new SolidBrush(Color.White), 0, 0, width, height);
            //画一个亮黄色背景 
            objgraphics.FillRectangle(new SolidBrush(Color.Beige), pierect);
            //以下为画饼图(有几行row画几个)
            float currentdegree = 0.0f;
            //画通过人数
            objgraphics.FillPie((SolidBrush)colors[1], pierect, currentdegree,Convert.ToSingle( 82.0) / Total * 360);
            currentdegree += Convert.ToSingle(82.0) / Total * 360;
            //未通过人数饼状图
            objgraphics.FillPie((SolidBrush)colors[0], pierect, currentdegree,((Convert.ToSingle(94.0)) - (Convert.ToSingle(82.0))) / Total * 360);
            currentdegree += ((Convert.ToSingle(94.0)) - (Convert.ToSingle(82.0))) / Total * 360;

            //以下为生成主标题
            SolidBrush blackbrush = new SolidBrush(Color.Black);
            SolidBrush bluebrush = new SolidBrush(Color.Blue);


            string title = " 机关单位成绩统计饼状图: " + "\n \n\n";
            StringFormat stringFormat = new StringFormat();
            stringFormat.Alignment = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;
            objgraphics.DrawString(title, fonttitle, blackbrush, new Rectangle(0, 0, width, titleheight), stringFormat);
            //列出各字段与得数目
            objgraphics.DrawRectangle(new Pen(Color.Red, 2), 0, height + 10 - legendheight, width, legendheight + 50);
            objgraphics.DrawString("----------------统计信息------------------",fontlegend, bluebrush, 20, height - legendheight + fontlegend.Height * 1 + 1);
            objgraphics.DrawString("统计单位: 测试" ,fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 3 + 1);
            objgraphics.DrawString("统计年份: 2012年",fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 4 + 1);
            objgraphics.DrawString("统计期数: 第一期",fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 5 + 1);
            objgraphics.FillRectangle((SolidBrush)colors[1], 5, height - legendheight + fontlegend.Height * 8 + 1, 10, 10);
            objgraphics.DrawString("报名总人数: " + Convert.ToString(Convert.ToSingle(94.0)), fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 7 + 1);
            objgraphics.FillRectangle((SolidBrush)colors[0], 5, height - legendheight + fontlegend.Height * 9 + 1, 10, 10);
            objgraphics.DrawString("通过总人数: " + Convert.ToString(Convert.ToSingle(82.0)), fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 8 + 1);
            objgraphics.DrawString("未通过人数: " + ((Convert.ToSingle(94.0)) - (Convert.ToSingle(82.0))), fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 9 + 1);
            objgraphics.DrawString("通过率: " + Convert.ToString((Convert.ToSingle(82.0) / Convert.ToSingle(94.0)) * 100) + " %", fontlegend, blackbrush, 20, height - legendheight + fontlegend.Height * 10 + 1);
            //Response.ContentType = "image/Jpeg";


            //objbitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
            pictureBox1.Width = objbitmap.Width;
            pictureBox1.Height = objbitmap.Height;
            objgraphics.Dispose();
            //objbitmap.Dispose();
            pictureBox1.Width = objbitmap.Width;
            pictureBox1.BackgroundImage = objbitmap;
        } 
[解决办法]

引用:
在ASP.NET页面中实现数据饼图

这个不错 解释的很清楚
[解决办法]
fusionchart
[解决办法]
MS Chart 就可以了 网上资料不少
[解决办法]
http://img.my.csdn.net/uploads/201303/18/1363600402_7133.jpg

自带源代码 

热点排行