Ejemplo n.º 1
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="type">此图表所属的类型,由枚举drawingtype提供</param>
            /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="Info">图表中用来显示相关信息的那个文本框对象</param>
            /// <param name="DrawingTag">每一个监测曲线图的相关信息</param>
            /// <param name="MonitorType">监测数据的类型,比如测斜数据、立柱垂直位移数据、支撑轴力数据等</param>
            /// <remarks></remarks>
            public ClsDrawing_Mnt_Base(Excel.Worksheet DataSheet,
                                       Microsoft.Office.Interop.Excel.Chart DrawingChart, Cls_ExcelForMonitorDrawing ParentApp,
                                       DrawingType type, bool CanRoll, Excel.TextFrame2 Info,
                                       MonitorInfo DrawingTag, MntType MonitorType)
            {
                try
                {
                    //设置Excel窗口与Chart的尺寸

                    this.F_Application = ParentApp.Application;
                    ExcelFunction.SetLocation_Size(this.ChartSize_sugested, DrawingChart, this.Application, true);
                    //
                    this.Sheet_Data     = DataSheet;
                    this.F_myChart      = DrawingChart;
                    this.F_textbox_Info = Info;
                    this.Sheet_Drawing  = DrawingChart.Parent.Parent;
                    this.F_blnCanRoll   = CanRoll;
                    this.F_DrawingType  = type;
                    this.P_MntType      = MonitorType;
                    //将此对象添加进其所属的集合中
                    F_Class_ParentApp = ParentApp;
                    //
                    this.P_Key      = System.Convert.ToInt32(F_Class_ParentApp.Mnt_Drawings.Add(this));
                    this.F_UniqueID = GeneralMethods.GetUniqueID();
                    //
                    this.Tags = DrawingTag;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("创建基本监测曲线图出错。" + "\r\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
Ejemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="DataSheet">图表对应的数据工作表</param>
 /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
 /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
 /// <param name="type">此图表所属的类型,由枚举drawingtype提供</param>
 /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
 /// <param name="Info">图表中用来显示相关信息的那个文本框对象</param>
 /// <param name="DrawingTag">每一个监测曲线图的相关信息</param>
 /// <param name="MonitorType">监测数据的类型,比如测斜数据、立柱垂直位移数据、支撑轴力数据等</param>
 /// <remarks></remarks>
 public ClsDrawing_Mnt_Static(Worksheet DataSheet, Chart DrawingChart,
                              Cls_ExcelForMonitorDrawing ParentApp,
                              DrawingType type, bool CanRoll,
                              TextFrame2 Info, MonitorInfo DrawingTag, MntType MonitorType,
                              Dictionary <Series, object[]> AllselectedData, double[] arrAllDate) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType, arrAllDate)
 {
     //  -----------------------------------
     //
     this.F_dicSeries = AllselectedData;
 }
        /// <summary>
        /// 构造函数,构造时一定要设置好字典F_dicFourSeries的值。
        /// </summary>
        /// <param name="DataSheet">图表对应的数据工作表</param>
        /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
        /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
        /// <param name="type">此图表所属的类型,由枚举drawingtype提供</param>
        /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
        /// <param name="Info">图表中用来显示相关信息的那个文本框对象</param>
        /// <param name="DrawingTag">每一个监测曲线图的相关信息</param>
        /// <param name="MonitorType">监测数据的类型,比如测斜数据、立柱垂直位移数据、支撑轴力数据等</param>
        /// <remarks></remarks>
        public clsDrawing_Mnt_StaticBase(Worksheet DataSheet, Chart DrawingChart, Cls_ExcelForMonitorDrawing ParentApp,
                                         DrawingType type, bool CanRoll, TextFrame2 Info,
                                         MonitorInfo DrawingTag, MntType MonitorType,
                                         double[] Alldate) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType)
        {
            // VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
            myChart = this.Chart;

            //
            this.F_arrAllDate       = Alldate;
            this.currentPointsCount = Alldate.Length;
        }
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="type">此图表所属的类型,由枚举drawingtype提供</param>
            /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="Info">图表中用来显示相关信息的那个文本框对象</param>
            /// <param name="DrawingTag">每一个监测曲线图的相关信息</param>
            /// <param name="MonitorType">监测数据的类型,比如测斜数据、立柱垂直位移数据、支撑轴力数据等</param>
            /// <remarks></remarks>
            public ClsDrawing_Mnt_MaxMinDepth(Worksheet DataSheet, Chart
                                              DrawingChart, Cls_ExcelForMonitorDrawing ParentApp,
                                              DrawingType type, bool CanRoll, TextFrame2 Info,
                                              MonitorInfo DrawingTag, MntType MonitorType, double[] AllDate, DateMaxMinDepth Data) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType, AllDate)
            {
                //  -----------------------------------
                //
                this.F_dicSeries = new Dictionary <Series, object[]>();
                SeriesCollection Sc = DrawingChart.SeriesCollection();

                this.F_dicSeries.Add(Sc.Item(1), Data.Max);
                this.F_dicSeries.Add(Sc.Item(2), Data.Min);
                this.F_dicSeries.Add(Sc.Item(3), Data.Depth_Max);
                this.F_dicSeries.Add(Sc.Item(4), Data.Depth_Min);
            }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取用来绘图的Excel程序,并将此界面加入主程序的监测曲线集合
        /// </summary>
        /// <param name="NewExcelApp">按情况看是否要打开新的Application</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private Application GetApplication(bool NewExcelApp, Dictionary_AutoKey <Cls_ExcelForMonitorDrawing> MntDrawingExcelApps, ref Cls_ExcelForMonitorDrawing ExcelForMntDrawing)
        {
            Application app = default(Application);

            if (NewExcelApp) //打开新的Excel程序
            {
                app = new Application();
                ExcelForMntDrawing = new Cls_ExcelForMonitorDrawing(app);
            }
            else //在原有的Excel程序上作图
            {
                ExcelForMntDrawing = MntDrawingExcelApps.Last.Value;
                ExcelForMntDrawing.ActiveMntDrawingSheet.RemoveFormCollection();
                app = ExcelForMntDrawing.Application;
            }
            return(app);
        }
