Bug 141248 Script: Set axis title background color, axis title can be covered.
Script: Set axis title background color, axis title can be covered. Steps: 1.Create a bar chart 2.Script:function beforeDrawAxisTitle(axis, title, scriptContext) { importPackage(Packages.org.eclipse.birt.chart.model.attribute); importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl); { if (axis.getType() == AxisType.LINEAR_LITERAL) title.setVisible(false);} title.getCaption().getColor( ).set( 208, 32, 0); title.getCaption().getFont().setItalic(true); title.getCaption().getFont().setRotation(30); title.getCaption().getFont().setStrikethrough(true); title.getCaption().getFont().setSize(14); title.getCaption().getFont().setName("Arial"); title.getOutline().setVisible(true); title.getOutline().setThickness(3); title.setBackground(ColorDefinitionImpl.ORANGE()); } 3.Preview Actual Results: 1.Axis title can be covered Expected Results: 1.Axis title is visible.
chart/org.eclipse.birt.chart.device.svg/src/org/eclipse/birt/chart/device/svg/SVGTextRenderer.java
double dXOffset = 0, dW = 0;
		final int iLC = itm.getLineCount( );
		final Insets ins = la.getInsets( )
				.scaledInstance( _sxs.getDpiResolution( ) / 72d );
		SVGTextLayout tl;
		final HorizontalAlignment ha = la.getCaption( )
				.getFont( )
				.getAlignment( )
				.getHorizontalAlignment( );
		final boolean bRightAligned = ha.getValue( ) == HorizontalAlignment.RIGHT;
		final boolean bCenterAligned = ha.getValue( ) == HorizontalAlignment.CENTER;
		double dAngleInRadians = ( ( -dAngleInDegrees * Math.PI ) / 180.0 );
		int iRotateX = (int) dX;
		int iRotateY = (int) ( dY + dH / 2 );
		dY += dH / 2;
		
		if ( dAngleInDegrees == 0 )
		{
			double dYHalfOffset = ( dFH + dH ) / 2d;
			if ( bShadow ) 
			{
				g2d.setPaint( new GradientPaint( new Point2D.Double( dX + 3,
						( dY - dYHalfOffset ) + 3 ),
						(Color) _sxs.getColor( la.getShadowColor( ) ),
						new Point2D.Double( dX + 3 + dFW, ( dY - dYHalfOffset )
								+ 3
								+ dFH ),
						(Color) _sxs.getColor( la.getShadowColor( )
								.translucent( ) ) ) );
				g2d.fill( new Rectangle2D.Double( dX + 3,