Implements the surface on which IDrawables are drawn. Is extended by Bitmap.PlotSurface2D, Windows.PlotSurface2D etc. TODO: better explanation.
Inheritance: IPlotSurface2D
        /// <summary>
        /// Default constructor.
        /// </summary>
        public PlotSurface2D()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

             			ps_ = new NPlot.PlotSurface2D();

            this.InteractionOccured += new InteractionHandler( OnInteractionOccured );
            this.PreRefresh += new PreRefreshHandler( OnPreRefresh );
        }
Exemplo n.º 2
0
        public PlotSample()
        {
            plotSurface = new NPlot.PlotSurface2D();

            // Set defaults for the sample plotSurface
            plotSurface.AutoScaleAutoGeneratedAxes = false;
            plotSurface.AutoScaleTitle             = false;
            //plotSurface.Canvas.ModifyBg (StateType.Normal);
            plotSurface.Legend = null;
            // plotSurface.Canvas.Name = "plotSurface";
            //plotSurface.ShowCoordinates = true;
            plotSurface.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            plotSurface.Title         = "";
            plotSurface.TitleFont     = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public PlotSurface2D()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // double buffer, and update when resize.
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.DoubleBuffer, true);
            base.SetStyle(ControlStyles.UserPaint, true);
            base.ResizeRedraw = true;

            ps_ = new NPlot.PlotSurface2D();

            this.InteractionOccured += new InteractionHandler( OnInteractionOccured );
            this.PreRefresh += new PreRefreshHandler( OnPreRefresh );
        }
Exemplo n.º 4
0
 /// <summary>
 /// Specify the Axes to attach the legend to. 
 /// </summary>
 /// <param name="xa">Specify which horizontal axis the legend should be attached to.</param>
 /// <param name="ya">Specify which vertical axis the legend should be attached to.</param>
 public void AttachTo( PlotSurface2D.XAxisPosition xa, PlotSurface2D.YAxisPosition ya )
 {
     xAttach_ = xa;
     yAttach_ = ya;
 }
Exemplo n.º 5
0
	static void Main ()
	{
#if GTK
		Application.Init ();

		Window w = new Window ("Test");
		w.DeleteEvent += delegate {
			Application.Quit ();
		};
		
		NPlot.Gtk.PlotSurface2D plot = new NPlot.Gtk.PlotSurface2D ();

		PlotTest (plot);
		
		plot.Show ();
		w.Add (plot);
		w.ShowAll ();

		Application.Run ();
#else

		NPlot.PlotSurface2D s = new NPlot.PlotSurface2D ();
		Bitmap b = new Bitmap (1000, 1000);
		Graphics g = Graphics.FromImage (b);
		g.FillRectangle  (Brushes.White, 0, 0, 1000, 1000);
		Rectangle bounds = new Rectangle (0, 0, 1000, 1000);
		PlotTest (s);
		s.Draw (g, bounds);
		b.Save ("file.png", ImageFormat.Png);
#endif
	}
 /// <summary>
 /// Constructor, which defines the world pixel length together with
 /// the y-axis that should be held constant when forcing this 
 /// constraint [the other y-axis only will be moved].
 /// </summary>
 /// <param name="p">The world pixel length</param>
 /// <param name="holdFixedY">The position of this y-axis will be 
 /// held constant. The other y-axis will be moved in order to 
 /// force the constraint.</param>
 public XPixelWorldLength(double p, PlotSurface2D.YAxisPosition holdFixedY)
 {
     this.pWorldLength_ = p;
     this.holdFixedY_ = holdFixedY;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="a">Aspect Ratio</param>
 /// <param name="holdFixedX">When adjusting the position of axes, the specified axis will never be moved.</param>
 /// <param name="holdFixedY">When adjusting the position of axes, the specified axis will never be moved.</param>
 public AspectRatio(
     double a,
     PlotSurface2D.XAxisPosition holdFixedX,
     PlotSurface2D.YAxisPosition holdFixedY)
 {
     this.a_ = a;
     this.holdFixedX_ = holdFixedX;
     this.holdFixedY_ = holdFixedY;
 }
 /// <summary>
 /// Constructor, which defines a vertical axis and the physical
 /// x position it should be drawn at.
 /// </summary>
 /// <param name="axis">The y-axis for which the x position is to be specified.</param>
 /// <param name="xPosition">The [physical] x position of the axis.</param>
 public AxisPosition(PlotSurface2D.YAxisPosition axis, int xPosition)
 {
     position_ = xPosition;
     yAxisPosition_ = axis;
 }
 /// <summary>
 /// Constructor, which defines an horizontal axis and the physical
 /// y position it should be drawn at.
 /// </summary>
 /// <param name="axis">The x-axis for which the y position is to be specified.</param>
 /// <param name="yPosition">The [physical] y position of the axis.</param>
 public AxisPosition(PlotSurface2D.XAxisPosition axis, int yPosition)
 {
     position_ = yPosition;
     xAxisPosition_ = axis;
 }
 /// <summary>
 /// Constructor, which defines the world pixel length together with
 /// the x-axis that should be held constant when forcing this 
 /// constraint [the other x-axis only will be moved].
 /// </summary>
 /// <param name="p">The world pixel length</param>
 /// <param name="holdFixedX">The position of this x-axis will be held constant. The other x-axis will be moved in order to force the constraint.</param>
 public YPixelWorldLength(double p, PlotSurface2D.XAxisPosition holdFixedX)
 {
     this.pWorldLength_ = p;
     this.holdFixedX_ = holdFixedX;
 }
Exemplo n.º 11
0
            PlotSurface2D plotSurface; // To allow access to PlotSurface Draw routine

            #endregion Fields

            #region Constructors

            /// <summary>
            /// Creates a new DrawingSurface and copies a reference to the calling PlotSurface
            /// </summary>
            internal DrawingSurface(PlotSurface2D ps)
                : base()
            {
                plotSurface = ps;
            }