Ejemplo n.º 6
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="type">此图表所属的类型,由枚举drawingtype提供</param>
            /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="DateSpan">此图表的TimeSpan跨度</param>
            /// <remarks></remarks>
            public clsDrawing_Mnt_RollingBase(Excel.Worksheet DataSheet, Excel.Chart
                                              DrawingChart, Cls_ExcelForMonitorDrawing ParentApp,
                                              DrawingType type, bool CanRoll, Excel.TextFrame2 Info,
                                              MonitorInfo DrawingTag, MntType MonitorType,
                                              DateSpan DateSpan, SeriesTag
                                              theFirstSeriesTag) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType)
            {
                // VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
                F_Chart = this.Chart;

                //
                this.DateSpan = DateSpan;
                //刷新滚动窗口的列表框的界面显示
                APPLICATION_MAINFORM.MainForm.Form_Rolling.OnRollingDrawingsRefreshed();

                //启用主界面的程序滚动按钮
                APPLICATION_MAINFORM.MainForm.MainUI_RollingObjectCreated();

                //--------------------------- 设置与数据系列的曲线相关的属性值

                clsDrawing_Mnt_RollingBase with_1 = this;

                //以数据列中第一个元素作为进行滚动的那个series
                with_1.MovingSeries = theFirstSeriesTag.series;
                // ----- 集合数据的记录
                with_1.F_DicSeries_Tag.Add(cst_LboundOfSeriesInCollection, theFirstSeriesTag);
                //刚开始时,图表中只有一条数据曲线
                with_1.F_CurvesCount = 1;
                //
                this.F_List_HasCurve.Clear();
                this.F_List_HasCurve.Add(true); //第一个数据列是有曲线的,所以将其值设置为true
                Excel.SeriesCollection seriesColl = Chart.SeriesCollection() as Excel.SeriesCollection;
                for (var i = 1; i <= seriesColl.Count - 1; i++)
                {
                    this.F_List_HasCurve.Add(false);
                }
                // -----对图例进行更新---------
                LegendRefresh(F_List_HasCurve);
            }
