bo.setLeft( dX + dFullWidth - dLeftInset - 1 - 3 * dItemHeight / 2 );
bo.setLeft( dX + dColumnWidth - dLeftInset - 1 - 3 * dItemHeight / 2 );
	protected final void renderLegendItem( IPrimitiveRenderer ipr, Legend lg,			Label la, Label valueLa, double dX, double dY, double dW,			double dItemHeight, double dFullHeight, double dExtraHeight,			double dFullWidth, double dLeftInset, double dHorizontalSpacing,			Series se, Fill fPaletteEntry, LegendItemRenderingHints lirh )			throws ChartException	{		ScriptHandler sh = getRunTimeContext( ).getScriptHandler( );		ScriptHandler.callFunction( sh,				ScriptHandler.BEFORE_DRAW_LEGEND_ENTRY,				la,				getRunTimeContext( ).getScriptContext( ) );		getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.BEFORE_DRAW_LEGEND_ENTRY,				la );		final Bounds bo = lirh.getLegendGraphicBounds( );		if ( isRightToLeft( ) )		{			bo.setLeft( dX + dFullWidth - dLeftInset - 1 - 3 * dItemHeight / 2 );		}		else		{			bo.setLeft( dX + dLeftInset + 1 );		}		bo.setTop( dY + 1 + ( dFullHeight - dItemHeight ) / 2 );		bo.setWidth( 3 * dItemHeight / 2 );		bo.setHeight( dItemHeight - 2 );		final BaseRenderer br = lirh.getRenderer( );		br.renderLegendGraphic( ipr, lg, fPaletteEntry, bo );		final TextRenderEvent tre = (TextRenderEvent) ( (EventObjectCache) ir ).getEventObject( StructureSource.createLegend( lg ),				TextRenderEvent.class );		if ( isRightToLeft( ) )		{			tre.setLocation( LocationImpl.create( dX					+ dFullWidth					- dLeftInset					- 3					* dItemHeight					/ 2					- dHorizontalSpacing, dY + dFullHeight / 2 - 1 ) );			tre.setTextPosition( TextRenderEvent.LEFT );		}		else		{			tre.setLocation( LocationImpl.create( dX					+ dLeftInset					+ ( 3 * dItemHeight / 2 )					+ dHorizontalSpacing, dY + dFullHeight / 2 - 1 ) );			tre.setTextPosition( TextRenderEvent.RIGHT );		}		tre.setLabel( la );		tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );		ipr.drawText( tre );		if ( valueLa != null )		{			Location[] loaBack = new Location[4];			final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ir ).getEventObject( StructureSource.createLegend( lg ),					PolygonRenderEvent.class );			pre.setBackground( valueLa.getBackground( ) );			pre.setOutline( valueLa.getOutline( ) );			pre.setPoints( loaBack );			final double dValueWidth = dFullWidth - 2 * dLeftInset;			loaBack[0] = LocationImpl.create( dX + dLeftInset + 1, dY					+ dFullHeight					+ 1 );			loaBack[1] = LocationImpl.create( dX + dLeftInset + 1, dY					+ dFullHeight					+ dExtraHeight );			loaBack[2] = LocationImpl.create( dX + dLeftInset + dValueWidth - 1,					dY + dFullHeight + dExtraHeight );			loaBack[3] = LocationImpl.create( dX + dLeftInset + dValueWidth - 1,					dY + dFullHeight + 1 );			ipr.fillPolygon( pre );			ipr.drawPolygon( pre );			Label tmpLa = (Label) EcoreUtil.copy( valueLa );			tmpLa.setOutline( null );			tmpLa.setBackground( null );			TextAlignment ta = TextAlignmentImpl.create( );			ta.setHorizontalAlignment( HorizontalAlignment.CENTER_LITERAL );			ta.setVerticalAlignment( VerticalAlignment.CENTER_LITERAL );			tre.setBlockAlignment( ta );			tre.setBlockBounds( BoundsImpl.create( dX + dLeftInset + 1, dY					+ dFullHeight					+ 1, dValueWidth - 2, dExtraHeight - 1 ) );			tre.setLabel( tmpLa );			tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );			ipr.drawText( tre );		}		if ( isInteractivityEnabled( ) )		{			// PROCESS 'SERIES LEVEL' TRIGGERS USING SOURCE='bs'			Trigger tg;			EList elTriggers = lg.getTriggers( );			Location[] loaHotspot = new Location[4];			if ( isRightToLeft( ) )			{				double dTextStartX = tre.getLocation( ).getX( ) + 1;				loaHotspot[0] = LocationImpl.create( dTextStartX, dY );				loaHotspot[1] = LocationImpl.create( dTextStartX - dW, dY + 1 );				loaHotspot[2] = LocationImpl.create( dTextStartX - dW, dY						+ dItemHeight						+ dExtraHeight );				loaHotspot[3] = LocationImpl.create( dTextStartX, dY						+ dItemHeight						+ dExtraHeight );			}			else			{				double dTextStartX = tre.getLocation( ).getX( ) - 1;				loaHotspot[0] = LocationImpl.create( dTextStartX, dY );				loaHotspot[1] = LocationImpl.create( dTextStartX + dW, dY + 1 );				loaHotspot[2] = LocationImpl.create( dTextStartX + dW, dY						+ dItemHeight						+ dExtraHeight );				loaHotspot[3] = LocationImpl.create( dTextStartX, dY						+ dItemHeight						+ dExtraHeight );			}			Trigger buildinTg = null;			if ( cm.getInteractivity( ) != null )			{				boolean customed = false;				switch ( cm.getInteractivity( ).getLegendBehavior( ).getValue( ) )				{					case LegendBehaviorType.HIGHLIGHT_SERIE :						for ( Iterator itr = elTriggers.iterator( ); itr.hasNext( ); )						{							tg = (Trigger) itr.next( );							if ( tg.getCondition( ) == TriggerCondition.ONCLICK_LITERAL									|| tg.getAction( ).getType( ) == ActionType.HIGHLIGHT_LITERAL )							{								customed = true;							}						}						if ( !customed )						{							buildinTg = TriggerImpl.create( TriggerCondition.ONCLICK_LITERAL,									ActionImpl.create( ActionType.HIGHLIGHT_LITERAL,											SeriesValueImpl.create( String.valueOf( se.getSeriesIdentifier( ) ) ) ) );						}						break;					case LegendBehaviorType.TOGGLE_SERIE_VISIBILITY :						for ( Iterator itr = elTriggers.iterator( ); itr.hasNext( ); )						{							tg = (Trigger) itr.next( );							if ( tg.getCondition( ) == TriggerCondition.ONCLICK_LITERAL									|| tg.getAction( ).getType( ) == ActionType.TOGGLE_VISIBILITY_LITERAL )							{								customed = true;							}						}						if ( !customed )						{							buildinTg = TriggerImpl.create( TriggerCondition.ONCLICK_LITERAL,									ActionImpl.create( ActionType.TOGGLE_VISIBILITY_LITERAL,											SeriesValueImpl.create( String.valueOf( se.getSeriesIdentifier( ) ) ) ) );						}						break;					case LegendBehaviorType.NONE :						break;				}			}			if ( !elTriggers.isEmpty( ) || buildinTg != null )			{				final InteractionEvent iev = (InteractionEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createSeries( se ),						InteractionEvent.class );				for ( int t = 0; t < elTriggers.size( ); t++ )				{					tg = (Trigger) EcoreUtil.copy( (Trigger) elTriggers.get( t ) );					processTrigger( tg,							WrappedStructureSource.createLegendEntry( lg, la ) );					iev.addTrigger( tg );				}				if ( buildinTg != null )				{					processTrigger( buildinTg,							WrappedStructureSource.createLegendEntry( lg, la ) );					iev.addTrigger( buildinTg );				}				final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createLegend( lg ),						PolygonRenderEvent.class );				pre.setPoints( loaHotspot );				iev.setHotSpot( pre );				ipr.enableInteraction( iev );			}		}		ScriptHandler.callFunction( sh,				ScriptHandler.AFTER_DRAW_LEGEND_ENTRY,				la,				getRunTimeContext( ).getScriptContext( ) );		getRunTimeContext( ).notifyStructureChange( IStructureDefinitionListener.AFTER_DRAW_LEGEND_ENTRY,				la );	}