Exemplo n.º 1
0
        private void DrawAxisTests(Context ctx, Rectangle bounds)
        {
            Rectangle boundingBox;
            Point     tl = Point.Zero;
            Point     br = Point.Zero;;

            tl.X = bounds.Left + 30;        tl.Y = bounds.Top + 10;
            br.X = tl.X;                            br.Y = bounds.Bottom - 100;

            LinearAxis a = new LinearAxis(0, 10);

            a.Draw(ctx, tl, br, out boundingBox);

            a.Reversed = true;
            a.Draw(ctx, new Point(60, 10), new Point(60, 200), out boundingBox);

            a.SmallTickSize = 0;
            a.Draw(ctx, new Point(90, 10), new Point(90, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw(ctx, new Point(120, 10), new Point(120, 200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize      = 2;
            a.Draw(ctx, new Point(150, 10), new Point(150, 200), out boundingBox);

            a.LineColor = Colors.DarkBlue;
            a.Draw(ctx, new Point(180, 10), new Point(180, 200), out boundingBox);

            a.TickTextColor = Colors.DarkBlue;
            a.Draw(ctx, new Point(210, 10), new Point(210, 200), out boundingBox);

            a.TickTextColor = Colors.Black;
            a.Draw(ctx, new Point(240, 10), new Point(300, 200), out boundingBox);

            a.WorldMax      = 100000;
            a.WorldMin      = -3;
            a.LargeTickStep = double.NaN;
            a.Draw(ctx, new Point(330, 10), new Point(330, 200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw(ctx, new Point(380, 10), new Point(380, 200), out boundingBox);

            // Test for default TicksAngle (+90) on positive X-axis, ie Ticks below X-axis
            LinearAxis aX = new LinearAxis(0, 10);

            tl.X = bounds.Left + 30;        tl.Y = bounds.Bottom - 60;
            br.X = bounds.Right - 20;       br.Y = bounds.Bottom - 60;

            aX.Draw(ctx, tl, br, out boundingBox);

            // Set TicksAngle to -45 anti-clockwise from positive X-axis direction
            aX.TicksAngle = Math.PI / 4.0;
            tl.Y         += 50;             br.Y += 50;

            aX.Draw(ctx, tl, br, out boundingBox);
        }
Exemplo n.º 2
0
        private void DrawAxisTests(Context ctx, Rectangle bounds)
        {
            LinearAxis a = new LinearAxis(0, 10);
            Rectangle  boundingBox;

            a.Draw(ctx, new Point(30, 10), new Point(30, 200), out boundingBox);

            a.Reversed = true;
            a.Draw(ctx, new Point(60, 10), new Point(60, 200), out boundingBox);

            a.SmallTickSize = 0;
            a.Draw(ctx, new Point(90, 10), new Point(90, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw(ctx, new Point(120, 10), new Point(120, 200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize      = 2;
            a.Draw(ctx, new Point(150, 10), new Point(150, 200), out boundingBox);

            a.LineColor = Colors.DarkBlue;
            a.Draw(ctx, new Point(180, 10), new Point(180, 200), out boundingBox);

            a.TickTextColor = Colors.DarkBlue;
            a.Draw(ctx, new Point(210, 10), new Point(210, 200), out boundingBox);

            a.TickTextColor = Colors.Black;
            a.Draw(ctx, new Point(240, 10), new Point(300, 200), out boundingBox);

            a.WorldMax      = 100000;
            a.WorldMin      = -3;
            a.LargeTickStep = double.NaN;
            a.Draw(ctx, new Point(330, 10), new Point(330, 200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw(ctx, new Point(380, 10), new Point(380, 200), out boundingBox);

            // Test for default TicksAngle on positive X-axis, ie Ticks below X-axis
            LinearAxis aX = new LinearAxis(0, 10);

            aX.Draw(ctx, new Point(30, 240), new Point(380, 240), out boundingBox);

            // Set TicksAngle to PI/4 anti-clockwise from positive X-axis direction
            aX.TicksAngle = Math.PI / 4.0;
            aX.Draw(ctx, new Point(30, 280), new Point(380, 280), out boundingBox);
        }
Exemplo n.º 3
0
        private void DrawAxisTests(Context ctx, Rectangle bounds)
        {
            LinearAxis a = new LinearAxis (0, 10);
            Rectangle boundingBox;

            a.Draw (ctx, new Point (30,10), new Point (30, 200), out boundingBox);

            a.Reversed = true;
            a.Draw (ctx, new Point (60,10), new Point (60, 200), out boundingBox);

            a.SmallTickSize = 0;
            a.Draw (ctx, new Point(90,10), new Point(90, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw (ctx, new Point(120,10), new Point(120,200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize = 2;
            a.Draw (ctx, new Point(150,10), new Point(150,200), out boundingBox);

            a.LineColor = Colors.DarkBlue;
            a.Draw (ctx, new Point(180,10), new Point(180,200), out boundingBox);

            a.TickTextColor= Colors.DarkBlue;
            a.Draw (ctx, new Point(210,10), new Point(210,200), out boundingBox);

            a.TickTextColor = Colors.Black;
            a.Draw (ctx, new Point(240,10), new Point(300,200), out boundingBox);

            a.WorldMax = 100000;
            a.WorldMin = -3;
            a.LargeTickStep = double.NaN;
            a.Draw (ctx, new Point(330,10), new Point(330,200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw (ctx, new Point(380,10), new Point(380,200), out boundingBox);

            // Test for default TicksAngle on positive X-axis, ie Ticks below X-axis
            LinearAxis aX = new LinearAxis (0, 10);
            aX.Draw (ctx, new Point(30,240), new Point(380, 240), out boundingBox);

            // Set TicksAngle to PI/4 anti-clockwise from positive X-axis direction
            aX.TicksAngle = Math.PI / 4.0;
            aX.Draw (ctx, new Point (30,280), new Point (380, 280), out boundingBox);
        }
Exemplo n.º 4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);


            RectI boundingBox;


            LinearAxis a = new LinearAxis(0, 10);

            a.Color = Color.White;
            a.Draw(e.Graphics, new PointI(10, 10), new PointI(10, 200), out boundingBox);

            a.Reversed = true;
            a.Draw(e.Graphics, new PointI(40, 10), new PointI(40, 200), out boundingBox);

            a.SmallTickSize = 0;
            a.Draw(e.Graphics, new PointI(70, 10), new PointI(70, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw(e.Graphics, new PointI(100, 10), new PointI(100, 200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize      = 2;
            a.Draw(e.Graphics, new PointI(130, 10), new PointI(130, 200), out boundingBox);

            a.AxisColor = Color.Cyan;
            a.Draw(e.Graphics, new PointI(160, 10), new PointI(160, 200), out boundingBox);

            a.TickTextColor = Color.Cyan;
            a.Draw(e.Graphics, new PointI(190, 10), new PointI(190, 200), out boundingBox);

            a.TickTextBrush = Brushes.White;
            a.AxisPen       = Pens.White;
            a.Draw(e.Graphics, new PointI(220, 10), new PointI(280, 200), out boundingBox);

            a.WorldMax      = 100000;
            a.WorldMin      = -3;
            a.LargeTickStep = double.NaN;
            a.Draw(e.Graphics, new PointI(310, 10), new PointI(310, 200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw(e.Graphics, new PointI(360, 10), new PointI(360, 200), out boundingBox);
        }
Exemplo n.º 5
0
        private void Tests_Paint(object sender, PaintEventArgs e)
        {
            System.Drawing.Rectangle boundingBox;

            NPlot.LinearAxis a = new LinearAxis(0, 10);
            a.Draw(e.Graphics, new Point(10, 10), new Point(10, 200), out boundingBox);

            a.Reversed = true;
            a.Draw(e.Graphics, new Point(40, 10), new Point(40, 200), out boundingBox);

            a.SmallTickSize = 0;
            a.Draw(e.Graphics, new Point(70, 10), new Point(70, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw(e.Graphics, new Point(100, 10), new Point(100, 200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize      = 2;
            a.Draw(e.Graphics, new Point(130, 10), new Point(130, 200), out boundingBox);

            a.AxisColor = Color.Cyan;
            a.Draw(e.Graphics, new Point(160, 10), new Point(160, 200), out boundingBox);

            a.TickTextColor = Color.Cyan;
            a.Draw(e.Graphics, new Point(190, 10), new Point(190, 200), out boundingBox);

            a.TickTextBrush = Brushes.Black;
            a.AxisPen       = Pens.Black;
            a.Draw(e.Graphics, new Point(220, 10), new Point(280, 200), out boundingBox);

            a.WorldMax      = 100000;
            a.WorldMin      = -3;
            a.LargeTickStep = double.NaN;
            a.Draw(e.Graphics, new Point(310, 10), new Point(310, 200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw(e.Graphics, new Point(360, 10), new Point(360, 200), out boundingBox);
        }
Exemplo n.º 6
0
        //
        // The actual Axis tests
        //
        private void DrawAxisTests(Graphics g, Rectangle bounds)
        {
            Rectangle boundingBox;
            Point     tl = Point.Empty;
            Point     br = Point.Empty;

            tl.X = bounds.Left + 20;        tl.Y = bounds.Top + 10;
            br.X = bounds.Left + 20;        br.Y = bounds.Bottom - 50;

            NPlot.LinearAxis a = new LinearAxis(0, 10);
            a.Draw(g, tl, br, out boundingBox);

            a.Reversed = true;
            tl.X      += 30;     br.X += 30;
            a.Draw(g, tl, br, out boundingBox);

            a.SmallTickSize = 0;
            a.Draw(g, new Point(90, 10), new Point(90, 200), out boundingBox);

            a.LargeTickStep = 2.5;
            a.Draw(g, new Point(120, 10), new Point(120, 200), out boundingBox);

            a.NumberOfSmallTicks = 5;
            a.SmallTickSize      = 2;
            a.Draw(g, new Point(150, 10), new Point(150, 200), out boundingBox);

            a.AxisColor = Color.Cyan;
            a.Draw(g, new Point(180, 10), new Point(180, 200), out boundingBox);

            a.TickTextColor = Color.Cyan;
            a.Draw(g, new Point(210, 10), new Point(210, 200), out boundingBox);

            a.TickTextBrush = Brushes.Black;
            a.AxisPen       = Pens.Black;
            a.Draw(g, new Point(240, 10), new Point(300, 200), out boundingBox);

            a.WorldMax      = 100000;
            a.WorldMin      = -3;
            a.LargeTickStep = double.NaN;
            a.Draw(g, new Point(330, 10), new Point(330, 200), out boundingBox);

            a.NumberFormat = "{0:0.0E+0}";
            a.Draw(g, new Point(380, 10), new Point(380, 200), out boundingBox);

            // Test for default TicksAngle on positive X-axis, ie Ticks below X-axis
            NPlot.LinearAxis aX = new LinearAxis(0, 10);

            tl.X = bounds.Left + 90;       tl.Y = bounds.Bottom - 150;
            br.X = bounds.Right - 30;       br.Y = bounds.Bottom - 150;

            aX.Draw(g, tl, br, out boundingBox);

            // Set TicksAngle to PI/4 anti-clockwise from positive X-axis direction
            aX.TicksAngle = (float)Math.PI / 4.0f;
            tl.Y         += 40;             br.Y += 40;
            aX.Draw(g, tl, br, out boundingBox);

            DateTime timeMin = new DateTime(2013, 1, 1, 12, 30, 0);
            DateTime timeMax = new DateTime(2013, 2, 2, 12, 30, 0);

            DateTimeAxis dta = new DateTimeAxis(timeMin, timeMax);

            tl.Y += 30;             br.Y += 30;
            dta.Draw(g, tl, br, out boundingBox);

            timeMin = new DateTime(2013, 1, 1, 12, 30, 0);
            timeMax = new DateTime(2013, 1, 1, 12, 59, 30);

            dta.WorldMin = (double)timeMin.Ticks;
            dta.WorldMax = (double)timeMax.Ticks;

            tl.Y += 30;             br.Y += 30;
            dta.Draw(g, tl, br, out boundingBox);
        }