Ejemplo n.º 7
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="DateSpan">此图表的TimeSpan跨度</param>
            /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="Date_ChosenDatum">一个字典,其关键字为监测数据表中有数据的每一天的日期,
            /// 对应的值为当天每一个被选择的监测点的监测数据,监测数据只包含列表中选择了的监测点</param>
            /// <param name="Info">记录数据信息的文本框</param>
            /// <remarks></remarks>
            public ClsDrawing_Mnt_OtherDynamics(Worksheet DataSheet, Chart DrawingChart,
                                                Cls_ExcelForMonitorDrawing ParentApp, DateSpan DateSpan,
                                                DrawingType type, bool CanRoll, TextFrame2 Info,
                                                MonitorInfo DrawingTag, MntType MonitorType,
                                                Dictionary <DateTime, object[]> Date_ChosenDatum,
                                                clsDrawing_Mnt_RollingBase.SeriesTag SeriesTag) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType, DateSpan, SeriesTag)
            {
                //  ------------------------------------
                //为进行滚动的那条数据曲线添加数据标签
                //在数据点旁边显示数据值
                this.MovingSeries.ApplyDataLabels();
                //设置数据标签的格式
                DataLabels dataLBs = this.MovingSeries.DataLabels();

                dataLBs.NumberFormat = "0.00";
                dataLBs.Format.TextFrame2.TextRange.Font.Size = 8;
                dataLBs.Format.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = Information.RGB(0, 0, 0);
                dataLBs.Format.TextFrame2.TextRange.Font.Name = AMEApplication.FontName_TNR;

                P_dicDate_ChosenDatum = Date_ChosenDatum;                 //包括第一列,但是不包括第一行的日期。
                // '' -----对图例进行更新---------
                //Call LegendRefresh(Me.List_HasCurve)
            }
