public Dimension getMinimumSize() {
        int height = 0;
        int width = 0;

        //
        // Use the size set by the application
        //
        if (isPreferredSizeSet())
            return super.getPreferredSize();

        //
        // Leave room for the component border
        //
        Border border = getBorder();
        if (border != null) {
            Insets insets = border.getBorderInsets(this);
            width += insets.left + insets.right;
            height += insets.top + insets.bottom;
        }

        //
        // Get the label font
        //
        Font font = getFont();
        if (font == null)
            font = new Font("Dialog", Font.PLAIN, 8);
        else
            font = font.deriveFont(Font.PLAIN, font.getSize()-2);

        //
        // Leave room for the chart title
        //
        if (chartTitle != null && chartTitle.length() != 0) {
            Font titleFont = font.deriveFont(Font.BOLD, font.getSize()+10);
            height += getFontMetrics(titleFont).getHeight();
        }

        //
        // Leave room for the chart grid
        //
        FontMetrics fm = getFontMetrics(font);
        int labelHeight = fm.getHeight();
        int labelWidth = fm.stringWidth("1.23");
        int gridSize = getGridSize();
        width += labelWidth*gridSize + 6*labelHeight;
        height += labelWidth*gridSize + 6*labelHeight;
        return new Dimension(width, height);
    }