九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項超值服

開通VIP
關(guān)于C#操作EXCEL,生成圖表的全面應(yīng)用之二(利用Microsoft.Office.In...
 關(guān)于C#操作EXCEL,生成圖表的全面應(yīng)用之二(利用Microsoft.Office.Interop.OWC11) 收藏
續(xù)上篇,介紹OWC11的應(yīng)用:
        開發(fā)者:Gailzhao 
        EMail:gailzhao@sohu.com
 
        另添加引用
        using OWC = Microsoft.Office.Interop.Owc11;
 
        public void DataTableToSheet(string title, DataTable dt, Excel._Worksheet m_Sheet,
                                    Excel._Workbook m_Book,   int startrow)
        {
            。。。。。。(同上篇)。。。。。。
                //使用OWC11組件畫圖
                showChart(OWC.ChartChartTypeEnum.chChartTypeLine);  //生成圖表文件
                //將圖表文件插入到EXCEL文檔中
                m_Sheet.Shapes.AddPicture("E:\\chart.gif", MsoTriState.msoFalse, MsoTriState.msoTrue, 250, 100, 350, 250 );

        }
    private void showChart(OWC.ChartChartTypeEnum Type)
        {
            OWC.ChartChartTypeEnum _Type;
            OWC.ChartSpace axChartSpace1 = new OWC.ChartSpaceClass();
            try
            {
                axChartSpace1.Clear();
                OWC.ChChart objChart = axChartSpace1.Charts.Add(0);
                OWC.ChAxis axis = objChart.Axes[0];   //X軸
                OWC.ChAxis axis1 = objChart.Axes[1];  //Y軸
                objChart.Type = Type;
                objChart.HasLegend = true;
                objChart.Legend.Position = OWC.ChartLegendPositionEnum.chLegendPositionTop;
                //objChart.HasTitle = true;
                //objChart.Title.Caption = "凈值指數(shù)圖";
                //objChart.Axes[0].HasTitle = true ;
                //objChart.Axes[0].Title.Caption = "日期";
                //objChart.Axes[1].HasTitle = true;
                //objChart.Axes[1].Title.Caption = "數(shù)值";
                objChart.SeriesCollection.Add(0);
                objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimSeriesNames,
                 +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "開放式基金");
                DataSet ds = ScData.ListData("exec zb_LiCaiZhouBao " + int.Parse(txtStartDate.Text.Replace("-","") ) + ",1");
                string X_Value1 = "";
                string X_Value2 = "";
                string Y_Value = "";
                if (ds.Tables.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                       // Console.WriteLine(dr["日期"].ToString());
                        Y_Value = Y_Value + dr["日期"].ToString() + '\t';
                        X_Value1 = X_Value1 + dr["開放式基金"].ToString() + '\t';
                        X_Value2 = X_Value2 + dr["偏股型基金"].ToString() + '\t';
                    }
                }
                objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories,
                 +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, Y_Value);
                              objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimValues,
                 (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, X_Value1);
                objChart.SeriesCollection.Add(1);
                objChart.SeriesCollection[1].SetData(OWC.ChartDimensionsEnum.chDimSeriesNames,
                 +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "偏股型基金");
                objChart.SeriesCollection[1].SetData(OWC.ChartDimensionsEnum.chDimCategories,
                 +(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, Y_Value);
                objChart.SeriesCollection[1].SetData(OWC.ChartDimensionsEnum.chDimValues,
                 (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, X_Value2);
 
                objChart.SeriesCollection[0].Line.Color = "orange";
                //objChart.SeriesCollection[0].Line.Weight = OWC.ChLine.LineWeightEnum.owcLineWeightThick;   //線條加粗
                objChart.SeriesCollection[1].Line.Color = "maroon";
                //objChart.SeriesCollection[1].Line.Weight = OWC.LineWeightEnum.owcLineWeightThick;
                axis.TickMarkSpacing = 30;
                axis.HasTickLabels = true;
                axis.TickLabelSpacing =30;
                axis1.HasMajorGridlines = true;
                axis1.MajorGridlines.Line.DashStyle = OWC.ChartLineDashStyleEnum.chLineDashDotDot;//.chLineDashDot;
                //axis1.MajorGridlines.Line.Color = "orange";
                objChart.PlotArea.Interior.Color = "LightYellow";    //圖表區(qū)的背景色
             
                // objChart.Interior.Color = "green";
              
               //objChart.Interior.BackColor = "yellow";
                //axis.TickMarkSpacing = 50;
            }
            catch (Exception ex)
            {
                //timer1.Enabled = false;
                MessageBox.Show(ex.Message);
            }
            finally
            {
                _Type = Type;
                //輸出成GIF文件.  
                string strAbsolutePath = "E:\\chart.gif"; //生成圖形文件  
                axChartSpace1.ExportPicture(strAbsolutePath, "GIF", 600, 350);
            }
        }
 
本文來自CSDN博客,轉(zhuǎn)載請標(biāo)明出處:http://blog.csdn.net/gailzhao/archive/2008/09/19/2950912.aspx
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
用OWC做統(tǒng)計圖總結(jié)
office2007缺少OWC的原因和解決方法
C# 操作 Excel 要點
簡簡單單將網(wǎng)上圖表快速導(dǎo)入Excel
C#實戰(zhàn)005:Excel操作
C#實現(xiàn)向excel中插入行列,以及設(shè)置單元格合并居中效果
更多類似文章 >>
生活服務(wù)
熱點新聞
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服