Ejemplo n.º 8
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="DateSpan">此图表的TimeSpan跨度</param>
            /// <param name="type">此图表的类型,则枚举DrawingType提供</param>
            ///  <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="date_ColNum">此测斜点的监测数据工作表中的每一天与其在工作表中对应的列号,
            /// 以监测数据的日期key索引数据所在列号item</param>
            /// <param name="usedRg">监测曲线的数据范围,此Range对象中,
            /// 包括此工作表的UsedRange中的第一列,即深度的数据;但是不包括第一行的日期数据</param>
            /// <param name="Info">记录数据信息的文本框</param>
            /// <param name="FirstSeriesTag">第一条数据系列对应的Tag信息</param>
            /// <param name="ProcessRegionData">在施工进度工作表中,每一个基坑区域相关的各种信息,比如区域名称,区域的描述,
            /// 区域数据的Range对象,区域所属的基坑ID及其ID的数据等</param>
            /// <remarks></remarks>
            public ClsDrawing_Mnt_Incline(Excel.Worksheet DataSheet, Excel.Chart DrawingChart, Cls_ExcelForMonitorDrawing ParentApp,
                                          DateSpan DateSpan, DrawingType type, bool CanRoll, TextFrame2 Info, MonitorInfo DrawingTag,
                                          MntType MonitorType, Dictionary <DateTime, int> date_ColNum, Excel.Range usedRg,
                                          SeriesTag_Incline FirstSeriesTag, clsData_ProcessRegionData ProcessRegionData = null)
                : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType,
                       DateSpan, new clsDrawing_Mnt_RollingBase.SeriesTag(FirstSeriesTag.series, FirstSeriesTag.ConstructionDate))
            {
                //
                // --------------------------------------------
                try
                {
                    ClsDrawing_Mnt_Incline with_1 = this;
                    with_1.P_rgMntData = usedRg; //'包括第一列,但是不包括第一行的日期。
                    Excel.Range colRange = usedRg.Columns[1] as Excel.Range;
                    with_1.F_YValues   = ExcelFunction.ConvertRangeDataToVector <Single>(colRange);
                    with_1.Information = Info;
                    with_1._ExcavationDepth_lineAndTextbox = FirstSeriesTag;
                    with_1.F_dicDateAndColumnNumber        = date_ColNum;
                    with_1.P_ProcessRegionData             = ProcessRegionData;

                    with_1._inclineTopElevaion = Project_Expo.InclineTopElevaion;
                    // ----- 集合数据的记录
                    with_1.F_DicSeries_Tag[(int)LowIndexOfObjectsInExcel.SeriesInSeriesCollection] = FirstSeriesTag;

                    // -----对图例进行更新---------
                    //Call LegendRefresh(List_HasCurve)
                }
                catch (Exception ex)
                {
                    MessageBox.Show("构造测斜曲线图出错。" + "\r\n" + ex.Message + "\r\n" +
                                    ex.TargetSite.Name, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
Ejemplo n.º 9
0
        /// <summary>
        /// 1、开始绘图
        /// </summary>
        /// <param name="CreateNewExcelApp">是否要新开一个Excel程序</param>
        /// <param name="DrawDynamicDrawing">是否是要绘制动态曲线图</param>
        /// <param name="SelectedTags">选择的测点</param>
        /// <param name="RowNum_SelectedTags">选择的测点在Excel数据工作表中所在的行号</param>
        /// <remarks></remarks>
        private void Generate(bool CreateNewExcelApp, bool DrawDynamicDrawing,
                              string[] SelectedTags, int[] RowNum_SelectedTags)
        {
            // ----------arrDateRange----------------------- 获取此工作表中的整个施工日期的数组(0-Based,数据类型为Date)
            DateTime[] arrDateRange        = GetDate();
            double[]   arrDateRange_Double = new double[arrDateRange.Count() - 1 + 1];
            for (int i = 0; i <= arrDateRange.Count() - 1; i++)
            {
                arrDateRange_Double[i] = arrDateRange[i].ToOADate();
            }
            //-----------AllSelectedMonitorData------------ 获取所有"选择的"监测点位的监测数据的大数组。其中不包含选择的测点编号信息与施工日期的信息
            //此数组的第一个元素的下标值为0
            object[,] AllSelectedMonitorData = null;
            AllSelectedMonitorData           = GetAllSelectedMonitorData(this.F_shtMonitorData, RowNum_SelectedTags);

            //----------------- 设置监测曲线的时间跨度
            Array.Sort(arrDateRange);
            DateSpan Date_Span = new DateSpan();

            Date_Span.StartedDate  = arrDateRange[0];
            Date_Span.FinishedDate = arrDateRange[arrDateRange.Length - 1];

            //----------------------------打开用来绘图的Excel程序,并将此界面加入主程序的监测曲线集合
            Cls_ExcelForMonitorDrawing clsExcelForMonitorDrawing = null;

            //   --------------- 获取用来绘图的Excel程序,并将此界面加入主程序的监测曲线集合 -------------------
            F_AppDrawing = GetApplication(NewExcelApp: CreateNewExcelApp, ExcelForMntDrawing: clsExcelForMonitorDrawing, MntDrawingExcelApps:
                                          GlobalApplication.Application.MntDrawing_ExcelApps);
            F_AppDrawing.ScreenUpdating = false;
            //打开工作簿以画图
            if (F_AppDrawing.Workbooks.Count == 0)
            {
                F_wkbkDrawing = F_AppDrawing.Workbooks.Add();
            }
            else
            {
                F_wkbkDrawing = F_AppDrawing.Workbooks[1]; //总是定义为第一个,因为就只开了一个
            }
            //新开一个工作表以画图
            F_shtDrawing = F_wkbkDrawing.Worksheets.Add();
            F_shtDrawing.Activate();


            //-------  根据是要绘制动态的曲线图还是静态的曲线图,来执行不同的操作  ---------------------
            if (DrawDynamicDrawing)
            {
                //-------------绘制动态的曲线图--------------
                F_dicDate_ChosenDatum = GetdicDate_Datum_ForDynamic(arrDateRange, AllSelectedMonitorData);
                //开始画图
                F_Chart = DrawDynamicChart(F_dicDate_ChosenDatum, SelectedTags, AllSelectedMonitorData);
                //设置图表的Tag属性
                MonitorInfo Tags = GetChartTags(F_shtMonitorData);
                //-------------------------------------------------------------------------
                ClsDrawing_Mnt_OtherDynamics DynamicSheet = new ClsDrawing_Mnt_OtherDynamics(F_shtMonitorData, F_Chart,
                                                                                             clsExcelForMonitorDrawing, Date_Span,
                                                                                             DrawingType.Monitor_Dynamic, true, F_textbox_Info, Tags, this.F_MonitorType,
                                                                                             F_dicDate_ChosenDatum, this.F_TheFirstseriesTag);

                //-------------------------------------------------------------------------
            }
            else
            {
                //-------绘制静态的曲线图--------
                //开始画图
                Dictionary <Excel.Series, object[]> dicSeriesData = new Dictionary <Excel.Series, object[]>();
                F_Chart = DrawStaticChart(SelectedTags, arrDateRange_Double, AllSelectedMonitorData, dicSeriesData);
                //设置图表的Tag属性
                MonitorInfo Tags = GetChartTags(F_shtMonitorData);
                if (this.F_WorkingStage != null)
                {
                    DrawWorkingStage(this.F_Chart, this.F_WorkingStage);
                }
                //-------------------------------------------------------------------------
                ClsDrawing_Mnt_Static staticSheet = new ClsDrawing_Mnt_Static(F_shtMonitorData, F_Chart,
                                                                              clsExcelForMonitorDrawing,
                                                                              DrawingType.Monitor_Static, false, F_textbox_Info, Tags, this.F_MonitorType,
                                                                              dicSeriesData, arrDateRange_Double);

                //-------------------------------------------------------------------------
            }

            //---------------------- 界面显示与美化
            ExcelAppBeauty(F_shtDrawing.Application, CreateNewExcelApp);
        }