示例#1
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);
        }
示例#2
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 );
        }
示例#3
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);
        }