示例#1
0
        public void SetChartYMaxMinValue(Chart chart, double max, double min, XlAxisGroup yType)
        {
            Axis yAxis = chart.Axes(XlAxisType.xlValue, yType);

            yAxis.MinimumScaleIsAuto = false;
            yAxis.MaximumScaleIsAuto = false;
            yAxis.MinimumScale       = min;
            yAxis.MaximumScale       = max;
        }
        public XlAxis Axes(object type, XlAxisGroup axisGroup)
        {
            object[] paramArray = new object[2];
            paramArray[0] = type;
            paramArray[1] = axisGroup;
            object returnValue = InstanceType.InvokeMember("AreaGroups", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlAxis newClass = new XlAxis(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
        /// <summary>返回一个代表图表上单个坐标轴或坐标轴集合的某个对象。
        /// </summary>
        /// <param name="Type">指定要返回的坐标轴。可为以下 XlAxisType 常量之一:xlValue、xlCategory 或 xlSeriesAxis(xlSeriesAxis 仅对三维图表有效)。</param>
        /// <param name="AxisGroup">指定坐标轴组。如果省略该参数,则使用主坐标轴组。三维图表仅有一个坐标轴组。</param>
        public dynamic Axes(XlAxisType? Type = null, XlAxisGroup AxisGroup = XlAxisGroup.xlPrimary)
        {
            _objaParameters = new object[2] {
                Type == null ? System.Type.Missing : Type,
                AxisGroup
            };

            return _objChart.GetType().InvokeMember("Axes", BindingFlags.InvokeMethod, null, _objChart, _objaParameters);
        }
示例#4
0
        /// <summary>
        ///设置chart Y轴 label显示数字的格式
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="yType"></param>
        /// <param name="format">0.00%为百分比</param>
        public void SetChartYThickLabelNumberFormat(Chart chart, XlAxisGroup yType, string format)
        {
            Axis yAxis = chart.Axes(XlAxisType.xlValue, yType);

            yAxis.TickLabels.NumberFormatLocal = format;
        }
示例#5
0
            /// <summary>
            /// 按不同的监测数据类型返回对应的坐标轴标签
            /// </summary>
            /// <param name="Drawing_Type"></param>
            /// <param name="MonitorType"></param>
            /// <param name="AxisType"></param>
            /// <param name="AxisGroup">此选项仅对绘制双Y轴或者双X轴的Chart时有效,否则设置了也不会进行处理。</param>
            /// <returns></returns>
            /// <remarks></remarks>
            public static string GetAxisLabel(DrawingType Drawing_Type, MntType MonitorType,
                                              XlAxisType AxisType, XlAxisGroup AxisGroup = XlAxisGroup.xlPrimary)
            {
                string strAxisLabel = "";

                switch (Drawing_Type)
                {
                // ---------------------  动态测斜曲线图  ----------------------------------------------------
                case DrawingType.Monitor_Incline_Dynamic:
                    switch (AxisType)
                    {
                    case XlAxisType.xlCategory:
                        strAxisLabel = AxisLabels.Displacement_mm;
                        break;

                    case XlAxisType.xlValue:
                        strAxisLabel = AxisLabels.Depth;
                        break;
                    }
                    break;

                // ------------------------  测斜位移最值及对应深度  -------------------------------------------------
                case DrawingType.Monitor_Incline_MaxMinDepth:
                    switch (AxisType)
                    {
                    case XlAxisType.xlCategory:
                        strAxisLabel = AxisLabels.ConstructionDate;
                        break;

                    case XlAxisType.xlValue:
                        switch (AxisGroup)
                        {
                        case XlAxisGroup.xlPrimary:
                            strAxisLabel = AxisLabels.Displacement_mm;
                            break;

                        case XlAxisGroup.xlSecondary:
                            strAxisLabel = AxisLabels.Depth;
                            break;
                        }
                        break;
                    }
                    break;

                // -----------------  测斜以外的动态监测曲线曲线图  --------------------------------------------------------
                case DrawingType.Monitor_Dynamic:
                    switch (AxisType)
                    {
                    case XlAxisType.xlCategory:
                        strAxisLabel = AxisLabels.Points;
                        break;

                    case XlAxisType.xlValue:
                        switch (MonitorType)
                        {
                        case MntType.Struts:
                            strAxisLabel = AxisLabels.AxialForce;
                            break;

                        case MntType.WaterLevel:
                            strAxisLabel = AxisLabels.Displacement_m;
                            break;

                        default:
                            strAxisLabel = AxisLabels.Displacement_mm;
                            break;
                        }
                        break;
                    }
                    break;

                // -------------------------  测斜以外的静态曲线图  ------------------------------------------------
                case DrawingType.Monitor_Static:
                    switch (AxisType)
                    {
                    case XlAxisType.xlCategory:
                        strAxisLabel = AxisLabels.ConstructionDate;
                        break;

                    case XlAxisType.xlValue:
                        switch (MonitorType)
                        {
                        case MntType.Struts:
                            strAxisLabel = AxisLabels.AxialForce;
                            break;

                        case MntType.WaterLevel:
                            strAxisLabel = AxisLabels.Displacement_m;
                            break;

                        default:
                            strAxisLabel = AxisLabels.Displacement_mm;
                            break;
                        }
                        break;
                    }
                    break;

                case DrawingType.Xls_SectionalView:
                    switch (AxisType)
                    {
                    case XlAxisType.xlCategory:
                        strAxisLabel = AxisLabels.Excavation;
                        break;

                    case XlAxisType.xlValue:
                        strAxisLabel = AxisLabels.Elevation;
                        break;
                    }
                    break;
                }
                return(strAxisLabel);
            }