楼主的问题太笼统了,给你个代码示例自己参考下:using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Owc11;
using System.Data;namespace Common
{
    public class OWCChart
    {
        #region 私有变量和公有属性        private string _picPath;
        /// <summary>
        /// 图片保存路径
        /// </summary>
        public string PicPath
        {
            get { return _picPath; }
            set { _picPath = value; }
        }        private string _title;
        /// <summary>
        /// 标题名
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }        private string _seriesname;
        /// <summary>
        /// 图例
        /// </summary>
        public string Seriesname
        {
            get { return _seriesname; }
            set { _seriesname = value; }
        }        private int _picwidth;
        /// <summary>
        /// 图形宽度
        /// </summary>
        public int Picwidth
        {
            get { return _picwidth; }
            set { _picwidth = value; }
        }        private int _picheght;
        /// <summary>
        /// 图形高度
        /// </summary>
        public int Picheght
        {
            get { return _picheght; }
            set { _picheght = value; }
        }        private DataTable _datasource;
        /// <summary>
        /// 数据源
        /// </summary>
        public DataTable Datasource
        {
            get { return _datasource; }
            set
            {
                _datasource = value;
                strCategory = GetColumnsStr(_datasource);
                strValue = GetValueStr(_datasource);
            }
        }        private ChartChartTypeEnum _chartType;
        /// <summary>
        /// 图表样式
        /// </summary>
        public ChartChartTypeEnum ChartType
        {
            get { return _chartType; }
            set { _chartType = value; }
        }        private string _color;
        /// <summary>
        /// 色彩
        /// </summary>
        public string Color
        {
            get { return _color; }
            set { _color = value; }
        }        private string strCategory;
        private string strValue;        private string _x;
        /// <summary>
        /// X轴的说明
        /// </summary>
        public string X
        {
            get { return _x; }
            set { _x = value; }
        }        private string _y;
        /// <summary>
        /// Y轴的说明
        /// </summary>
        public string Y
        {
            get { return _y; }
            set { _y = value; }
        }        #endregion        #region 方法        private string GetColumnsStr(DataTable dt)
        {
            StringBuilder strList = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                strList.Append(dr[1] + "" + '\t');
            }
            return strList.ToString();
        }        private string GetValueStr(DataTable dt)
        {
            StringBuilder strList = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                strList.Append(dr[0] + "" + '\t');
            }
            return strList.ToString();
        }        /// <summary>
        /// 创建报表
        /// </summary>
        public void CreateChart(System.Windows.Forms.PictureBox pic)
        {
            //创建一个图形容器对象
            ChartSpace objCSpace = new ChartSpaceClass();
            //在图形容器中增加一个图形对象
            ChChart objChart = objCSpace.Charts.Add(0);
            //图表样式
            objChart.Type = _chartType;            //显示标题
            objChart.HasTitle = true;
            //设置标题的各种属性
            objChart.Title.Caption = _title;
            objChart.Title.Font.Color = _color;
            objChart.Title.Font.Bold = true;
            objChart.Title.Font.Size = 15;
            objChart.Title.Font.Name = "Verdana";            //显示图例
            objChart.HasLegend = true;
            //样式设置
            ChSeries chSeries = objChart.SeriesCollection.Add(0);         
            chSeries.Border.Color = "#536e92";            objChart.PlotArea.Interior.Color = "#DCEAFC";
            objChart.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#d5e0f1", "#fdfefe");
            objChart.Border.Color = "#1a3b69";
            objChart.PlotArea.Border.Color = "#b1b9c6";            if (_chartType == ChartChartTypeEnum.chChartTypeColumnClustered3D)
            {
                objChart.Inclination = 10;   //表示指定三维图表的视图斜率。有效范围为 -90 到 90
                objChart.Rotation = 5;      //表示指定三维图表的旋转角度                chSeries.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#5699f0", "#a2c7f7");                objChart.Axes[0].HasTitle = true;
                objChart.Axes[0].Title.Caption = _x;
                objChart.Axes[1].HasTitle = true;
                objChart.Axes[1].Title.Caption = _y;
                objChart.Axes[0].Title.Font.Color = "#1a3b69";
                objChart.Axes[1].Title.Font.Color = "#1a3b69";                for (int i = 0; i < objChart.Axes.Count; i++)
                {
                    objChart.Axes[i].HasMajorGridlines = true;
                    objChart.Axes[i].HasMinorGridlines = false;
                    objChart.Axes[i].Line.Color = "#b1b9c6";
                    objChart.Axes[i].MajorGridlines.Line.Color = "#b1b9c6";
                    objChart.Axes[i].Font.Name = "Verdana";
                    objChart.Axes[i].Font.Size = 8;
                    objChart.Axes[i].Font.Color = "#1a3b69";                }
            }
            //给定系列的名字
            chSeries.SetData(ChartDimensionsEnum.chDimSeriesNames, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), _seriesname);
            //给定分类
            chSeries.SetData(ChartDimensionsEnum.chDimCategories, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory);
            //给定值
            chSeries.SetData(ChartDimensionsEnum.chDimValues, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strValue);            ChDataLabels chDataLab = objChart.SeriesCollection[0].DataLabelsCollection.Add();
            chDataLab.HasValue = true;
            //chDataLab.HasPercentage = true;            string fileName = "chartPic.gif";
            string strAbsolutePath = _picPath + "\\" + fileName;
            objCSpace.ExportPicture(strAbsolutePath, "GIF", _picwidth, _picheght);
            pic.ImageLocation = strAbsolutePath;
        }
        #endregion
    }
}

