private void calculateDimensions( int cWidth, int cHeight )
	{
		// Calculate chart dimensions
		chartWidth			= ( cWidth == 0 ? DEFAULT_WIDTH : cWidth );
		chartHeight			= ( cHeight == 0 ? DEFAULT_HEIGHT : cHeight );

		if ( cWidth > 0 ) numPoints = cWidth;

		// Padding depends on grid visibility
		chart_lpadding 		= ( graphDef.showMajorGridY() ? graphDef.getChartLeftPadding() : CHART_LPADDING_NM );
		chart_bpadding 		= ( graphDef.showMajorGridX() ? CHART_BPADDING : CHART_BPADDING_NM );

		// Size of all lines below chart
		commentBlock		= 0;
		if ( graphDef.showLegend() )
			commentBlock 	= graphDef.getCommentLineCount() * (nfont_height + LINE_PADDING) - LINE_PADDING;

		// x_offset and y_offset define the starting corner of the actual graph
		x_offset			= LBORDER_SPACE;
		if ( graphDef.getVerticalLabel() != null )
			x_offset 		+= nfont_height + LINE_PADDING;
		imgWidth			= chartWidth + x_offset + RBORDER_SPACE + chart_lpadding + CHART_RPADDING;

		y_offset			= UBORDER_SPACE;
		if ( graphDef.getTitle() != null )			// Title *always* gets a extra LF automatically
			y_offset		+= ((tfont_height + LINE_PADDING) * graphDef.getTitle().getLineCount() + tfont_height) + LINE_PADDING;
		imgHeight 			= chartHeight + commentBlock + y_offset + BBORDER_SPACE + CHART_UPADDING + CHART_BPADDING;
	}