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 + 20; br.X = bounds.Right - 30; br.Y = bounds.Top + 20; 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); dta.Draw(ctx, 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 += 50; br.Y += 50; dta.Draw(ctx, tl, br, out boundingBox); }
// // 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); }