public RectangleF Draw(Graphics g, int xPos, int yPos, ArrayList plots, float scale)
        {
            // determine max width and max height of label strings.
            float maxHt = 0.0f;
            float maxWd = 0.0f;

            for (int i = 0; i < plots.Count; ++i)
            {
                IPlot p   = (IPlot)plots[i];
                float lHt = g.MeasureString(p.Label, FontScaler.scaleFont(font_, scale)).Height;
                float lWd = g.MeasureString(p.Label, FontScaler.scaleFont(font_, scale)).Width;
                if (lHt > maxHt)
                {
                    maxHt = lHt;
                }
                if (lWd > maxWd)
                {
                    maxWd = lWd;
                }
            }

            float lineLength = 20.0f;
            float lineHeight = maxHt;
            float hSpacing   = 5.0f * scale;
            float vSpacing   = 3.0f * scale;
            float boxWidth   = hSpacing * 3.0f + lineLength + maxWd;
            float boxHeight  = vSpacing * (float)(plots.Count + 1) + maxHt * (float)plots.Count;

            float totalWidth  = boxWidth;
            float totalHeight = boxHeight;

            // draw box..
            if (BorderStyle == BorderType.Line)
            {
                g.FillRectangle(new SolidBrush(Color.White), xPos, yPos, boxWidth, boxHeight);
                g.DrawRectangle(new Pen(Color.Black), xPos, yPos, boxWidth, boxHeight);
            }
            else if (BorderStyle == BorderType.Shadow)
            {
                float offset = 4.0f * (float)scale;
                g.FillRectangle(new SolidBrush(Color.LightGray), xPos + offset, yPos + offset, boxWidth, boxHeight);
                g.FillRectangle(new SolidBrush(Color.White), xPos, yPos, boxWidth, boxHeight);
                g.DrawRectangle(new Pen(Color.Black), xPos, yPos, boxWidth, boxHeight);

                totalWidth  += offset;
                totalHeight += offset;
            }

            /*
             * else if ( this.BorderStyle == BorderType.Curved )
             * {
             *      // TODO. make this nice.
             * }
             */
            else
            {
                // do nothing.
            }

            // now draw entries in box..
            int unnamedCount = 0;

            for (int i = 0; i < plots.Count; ++i)
            {
                IPlot p        = (IPlot)plots[i];
                float lineXPos = xPos + hSpacing;
                float lineYPos = yPos + vSpacing + (float)i * (vSpacing + maxHt);
                p.DrawLegendLine(g, new RectangleF(lineXPos, lineYPos, lineLength, lineHeight));
                float  textXPos = lineXPos + hSpacing + lineLength;
                float  textYPos = lineYPos;
                string label    = p.Label;
                if (label == "")
                {
                    unnamedCount += 1;
                    label         = "Series " + unnamedCount.ToString();
                }
                g.DrawString(label, FontScaler.scaleFont(Font, scale),
                             new SolidBrush(Color.Black), textXPos, textYPos);
            }

            return(new RectangleF(xPos, yPos, totalWidth, totalHeight));
        }