コード例 #1
0
ファイル: PlotABC.cs プロジェクト: SubaruDieselCrew/Florence
        public void CreatePlot(InteractivePlotSurface2D plotSurface)
        {
            plotSurface.Clear();
            const int size = 200;
            float [] xs = new float [size];
            float [] ys = new float [size];
            for (int i=0; i<size; i++)
            {
                xs[i] = (float)Math.Sin((double)i/(double)(size-1)*2.0*Math.PI);
                ys[i] = (float)Math.Cos((double)i/(double)(size-1)*6.0*Math.PI);
            }

            LinePlot lp = new LinePlot();
            lp.OrdinateData = ys;
            lp.AbscissaData = xs;
            Pen linePen = new Pen( Color.Yellow, 5.0f );
            lp.Pen = linePen;
            plotSurface.Add(lp);
            plotSurface.Title = "AxisConstraint.EqualScaling in action...";

            // Image downloaded from http://squidfingers.com. Thanks!
            Assembly a = Assembly.GetExecutingAssembly();
            System.IO.Stream file =
                a.GetManifestResourceStream( "DemoLib.Resources.pattern01.jpg" );
            System.Drawing.Image im = Image.FromStream( file );
            plotSurface.PlotBackImage = new Bitmap( im );

            plotSurface.AddAxesConstraint( new AxesConstraint.AspectRatio( 1.0, PlotSurface2D.XAxisPosition.Top, PlotSurface2D.YAxisPosition.Left ) );
            plotSurface.XAxis1.WorldMin = plotSurface.YAxis1.WorldMin;
            plotSurface.XAxis1.WorldMax = plotSurface.YAxis1.WorldMax;
            plotSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            plotSurface.AddInteraction(new PlotZoom());

            // make sure plot surface colors are as we expect - the wave example changes them.
            //plotSurface.PlotBackColor = Color.White;
            plotSurface.XAxis1.Color = Color.Black;
            plotSurface.YAxis1.Color = Color.Black;

            plotSurface.Refresh();
        }