解决方案 »

  1.   

    水晶报表
    rdlc
    fastreport
      

  2.   

    可以试试DevExpress控件库,感觉还是不错。
      

  3.   

    楼主的问题太笼统了,给你个代码示例自己参考下:
    C# code
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Office.Interop.Owc11;
    using System.Data;namespace Common
    {
        public class OWCChart
        {
            #region 私有变量和公有属性        private string _picPath;
            /// <summary>
            /// 图片保存路径
            /// </summary>
            public string PicPath
            {
                get { return _picPath; }
                set { _picPath = value; }
            }        private string _title;
            /// <summary>
            /// 标题名
            /// </summary>
            public string Title
            {
                get { return _title; }
                set { _title = value; }
            }        private string _seriesname;
            /// <summary>
            /// 图例
            /// </summary>
            public string Seriesname
            {
                get { return _seriesname; }
                set { _seriesname = value; }
            }        private int _picwidth;
            /// <summary>
            /// 图形宽度
            /// </summary>
            public int Picwidth
            {
                get { return _picwidth; }
                set { _picwidth = value; }
            }        private int _picheght;
            /// <summary>
            /// 图形高度
            /// </summary>
            public int Picheght
            {
                get { return _picheght; }
                set { _picheght = value; }
            }        private DataTable _datasource;
            /// <summary>
            /// 数据源
            /// </summary>
            public DataTable Datasource
            {
                get { return _datasource; }
                set
                {
                    _datasource = value;
                    strCategory = GetColumnsStr(_datasource);
                    strValue = GetValueStr(_datasource);
                }
            }        private ChartChartTypeEnum _chartType;
            /// <summary>
            /// 图表样式
            /// </summary>
            public ChartChartTypeEnum ChartType
            {
                get { return _chartType; }
                set { _chartType = value; }
            }        private string _color;
            /// <summary>
            /// 色彩
            /// </summary>
            public string Color
            {
                get { return _color; }
                set { _color = value; }
            }        private string strCategory;
            private string strValue;        private string _x;
            /// <summary>
            /// X轴的说明
            /// </summary>
            public string X
            {
                get { return _x; }
                set { _x = value; }
            }        private string _y;
            /// <summary>
            /// Y轴的说明
            /// </summary>
            public string Y
            {
                get { return _y; }
                set { _y = value; }
            }        #endregion        #region 方法        private string GetColumnsStr(DataTable dt)
            {
                StringBuilder strList = new StringBuilder();
                foreach (DataRow dr in dt.Rows)
                {
                    strList.Append(dr[1] + "" + '\t');
                }
                return strList.ToString();
            }        private string GetValueStr(DataTable dt)
            {
                StringBuilder strList = new StringBuilder();
                foreach (DataRow dr in dt.Rows)
                {
                    strList.Append(dr[0] + "" + '\t');
                }
                return strList.ToString();
            }        /// <summary>
            /// 创建报表
            /// </summary>
            public void CreateChart(System.Windows.Forms.PictureBox pic)
            {
                //创建一个图形容器对象
                ChartSpace objCSpace = new ChartSpaceClass();
                //在图形容器中增加一个图形对象
                ChChart objChart = objCSpace.Charts.Add(0);
                //图表样式
                objChart.Type = _chartType;            //显示标题
                objChart.HasTitle = true;
                //设置标题的各种属性
                objChart.Title.Caption = _title;
                objChart.Title.Font.Color = _color;
                objChart.Title.Font.Bold = true;
                objChart.Title.Font.Size = 15;
                objChart.Title.Font.Name = "Verdana";            //显示图例
                objChart.HasLegend = true;
                //样式设置
                ChSeries chSeries = objChart.SeriesCollection.Add(0);         
                chSeries.Border.Color = "#536e92";            objChart.PlotArea.Interior.Color = "#DCEAFC";
                objChart.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#d5e0f1", "#fdfefe");
                objChart.Border.Color = "#1a3b69";
                objChart.PlotArea.Border.Color = "#b1b9c6";            if (_chartType == ChartChartTypeEnum.chChartTypeColumnClustered3D)
                {
                    objChart.Inclination = 10;   //表示指定三维图表的视图斜率。有效范围为 -90 到 90
                    objChart.Rotation = 5;      //表示指定三维图表的旋转角度                chSeries.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#5699f0", "#a2c7f7");                objChart.Axes[0].HasTitle = true;
                    objChart.Axes[0].Title.Caption = _x;
                    objChart.Axes[1].HasTitle = true;
                    objChart.Axes[1].Title.Caption = _y;
                    objChart.Axes[0].Title.Font.Color = "#1a3b69";
                    objChart.Axes[1].Title.Font.Color = "#1a3b69";                for (int i = 0; i < objChart.Axes.Count; i++)
                    {
                        objChart.Axes[i].HasMajorGridlines = true;
                        objChart.Axes[i].HasMinorGridlines = false;
                        objChart.Axes[i].Line.Color = "#b1b9c6";
                        objChart.Axes[i].MajorGridlines.Line.Color = "#b1b9c6";
                        objChart.Axes[i].Font.Name = "Verdana";
                        objChart.Axes[i].Font.Size = 8;
                        objChart.Axes[i].Font.Color = "#1a3b69";                }
                }
                //给定系列的名字
                chSeries.SetData(ChartDimensionsEnum.chDimSeriesNames, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), _seriesname);
                //给定分类
                chSeries.SetData(ChartDimensionsEnum.chDimCategories, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory);
                //给定值
                chSeries.SetData(ChartDimensionsEnum.chDimValues, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strValue);            ChDataLabels chDataLab = objChart.SeriesCollection[0].DataLabelsCollection.Add();
                chDataLab.HasValue = true;
                //chDataLab.HasPercentage = true;            string fileName = "chartPic.gif";
                string strAbsolutePath = _picPath + "\\" + fileName;
                objCSpace.ExportPicture(strAbsolutePath, "GIF", _picwidth, _picheght);
                pic.ImageLocation = strAbsolutePath;
            }
            #endregion
        }
    }
      

  4.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Office.Interop.Owc11;
    using System.Data;namespace Common
    {
        public class OWCChart
        {
            #region 私有变量和公有属性        private string _picPath;
            /// <summary>
            /// 图片保存路径
            /// </summary>
            public string PicPath
            {
                get { return _picPath; }
                set { _picPath = value; }
            }        private string _title;
            /// <summary>
            /// 标题名
            /// </summary>
            public string Title
            {
                get { return _title; }
                set { _title = value; }
            }        private string _seriesname;
            /// <summary>
            /// 图例
            /// </summary>
            public string Seriesname
            {
                get { return _seriesname; }
                set { _seriesname = value; }
            }        private int _picwidth;
            /// <summary>
            /// 图形宽度
            /// </summary>
            public int Picwidth
            {
                get { return _picwidth; }
                set { _picwidth = value; }
            }        private int _picheght;
            /// <summary>
            /// 图形高度
            /// </summary>
            public int Picheght
            {
                get { return _picheght; }
                set { _picheght = value; }
            }        private DataTable _datasource;
            /// <summary>
            /// 数据源
            /// </summary>
            public DataTable Datasource
            {
                get { return _datasource; }
                set
                {
                    _datasource = value;
                    strCategory = GetColumnsStr(_datasource);
                    strValue = GetValueStr(_datasource);
                }
            }        private ChartChartTypeEnum _chartType;
            /// <summary>
            /// 图表样式
            /// </summary>
            public ChartChartTypeEnum ChartType
            {
                get { return _chartType; }
                set { _chartType = value; }
            }        private string _color;
            /// <summary>
            /// 色彩
            /// </summary>
            public string Color
            {
                get { return _color; }
                set { _color = value; }
            }        private string strCategory;
            private string strValue;        private string _x;
            /// <summary>
            /// X轴的说明
            /// </summary>
            public string X
            {
                get { return _x; }
                set { _x = value; }
            }        private string _y;
            /// <summary>
            /// Y轴的说明
            /// </summary>
            public string Y
            {
                get { return _y; }
                set { _y = value; }
            }        #endregion        #region 方法        private string GetColumnsStr(DataTable dt)
            {
                StringBuilder strList = new StringBuilder();
                foreach (DataRow dr in dt.Rows)
                {
                    strList.Append(dr[1] + "" + '\t');
                }
                return strList.ToString();
            }        private string GetValueStr(DataTable dt)
            {
                StringBuilder strList = new StringBuilder();
                foreach (DataRow dr in dt.Rows)
                {
                    strList.Append(dr[0] + "" + '\t');
                }
                return strList.ToString();
            }        /// <summary>
            /// 创建报表
            /// </summary>
            public void CreateChart(System.Windows.Forms.PictureBox pic)
            {
                //创建一个图形容器对象
                ChartSpace objCSpace = new ChartSpaceClass();
                //在图形容器中增加一个图形对象
                ChChart objChart = objCSpace.Charts.Add(0);
                //图表样式
                objChart.Type = _chartType;            //显示标题
                objChart.HasTitle = true;
                //设置标题的各种属性
                objChart.Title.Caption = _title;
                objChart.Title.Font.Color = _color;
                objChart.Title.Font.Bold = true;
                objChart.Title.Font.Size = 15;
                objChart.Title.Font.Name = "Verdana";            //显示图例
                objChart.HasLegend = true;
                //样式设置
                ChSeries chSeries = objChart.SeriesCollection.Add(0);         
                chSeries.Border.Color = "#536e92";            objChart.PlotArea.Interior.Color = "#DCEAFC";
                objChart.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#d5e0f1", "#fdfefe");
                objChart.Border.Color = "#1a3b69";
                objChart.PlotArea.Border.Color = "#b1b9c6";            if (_chartType == ChartChartTypeEnum.chChartTypeColumnClustered3D)
                {
                    objChart.Inclination = 10;   //表示指定三维图表的视图斜率。有效范围为 -90 到 90
                    objChart.Rotation = 5;      //表示指定三维图表的旋转角度                chSeries.Interior.SetTwoColorGradient(ChartGradientStyleEnum.chGradientFromCorner, ChartGradientVariantEnum.chGradientVariantStart, "#5699f0", "#a2c7f7");                objChart.Axes[0].HasTitle = true;
                    objChart.Axes[0].Title.Caption = _x;
                    objChart.Axes[1].HasTitle = true;
                    objChart.Axes[1].Title.Caption = _y;
                    objChart.Axes[0].Title.Font.Color = "#1a3b69";
                    objChart.Axes[1].Title.Font.Color = "#1a3b69";                for (int i = 0; i < objChart.Axes.Count; i++)
                    {
                        objChart.Axes[i].HasMajorGridlines = true;
                        objChart.Axes[i].HasMinorGridlines = false;
                        objChart.Axes[i].Line.Color = "#b1b9c6";
                        objChart.Axes[i].MajorGridlines.Line.Color = "#b1b9c6";
                        objChart.Axes[i].Font.Name = "Verdana";
                        objChart.Axes[i].Font.Size = 8;
                        objChart.Axes[i].Font.Color = "#1a3b69";                }
                }
                //给定系列的名字
                chSeries.SetData(ChartDimensionsEnum.chDimSeriesNames, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), _seriesname);
                //给定分类
                chSeries.SetData(ChartDimensionsEnum.chDimCategories, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory);
                //给定值
                chSeries.SetData(ChartDimensionsEnum.chDimValues, ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strValue);            ChDataLabels chDataLab = objChart.SeriesCollection[0].DataLabelsCollection.Add();
                chDataLab.HasValue = true;
                //chDataLab.HasPercentage = true;            string fileName = "chartPic.gif";
                string strAbsolutePath = _picPath + "\\" + fileName;
                objCSpace.ExportPicture(strAbsolutePath, "GIF", _picwidth, _picheght);
                pic.ImageLocation = strAbsolutePath;
            }
            #endregion
        }
    }
      

  5.   

    http://blog.csdn.net/dunao/archive/2009/02/05/3865053.aspx
      

  6.   

    水晶报表
    rdlc
    fastreport