NPlot.LogAxis.DrawTicks C# (CSharp) Method

DrawTicks() protected method

Draw the ticks.
protected DrawTicks ( Graphics g, Point physicalMin, Point physicalMax, object &labelOffset, object &boundingBox ) : void
g System.Drawing.Graphics The drawing surface on which to draw.
physicalMin Point The minimum physical extent of the axis.
physicalMax Point The maximum physical extent of the axis.
labelOffset object out: a suitable offset from the axis to draw the axis label.
boundingBox object out: smallest box that completely encompasses all of the ticks and tick labels.
return void
        protected override void DrawTicks(
            Graphics g,
            Point physicalMin,
            Point physicalMax,
            out object labelOffset,
            out object boundingBox)
        {
            Point tLabelOffset;
            Rectangle tBoundingBox;

            labelOffset = this.getDefaultLabelOffset( physicalMin, physicalMax );
            boundingBox = null;

            ArrayList largeTickPositions;
            ArrayList smallTickPositions;
            this.WorldTickPositions( physicalMin, physicalMax, out largeTickPositions, out smallTickPositions );

            Point offset = new Point( 0, 0 );
            object bb = null;
            // Missed this protection
            if (largeTickPositions.Count > 0)
            {
                for (int i=0; i<largeTickPositions.Count; ++i)
                {
                    StringBuilder label = new StringBuilder();
                    // do google search for "format specifier writeline" for help on this.
                    label.AppendFormat(this.NumberFormat, (double)largeTickPositions[i]);
                    this.DrawTick( g, (double)largeTickPositions[i], this.LargeTickSize, label.ToString(),
                        new Point(0,0), physicalMin, physicalMax, out tLabelOffset, out tBoundingBox );

                    Axis.UpdateOffsetAndBounds( ref labelOffset, ref boundingBox, tLabelOffset, tBoundingBox );
                }
            }
            else
            {
                // just get the axis bounding box)
                PointF dir = Utils.UnitVector(physicalMin,physicalMax);
                Rectangle rr = new Rectangle( physicalMin.X,
                    (int)((physicalMax.X-physicalMin.X)*dir.X),
                    physicalMin.Y,
                    (int)((physicalMax.Y-physicalMin.Y)*dir.Y) );
                bb = rr;
            }

            // missed protection for zero ticks
            if (smallTickPositions.Count > 0)
            {
                for (int i=0; i<smallTickPositions.Count; ++i)
                {
                    this.DrawTick( g, (double)smallTickPositions[i], this.SmallTickSize,
                        "", new Point(0,0), physicalMin, physicalMax, out tLabelOffset, out tBoundingBox );
                    // ignore r for now - assume bb unchanged by small tick bounds.
                }
            }
        }