Пример #1
0
        public Metafile DrawPlot(Vector[] Xs, Vector[] Ys)
        {
            Metafile Plot = ImageMethods.MakeMetafile(PageWidth, PageHeight);
            Graphics g    = Graphics.FromImage(Plot);

            TheGraph    = new XYGraph(Xs.Length, GraphWidth, GraphHeight);
            TheGraph.Xs = Xs;
            TheGraph.Ys = Ys;
            TheGraph.DrawGraph(Xo, g);

            X_Axis.DrawAxis(g, TheGraph.Xmin, TheGraph.Xmax, NumberOfTicks);
            Y_Axis.DrawAxis(g, TheGraph.Ymin, TheGraph.Ymax, NumberOfTicks);

            Vector X_Axis_Title_c = (Xo + X_BR) / 2.0;

            X_Axis_Title_c.Values[1] += X_Axis.Height + HorizontalAxisTitlePad;
            X_Axis_Title.DrawTitle(g, X_Axis_Title_c);

            Vector Y_Axis_Title_c = (Xo + X_TL) / 2.0D;

            Y_Axis_Title_c.Values[0] -= Y_Axis.Width + VerticalAxisTitlePad;

            Y_Axis_Title.DrawTitle(g, Y_Axis_Title_c);

            Vector Title_c = X_TL + (X_BR - Xo) / 2.0D;

            Plot_Title.GetWidthAndHeight(g);
            Title_c.Values[1] += -TitlePad - Plot_Title.Height;
            Plot_Title.DrawTitle(g, Title_c);

            Vector OPPS_Graphics_c = new Vector(2);

            OOPS_Graphics_Title.GetWidthAndHeight(g);
            OPPS_Graphics_c.Values[0] = PageWidth - HorizontalAxisTitlePad - OOPS_Graphics_Title.Width / 2.0D;
            OPPS_Graphics_c.Values[1] = PageHeight - VerticalAxisTitlePad - OOPS_Graphics_Title.Height;
            OOPS_Graphics_Title.DrawTitle(g, OPPS_Graphics_c);

            g.Dispose();
            return(Plot);
        }
Пример #2
0
        public void Scale(double ScaleFactor)
        {
            Plot_Title.Scale(ScaleFactor);
            X_Axis_Title.Scale(ScaleFactor);
            Y_Axis_Title.Scale(ScaleFactor);
            OOPS_Graphics_Title.Scale(ScaleFactor);

            PageHeight  = ScaleFactor * PageHeight;
            PageWidth   = PageHeight * (1.0 + Math.Sqrt(5)) / 2.0D;
            GraphHeight = PageHeight * 0.7;
            GraphWidth  = PageWidth * 0.7;

            TheGraph = new XYGraph(NumberOfGraphs, GraphWidth, GraphHeight);
            //TheGraph.ScalePens(ScaleFactor);

            HorizontalAxisTitlePad = PageHeight * 0.01;
            VerticalAxisTitlePad   = PageWidth * 0.01;
            TitlePad = PageHeight * 0.02;

            Xo             = new Vector(2);
            X_BR           = new Vector(2);
            X_TL           = new Vector(2);
            Xo.Values[0]   = PageWidth * 0.2;
            Xo.Values[1]   = PageHeight * 0.85;
            X_BR.Values[0] = Xo.Values[0] + GraphWidth;
            X_BR.Values[1] = Xo.Values[1];
            X_TL.Values[0] = Xo.Values[0];
            X_TL.Values[1] = Xo.Values[1] - GraphHeight;

            X_Axis = new Axis(Xo, X_BR, Axis.AxisOrientation.Horizontal);
            X_Axis.Scale(ScaleFactor);
            Y_Axis = new Axis(Xo, X_TL, Axis.AxisOrientation.Vertical);
            Y_Axis.Scale(ScaleFactor);

            NumberOfTicks = 5;
        }