コード例 #1
0
        internal void CommonFunctionality(SimpleDataset3D[] arrSimpleDS)
        {
            int            iCount           = 0;
            Background     objCBGND         = null;
            ChartAttribute objWallAttribute = null;
            Wall3D         objxyMinZWall    = null;

            Wall3D objyzMinXWall = null;

            Wall3D            objxzMinYWall = null;
            LinearAxis        xAxis         = null;
            LinearAxis        yAxis         = null;
            AxisTitle         objXAxisTitle = null;
            AxisTitle         objYAxisTitle = null;
            NumericAxisLabels XAxisLabel    = null;
            NumericAxisLabels YAxisLabel    = null;
            Grid           xGrid            = null;
            Grid           yGrid            = null;
            ChartAttribute objAttribute     = null;


            try
            {
                iCount         = arrSimpleDS.Length;
                m_objChartView = m_obj3DGraphControl;
                if (m_obj3DGraphControl != null)
                {
                    m_objChartView = m_obj3DGraphControl;
                }

                string[] sarrLabels = m_sUnits.Split(new char[] { ',' });

                m_objFont = new Font("Microsoft Sans Serif", 5, FontStyle.Regular);

                m_objCartesianCordinates = new CartesianCoordinates();
                m_objCartesianCordinates.AutoScale(arrSimpleDS, ChartObj.AUTOAXES_EXACT, ChartObj.AUTOAXES_EXACT);


                m_objCartesianCordinates.AbsRotateCoordinateSystem(new Point3D(5, 3, 0));

                m_objChartView.SetFractionalZViewportDepth(4);

                objCBGND = new Background(m_objCartesianCordinates, ChartObj.GRAPH_BACKGROUND, Color.FromArgb(241, 241, 247));
                m_objChartView.AddChartObject(objCBGND);

                objWallAttribute = new ChartAttribute(Color.Beige, 0.5, DashStyle.Solid, Color.LightGray);
                objxyMinZWall    = new Wall3D(m_objCartesianCordinates, ChartObj.XY_MAXZ_PLANE, 0, objWallAttribute);
                m_objChartView.AddChartObject(objxyMinZWall);
                objyzMinXWall = new Wall3D(m_objCartesianCordinates, ChartObj.YZ_MINX_PLANE, 0, objWallAttribute);
                m_objChartView.AddChartObject(objyzMinXWall);
                objxzMinYWall = new Wall3D(m_objCartesianCordinates, ChartObj.XZ_MINY_PLANE, 0, objWallAttribute);
                m_objChartView.AddChartObject(objxzMinYWall);

                m_objCartesianCordinates.SetGraphBorderDiagonal(0.15, .15, .90, 0.75);

                xAxis = new LinearAxis(m_objCartesianCordinates, ChartObj.X_AXIS);
                xAxis.CalcAutoAxis();
                m_objChartView.AddChartObject(xAxis);

                XAxisLabel = new NumericAxisLabels(xAxis);
                XAxisLabel.SetTextFont(m_objFont);
                m_objChartView.AddChartObject(XAxisLabel);



                switch (m_sTimeAxis)
                {
                case "Sec":
                    objXAxisTitle = new AxisTitle(xAxis, m_objFont, "Sec");
                    m_objChartView.AddChartObject(objXAxisTitle);

                    break;

                case "Others":

                    objXAxisTitle = new AxisTitle(xAxis, m_objFont, sarrLabels[0]);
                    m_objChartView.AddChartObject(objXAxisTitle);
                    break;
                }

                yAxis = new LinearAxis(m_objCartesianCordinates, ChartObj.Y_AXIS);
                yAxis.CalcAutoAxis();
                m_objChartView.AddChartObject(yAxis);

                YAxisLabel = new NumericAxisLabels(yAxis);
                YAxisLabel.SetTextFont(m_objFont);
                m_objChartView.AddChartObject(YAxisLabel);


                objYAxisTitle = new AxisTitle(yAxis, m_objFont, sarrLabels[1]);
                m_objChartView.AddChartObject(objYAxisTitle);

                switch (iCount)
                {
                case 1:

                    objAttribute       = new ChartAttribute(Color.DarkRed, 0.5, DashStyle.Solid);
                    m_objFirstLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[0], objAttribute);
                    m_objChartView.AddChartObject(m_objFirstLinePlot);


                    ChartText objFirstText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[0], m_objFirstLinePlot.DisplayDataset.XData[m_objFirstLinePlot.DisplayDataset.XData.Length - 60], m_objFirstLinePlot.DisplayDataset.YData[m_objFirstLinePlot.DisplayDataset.YData.Length - 60], ChartObj.PHYS_POS);

                    m_objChartView.AddChartObject(objFirstText);

                    break;

                case 2:
                    objAttribute       = new ChartAttribute(Color.DarkRed, 0.5, DashStyle.Solid);
                    m_objFirstLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[0], objAttribute);
                    m_objChartView.AddChartObject(m_objFirstLinePlot);

                    ChartText objNewFirstText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[1], m_objFirstLinePlot.DisplayDataset.XData[m_objFirstLinePlot.DisplayDataset.XData.Length - 60], m_objFirstLinePlot.DisplayDataset.YData[m_objFirstLinePlot.DisplayDataset.YData.Length - 60], 0.002, ChartObj.PHYS_POS);

                    m_objChartView.AddChartObject(objNewFirstText);

                    objAttribute        = new ChartAttribute(Color.DarkGreen, 0.5, DashStyle.Solid);
                    m_objSecondLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[1], objAttribute);
                    m_objChartView.AddChartObject(m_objSecondLinePlot);

                    ChartText objSecondText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[0], m_objSecondLinePlot.DisplayDataset.XData[m_objSecondLinePlot.DisplayDataset.XData.Length - 60], m_objSecondLinePlot.DisplayDataset.YData[m_objSecondLinePlot.DisplayDataset.YData.Length - 60], 0, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objSecondText);


                    break;

                case 3:

                    objAttribute       = new ChartAttribute(Color.DarkRed, 0.5, DashStyle.Solid);
                    m_objFirstLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[0], objAttribute);
                    m_objChartView.AddChartObject(m_objFirstLinePlot);

                    ChartText objThirdFirstText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[2], m_objFirstLinePlot.DisplayDataset.XData[m_objFirstLinePlot.DisplayDataset.XData.Length - 60], m_objFirstLinePlot.DisplayDataset.YData[m_objFirstLinePlot.DisplayDataset.YData.Length - 60], 0.0045, ChartObj.PHYS_POS);

                    m_objChartView.AddChartObject(objThirdFirstText);

                    objAttribute        = new ChartAttribute(Color.DarkGreen, 0.5, DashStyle.Solid);
                    m_objSecondLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[1], objAttribute);
                    m_objChartView.AddChartObject(m_objSecondLinePlot);

                    ChartText objThirdSecondText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[1], m_objSecondLinePlot.DisplayDataset.XData[m_objSecondLinePlot.DisplayDataset.XData.Length - 60], m_objSecondLinePlot.DisplayDataset.YData[m_objSecondLinePlot.DisplayDataset.YData.Length - 60], 0.0025, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objThirdSecondText);

                    objAttribute       = new ChartAttribute(Color.DarkGoldenrod, 0.5, DashStyle.Solid);
                    m_objThirdLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[2], objAttribute);
                    m_objChartView.AddChartObject(m_objThirdLinePlot);

                    ChartText objThirdThirdText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[0], m_objThirdLinePlot.DisplayDataset.XData[m_objThirdLinePlot.DisplayDataset.XData.Length - 60], m_objThirdLinePlot.DisplayDataset.YData[m_objThirdLinePlot.DisplayDataset.YData.Length - 60], 0, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objThirdThirdText);



                    break;

                case 4:

                    objAttribute       = new ChartAttribute(Color.DarkRed, 0.5, DashStyle.Solid);
                    m_objFirstLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[0], objAttribute);
                    m_objChartView.AddChartObject(m_objFirstLinePlot);

                    ChartText objFourthFirstText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[3], m_objFirstLinePlot.DisplayDataset.XData[m_objFirstLinePlot.DisplayDataset.XData.Length - 60], m_objFirstLinePlot.DisplayDataset.YData[m_objFirstLinePlot.DisplayDataset.YData.Length - 60], 0.0075, ChartObj.PHYS_POS);

                    m_objChartView.AddChartObject(objFourthFirstText);

                    objAttribute        = new ChartAttribute(Color.DarkGreen, 0.5, DashStyle.Solid);
                    m_objSecondLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[1], objAttribute);
                    m_objChartView.AddChartObject(m_objSecondLinePlot);

                    ChartText objFourthSecondText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[2], m_objSecondLinePlot.DisplayDataset.XData[m_objSecondLinePlot.DisplayDataset.XData.Length - 60], m_objSecondLinePlot.DisplayDataset.YData[m_objSecondLinePlot.DisplayDataset.YData.Length - 60], 0.0045, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objFourthSecondText);

                    objAttribute       = new ChartAttribute(Color.DarkGoldenrod, 0.5, DashStyle.Solid);
                    m_objThirdLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[2], objAttribute);
                    m_objChartView.AddChartObject(m_objThirdLinePlot);

                    ChartText objFourthThirdText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[1], m_objThirdLinePlot.DisplayDataset.XData[m_objThirdLinePlot.DisplayDataset.XData.Length - 60], m_objThirdLinePlot.DisplayDataset.YData[m_objThirdLinePlot.DisplayDataset.YData.Length - 60], 0.002, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objFourthThirdText);


                    objAttribute        = new ChartAttribute(Color.DarkViolet, 0.5, DashStyle.Solid);
                    m_objFourthLinePlot = new SimpleLinePlot(m_objCartesianCordinates, arrSimpleDS[3], objAttribute);
                    m_objChartView.AddChartObject(m_objFourthLinePlot);


                    ChartText objFourthFourthText = new ChartText(m_objCartesianCordinates, m_objFont, (string)m_arlstDates[0], m_objFourthLinePlot.DisplayDataset.XData[m_objFourthLinePlot.DisplayDataset.XData.Length - 60], m_objFourthLinePlot.DisplayDataset.YData[m_objFourthLinePlot.DisplayDataset.YData.Length - 60], 0, ChartObj.PHYS_POS);
                    m_objChartView.AddChartObject(objFourthFourthText);

                    break;
                }
            }
            catch
            {
                throw;
            }
        }