Object overlayAxis = ChartAdapter.changeChartWithoutNotification( new IChangeWithoutNotification( ) {
ChartAdapter.beginIgnoreNotifications( );    Axis yAxis = (Axis) ( (Axis) chartModel.getAxes( ).get( 0 ) ).getAssociatedAxes( ) .get( 0 ); Axis overlayAxis = (Axis) EcoreUtil.copy( yAxis );    overlayAxis.setPrimaryAxis( false ); overlayAxis.setOrigin( AxisOriginImpl.create( IntersectionType.MAX_LITERAL, null ) ); overlayAxis.setLabelPosition( Position.RIGHT_LITERAL ); overlayAxis.setTitlePosition( Position.RIGHT_LITERAL ); overlayAxis.getTitle( ) .getCaption( ) .setValue( Messages.getString( "TaskSelectType.Caption.OverlayAxis1" ) ); overlayAxis.eAdapters( ).addAll( yAxis.eAdapters( ) );
	public static void addAxis( final ChartWithAxes chartModel )	{		// Prevent notifications rendering preview		Object overlayAxis = ChartAdapter.changeChartWithoutNotification( new IChangeWithoutNotification( ) {			public Object run( )			{				// Create a clone of the existing Y Axis				Axis yAxis = (Axis) ( (Axis) chartModel.getAxes( ).get( 0 ) ).getAssociatedAxes( )						.get( 0 );				Axis overlayAxis = (Axis) EcoreUtil.copy( yAxis );				// Now update overlay axis to set the properties that are				// different from				// the original				overlayAxis.setPrimaryAxis( false );				overlayAxis.setOrigin( AxisOriginImpl.create( IntersectionType.MAX_LITERAL,						null ) );				overlayAxis.setLabelPosition( Position.RIGHT_LITERAL );				overlayAxis.setTitlePosition( Position.RIGHT_LITERAL );				overlayAxis.getTitle( )						.getCaption( )						.setValue( Messages.getString( "TaskSelectType.Caption.OverlayAxis1" ) ); //$NON-NLS-1$				overlayAxis.eAdapters( ).addAll( yAxis.eAdapters( ) );				// Retain the first series of the axis. Remove others				if ( overlayAxis.getSeriesDefinitions( ).size( ) > 1 )				{					EList list = overlayAxis.getSeriesDefinitions( );					for ( int i = list.size( ) - 1; i > 0; i-- )					{						list.remove( i );					}				}				// Update overlay series definition(retain the group query,				// clean the data query)				SeriesDefinition sdOverlay = (SeriesDefinition) overlayAxis.getSeriesDefinitions( )						.get( 0 );				EList dds = sdOverlay.getDesignTimeSeries( )						.getDataDefinition( );				for ( int i = 0; i < dds.size( ); i++ )				{					( (Query) dds.get( i ) ).setDefinition( "" ); //$NON-NLS-1$				}				// Update the sample values for the new overlay series				SampleData sd = chartModel.getSampleData( );				// Create a new OrthogonalSampleData instance from the existing				// one				int currentSize = sd.getOrthogonalSampleData( ).size( );				OrthogonalSampleData sdOrthogonal = (OrthogonalSampleData) EcoreUtil.copy( (EObject) chartModel.getSampleData( )						.getOrthogonalSampleData( )						.get( 0 ) );				sdOrthogonal.setDataSetRepresentation( ChartUIUtil.getNewSampleData( overlayAxis.getType( ) ) );				sdOrthogonal.setSeriesDefinitionIndex( currentSize );				sdOrthogonal.eAdapters( ).addAll( sd.eAdapters( ) );				sd.getOrthogonalSampleData( ).add( sdOrthogonal );				return overlayAxis;			}		} );		( (Axis) chartModel.getAxes( ).get( 0 ) ).getAssociatedAxes( )				.add( overlayAxis );	}