[DataVisualization]

- Added "Title" to the xygraph properties page
- Now the range fixed by the zoom is serialized

Change-Id: Iffae434676712141ed18bde39eea25aab0e5a5e4
Signed-off-by: David López <david.lopez@cea.fr>
diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataSeriesXYGraphCoordinator.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataSeriesXYGraphCoordinator.java
index ea5e8d4..889e950 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataSeriesXYGraphCoordinator.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataSeriesXYGraphCoordinator.java
@@ -16,8 +16,6 @@
 

 import org.eclipse.papyrus.moka.datavisualization.profile.DataSource;

 import org.eclipse.papyrus.moka.datavisualization.profile.ValueSeries;

-import org.eclipse.papyrus.moka.datavisualization.profile.VisualizationPackage;

-import org.eclipse.papyrus.moka.datavisualization.profile.impl.DoubleSeriesImpl;

 import org.eclipse.papyrus.moka.datavisualization.ui.GraphBuilderHelper;

 import org.eclipse.papyrus.moka.xygraph.mapping.common.Variable;

 import org.eclipse.papyrus.moka.xygraph.mapping.common.Variable.VariableID;

@@ -47,6 +45,8 @@
 		synchronizeTracesVisibility();

 		

 		DataVisualizationService.getInstance().pullAllData(this);

+		

+		rescaleAxesIfNeeded();

 	}

 

 	private VariableDataEntry makeEntryFor(VariableID id, TraceDescriptor tDesc){

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataVisualizationService.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataVisualizationService.java
index 9dfd531..6ba18f7 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataVisualizationService.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/service/DataVisualizationService.java
@@ -228,7 +228,11 @@
 	}

 	

 	public Variable getVariable(ValueSeries series){

-		return varTable.getEntry( new DataSourceVariableID(series) ).getVariable();

+		VariableEntry entry = varTable.getEntry(new DataSourceVariableID(series));

+		if( entry == null )

+			return null;

+		

+		return entry.getVariable();

 	}

 

 	public void removeDataPort(DataPort port) {

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/ui/GraphBuilderHelper.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/ui/GraphBuilderHelper.java
index c12ca9f..3dbbce5 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/ui/GraphBuilderHelper.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.datavisualization.ui/src/org/eclipse/papyrus/moka/datavisualization/ui/GraphBuilderHelper.java
@@ -125,17 +125,29 @@
 		

 		//The independent variable

 		AxisDescriptor xAxis = XYGraphFactory.eINSTANCE.createAxisDescriptor();

+		

+		xAxis.setAutoScale(false);

+		xAxis.setRangeLower(1);

+		xAxis.setRangeUpper(-1);

+		

 		xAxis.setOrientation(LinearScale_Orientation.HORIZONTAL);

 		xAxis.setTitle(ind.getBase_Property().getLabel());		

 		xAxis.setFont(makeFontDescriptor("Segoe UI", 12, SWT.NORMAL));

-		xAxis.setTitleFont(makeFontDescriptor("Segoe UI", 12, SWT.NORMAL));		

+		xAxis.setTitleFont(makeFontDescriptor("Segoe UI", 12, SWT.NORMAL));

+		

 		xy.getAxisDescriptors().add(xAxis);

 

 		AxisDescriptor yAxis = XYGraphFactory.eINSTANCE.createAxisDescriptor();

+		

+		yAxis.setAutoScale(false);

+		yAxis.setRangeLower(1);

+		yAxis.setRangeUpper(-1);

+		

 		yAxis.setOrientation(LinearScale_Orientation.VERTICAL);

 		yAxis.setTitle("Values"); //TODO This might be controlled from the dataSource object? dataSource.getBase_DataType().getLabel()

 		yAxis.setFont(makeFontDescriptor("Segoe UI", 12, SWT.NORMAL));

 		yAxis.setTitleFont(makeFontDescriptor("Segoe UI", 12, SWT.NORMAL));

+		

 		xy.getAxisDescriptors().add(yAxis);

 

 		//Only for the dependent

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.common/src/org/eclipse/papyrus/moka/xygraph/common/ui/XYGraphEditorPart.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.common/src/org/eclipse/papyrus/moka/xygraph/common/ui/XYGraphEditorPart.java
index ebe3552..f99a0f9 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.common/src/org/eclipse/papyrus/moka/xygraph/common/ui/XYGraphEditorPart.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.common/src/org/eclipse/papyrus/moka/xygraph/common/ui/XYGraphEditorPart.java
@@ -86,6 +86,7 @@
 	protected ToolbarArmedXYGraph buildGraphFromModel(){

 		IXYGraph xyGraph = coordinator.buildXYGraph();

 		xyGraph.addPropertyChangeListener(IXYGraph.PROPERTY_CONFIG, this);

+		xyGraph.addPropertyChangeListener(IXYGraph.PROPERTY_ZOOMTYPE, this);

 		return new ToolbarArmedXYGraph(xyGraph);

 	}

 

@@ -96,10 +97,15 @@
 

 	@Override

 	public void propertyChange(PropertyChangeEvent evt) {

-		XYGraphDescriptor gDesc = coordinator.getXYGraphDescriptor();

-		gDesc.getContext();

-		coordinator.updateDescriptors((XYGraph) evt.getNewValue());

-		lblProvider.onGraphUpdated(gDesc);

-		dirty = true;

+		//It's also possible to react to changes of IXYGraph.PROPERTY_ZOOMTYPE 

+		//and IXYGraph.PROPERTY_XY_GRAPH_MEM   

+		

+		if( IXYGraph.PROPERTY_CONFIG.equals(evt.getPropertyName()) ) {

+			XYGraphDescriptor gDesc = coordinator.getXYGraphDescriptor();

+			gDesc.getContext();

+			coordinator.updateDescriptors((XYGraph) evt.getNewValue());

+			lblProvider.onGraphUpdated(gDesc);

+			dirty = true;

+		}

 	}

 }

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/DefaultXYGraphBinder.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/DefaultXYGraphBinder.java
index a355bf5..bafa948 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/DefaultXYGraphBinder.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/DefaultXYGraphBinder.java
@@ -22,6 +22,7 @@
 import org.eclipse.papyrus.moka.xygraph.mapping.util.DataBatch;

 import org.eclipse.papyrus.moka.xygraph.mapping.util.LUT;

 import org.eclipse.papyrus.moka.xygraph.mapping.util.LightDataProvider;

+import org.eclipse.papyrus.moka.xygraph.mapping.util.TraceDataBounds;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.AxisDescriptor;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.LinearScale_Orientation;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.TraceDescriptor;

@@ -155,7 +156,7 @@
 	public void setTraceData(TraceDescriptor tDesc, DataBatch x, DataBatch y) {

 		getProviderOf(tDesc).setDataList(x.getValues(), y.getValues());		

 	}

-

+	

 	@Override

 	public void bindXYGraph(XYGraph xy) {

 		this.xyGraph = xy;

@@ -177,4 +178,10 @@
 		axisMap.dispose();

 		traceMap.dispose();

 	}

+

+	@Override

+	public TraceDataBounds getTraceDataBounds(TraceDescriptor tDesc) {

+		return getProviderOf(tDesc).getBounds();

+	}

+

 }

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphCoordinator.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphCoordinator.java
index 1cc3309..c1c0983 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphCoordinator.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphCoordinator.java
@@ -22,6 +22,9 @@
 import org.eclipse.nebula.visualization.xygraph.figures.IXYGraph;

 import org.eclipse.nebula.visualization.xygraph.figures.Trace;

 import org.eclipse.nebula.visualization.xygraph.figures.XYGraph;

+import org.eclipse.nebula.visualization.xygraph.linearscale.Range;

+import org.eclipse.papyrus.moka.xygraph.mapping.util.BaseAxisListener;

+import org.eclipse.papyrus.moka.xygraph.mapping.util.TraceDataBounds;

 import org.eclipse.papyrus.moka.xygraph.mapping.writing.ModelWritingStrategyFactory;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.AxisDescriptor;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.TraceDescriptor;

@@ -65,10 +68,19 @@
 		

 		//2.1. The axes need the graph before the traces.

 		for( AxisDescriptor aDesc : gDesc.getAxisDescriptors() ){

+			Axis axis = graphMap.getAxisFor(aDesc);

+			//Listen range changes

+			axis.addListener(new BaseAxisListener(){

+				@Override

+				public void axisRangeChanged(Axis axis, Range old_range, Range new_range) {

+					onAxisRangeChanged( axis, old_range, new_range );

+				}

+			});

+			

 			if( graphMap.isPrimary(aDesc) )

 				continue;

-			

-			xy.addAxis(graphMap.getAxisFor(aDesc));

+

+			xy.addAxis(axis);

 		}

 		

 		//3. Build and add the traces

@@ -160,13 +172,59 @@
 	}

 

 	public void onModelUpdate(Notification notification) {

-		System.out.println(notification.getFeature());

+		//System.out.println(notification.getFeature());

+		

 		if( XYGraphPackage.eINSTANCE.getXYGraphDescriptor_VisibleTraces().equals(notification.getFeature()) ){

 			synchronizeTracesVisibility();

 		}

+		

+		//Apply the changes to the XYGraph (Figure)  

+		//Currently manual, we might want to change everything later?

+		if( XYGraphPackage.eINSTANCE.getXYGraphDescriptor_Title().equals(notification.getFeature()) ){

+			graphMap.getXYGraph().setTitle(notification.getNewStringValue());

+		}

+	}

+	

+	protected void onAxisRangeChanged(Axis axis, Range old_range, Range new_range) {

+		

+		AxisDescriptor aDesc = graphMap.getDescriptorFor(axis);

+		//aDesc.setRangeLower(new_range.getLower());

+		//aDesc.setRangeUpper(new_range.getUpper());

+		

+		//Update the range in the axis?

+		factory.getAxisUpdateStrategy().updateAxisDescriptor(axis, graphMap);

+		System.out.println("Updated axis Range: " + aDesc.getRangeLower() + ", " + aDesc.getRangeUpper());

 	}

 

 	public void dispose() {

 		graphMap.dispose();

 	}

+	

+	public void rescaleAxesIfNeeded(){

+		AxisDescriptor xPrimary = graphMap.getDescriptorFor(graphMap.getXAxisPrimary());

+		AxisDescriptor yPrimary = graphMap.getDescriptorFor(graphMap.getYAxisPrimary());

+		

+		if( xPrimary.getRangeLower() < xPrimary.getRangeUpper() && yPrimary.getRangeLower() < yPrimary.getRangeUpper() )

+			return; //not needed.

+		

+		forceAxesRescale();

+		

+	}

+	

+	public void forceAxesRescale(){

+		

+		//System.out.println("Forcing re-scale");

+		

+		TraceDataBounds dataBounds = new TraceDataBounds();

+		

+		for( TraceDescriptor tDesc : graphMap.getTraceDescriptors() )

+			dataBounds.union( graphMap.getTraceDataBounds(tDesc) );

+		

+		graphMap.getXAxisPrimary().setRange(dataBounds.getxMin(), dataBounds.getxMax());

+		graphMap.getYAxisPrimary().setRange(dataBounds.getyMin(), dataBounds.getyMax());

+		

+		factory.getAxisUpdateStrategy().updateAxisDescriptor(graphMap.getXAxisPrimary(), graphMap);

+		factory.getAxisUpdateStrategy().updateAxisDescriptor(graphMap.getYAxisPrimary(), graphMap);

+		

+	}

 }

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphDataBinder.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphDataBinder.java
index 42879ae..34a8538 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphDataBinder.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphDataBinder.java
@@ -15,9 +15,11 @@
 package org.eclipse.papyrus.moka.xygraph.mapping.common;

 

 import org.eclipse.papyrus.moka.xygraph.mapping.util.DataBatch;

+import org.eclipse.papyrus.moka.xygraph.mapping.util.TraceDataBounds;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.TraceDescriptor;

 

 public interface XYGraphDataBinder {

 	void addTraceSample(TraceDescriptor tDesc, double x, double y);

 	void setTraceData(TraceDescriptor tDesc, DataBatch x, DataBatch y);

+	TraceDataBounds getTraceDataBounds(TraceDescriptor tDesc);

 }

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphWidgetBinder.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphWidgetBinder.java
index e3c3dd8..0eb9f1e 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphWidgetBinder.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/common/XYGraphWidgetBinder.java
@@ -39,7 +39,6 @@
 	TraceDescriptor getDescriptorFor(Trace trace);

 	boolean isTraceMapped(TraceDescriptor tDesc);

 	

-	

 	Axis getXAxisPrimary();

 	Axis getYAxisPrimary();

 

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/BaseAxisListener.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/BaseAxisListener.java
new file mode 100644
index 0000000..7cd1239
--- /dev/null
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/BaseAxisListener.java
@@ -0,0 +1,60 @@
+/*****************************************************************************

+ * Copyright (c) 2016 CEA LIST.

+ *

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  David LOPEZ BETANCUR (CEA LIST)

+ *  Sebastien REVOL (CEA LIST)

+ *

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.xygraph.mapping.util;

+

+import org.eclipse.nebula.visualization.xygraph.figures.Axis;

+import org.eclipse.nebula.visualization.xygraph.figures.IAxisListener;

+import org.eclipse.nebula.visualization.xygraph.linearscale.Range;

+import org.eclipse.swt.graphics.Color;

+

+public class BaseAxisListener implements IAxisListener{

+

+	@Override

+	public void axisRangeChanged(Axis axis, Range old_range, Range new_range) {

+		// TODO Auto-generated method stub

+		

+	}

+

+	@Override

+	public void axisRevalidated(Axis axis) {

+		// TODO Auto-generated method stub

+		

+	}

+

+	@Override

+	public void axisForegroundColorChanged(Axis axis, Color oldColor, Color newColor) {

+		// TODO Auto-generated method stub

+		

+	}

+

+	@Override

+	public void axisTitleChanged(Axis axis, String oldTitle, String newTitle) {

+		// TODO Auto-generated method stub

+		

+	}

+

+	@Override

+	public void axisAutoScaleChanged(Axis axis, boolean oldAutoScale, boolean newAutoScale) {

+		// TODO Auto-generated method stub

+		

+	}

+

+	@Override

+	public void axisLogScaleChanged(Axis axis, boolean old, boolean logScale) {

+		// TODO Auto-generated method stub

+		

+	}

+

+}

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/LightDataProvider.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/LightDataProvider.java
index 06a7af2..4e1e677 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/LightDataProvider.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/LightDataProvider.java
@@ -27,9 +27,13 @@
 	private List<LightDataSample> samples = new ArrayList<>();

 	

 	private boolean dataRangedirty; 

-		

+	

+	//private double xMin, xMax, yMin, yMax;

+	private TraceDataBounds bounds;

+	

 	public LightDataProvider(boolean chronological) {

 		super(chronological);

+		bounds = new TraceDataBounds();

 	}

 

 	public void setDataList(List<Double> xl, List<Double> yl) {

@@ -45,23 +49,18 @@
 

 		samples = new ArrayList<LightDataSample>();

 

-		double xMin = Float.POSITIVE_INFINITY, xMax = Float.NEGATIVE_INFINITY, yMin = Float.POSITIVE_INFINITY,

-				yMax = Float.NEGATIVE_INFINITY;

+		bounds.reset();

 

 		for (int i = 0; i < xl.size(); i++) {

 

 			double x = xl.get(i);

 			double y = yl.get(i);

 

-			xMin = Math.min(xMin, x);

-			xMax = Math.max(xMax, x);

-			yMin = Math.min(yMin, y);

-			yMax = Math.max(yMax, y);

-

+			bounds.addSample(x, y);

 			samples.add(new LightDataSample(this, i));

 		}

-		xDataMinMax = new Range(xMin, yMax);

-		yDataMinMax = new Range(yMin, yMax);

+		xDataMinMax = new Range(bounds.getxMin(), bounds.getxMax());

+		yDataMinMax = new Range(bounds.getyMin(), bounds.getyMax());

 

 		fireDataChange();

 

@@ -120,12 +119,12 @@
 

 			double xMin;

 			double xMax;

-			xMin = getSample(lowerBound).getXValue();

+			xMin = getXValue(lowerBound);//getSample(lowerBound).getXValue();

 			xMax = xMin;

 

 			double yMin;

 			double yMax;

-			yMin = getSample(lowerBound).getYValue();

+			yMin = getYValue(lowerBound);//getSample(lowerBound).getYValue();

 			yMax = yMin;

 

 			for (int i = lowerBound + 1; i < getSize(); i++) {

@@ -163,4 +162,8 @@
 		xValues = null;

 		yValues = null;

 	}

+

+	public TraceDataBounds getBounds() {

+		return bounds;

+	}

 }

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/TraceDataBounds.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/TraceDataBounds.java
new file mode 100644
index 0000000..b89a99b
--- /dev/null
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/util/TraceDataBounds.java
@@ -0,0 +1,75 @@
+/*****************************************************************************

+ * Copyright (c) 2016 CEA LIST.

+ *

+ *

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *  David LOPEZ BETANCUR (CEA LIST)

+ *  Sebastien REVOL (CEA LIST)

+ *

+ *****************************************************************************/

+package org.eclipse.papyrus.moka.xygraph.mapping.util;

+

+public class TraceDataBounds {

+	private double xMin, yMin, xMax, yMax;

+	

+	public TraceDataBounds() {

+		reset();

+	}

+

+	public void reset(){

+		yMin = xMin = Double.POSITIVE_INFINITY;

+		yMax = xMax = Double.NEGATIVE_INFINITY;

+		

+	}

+	

+	public void addSample(double x, double y){

+		xMax = Math.max(xMax, x);

+		yMax = Math.max(yMax, y);

+		xMin = Math.min(xMin, x);

+		yMin = Math.min(yMin, y);

+	}

+	

+	public void union( TraceDataBounds o ){

+		xMax = Math.max(xMax, o.xMax);

+		yMax = Math.max(yMax, o.yMax);

+		xMin = Math.min(xMin, o.xMin);

+		yMin = Math.min(yMin, o.yMin);

+	}

+	

+	public double getxMin() {

+		return xMin;

+	}

+

+	public void setxMin(double xMin) {

+		this.xMin = xMin;

+	}

+

+	public double getyMin() {

+		return yMin;

+	}

+

+	public void setyMin(double yMin) {

+		this.yMin = yMin;

+	}

+

+	public double getxMax() {

+		return xMax;

+	}

+

+	public void setxMax(double xMax) {

+		this.xMax = xMax;

+	}

+

+	public double getyMax() {

+		return yMax;

+	}

+

+	public void setyMax(double yMax) {

+		this.yMax = yMax;

+	}

+}

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisBuildStrategy.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisBuildStrategy.java
index fbbc7f4..b88f216 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisBuildStrategy.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisBuildStrategy.java
@@ -15,11 +15,11 @@
 package org.eclipse.papyrus.moka.xygraph.mapping.writing.impl;

 

 import org.eclipse.nebula.visualization.xygraph.figures.Axis;

+import org.eclipse.papyrus.moka.xygraph.mapping.common.XYGraphMappingHelper;

+import org.eclipse.papyrus.moka.xygraph.mapping.common.XYGraphWidgetBinder;

+import org.eclipse.papyrus.moka.xygraph.mapping.writing.AxisBuildStrategy;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.AxisDescriptor;

 import org.eclipse.papyrus.moka.xygraph.model.xygraph.LinearScale_Orientation;

-import org.eclipse.papyrus.moka.xygraph.mapping.common.XYGraphWidgetBinder;

-import org.eclipse.papyrus.moka.xygraph.mapping.common.XYGraphMappingHelper;

-import org.eclipse.papyrus.moka.xygraph.mapping.writing.AxisBuildStrategy;

 import org.eclipse.swt.graphics.Font;

 import org.eclipse.swt.widgets.Display;

 

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisUpdateStrategy.java b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisUpdateStrategy.java
index 8f61e0e..4a0638b 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisUpdateStrategy.java
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.mapping/src/org/eclipse/papyrus/moka/xygraph/mapping/writing/impl/DefaultAxisUpdateStrategy.java
@@ -36,7 +36,7 @@
 		aDesc.setMajorGridColor(XYGraphMappingHelper.mapColor(axis.getMajorGridColor()));

 		aDesc.setMinorGridColor(XYGraphMappingHelper.mapColor(axis.getMinorGridColor()));

 		aDesc.setRangeUpper(axis.getRange().getUpper());

-		aDesc.setRangeLower( axis.getRange().getLower());

+		aDesc.setRangeLower(axis.getRange().getLower());

 		

 		//** Strangely there's no getZoomType() method.

 		//** aDesc.setZoomType(descZoomType(axis.getZoomType())));

diff --git a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.properties/properties/ui/SingleXYGraphDescriptor.xwt b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.properties/properties/ui/SingleXYGraphDescriptor.xwt
index c1cdaf8..59b2da9 100644
--- a/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.properties/properties/ui/SingleXYGraphDescriptor.xwt
+++ b/bundles/core/tools/visualization/org.eclipse.papyrus.moka.xygraph.properties/properties/ui/SingleXYGraphDescriptor.xwt
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>

-<Composite

-	xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets"

-	xmlns="http://www.eclipse.org/xwt/presentation"

+<Composite xmlns="http://www.eclipse.org/xwt/presentation"

+	xmlns:j="clr-namespace:java.lang" xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets"

 	xmlns:ppel="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets.layout"

-	xmlns:j="clr-namespace:java.lang" xmlns:x="http://www.eclipse.org/xwt">

+	xmlns:x="http://www.eclipse.org/xwt">

 	<Composite.layout>

 		<ppel:PropertiesLayout></ppel:PropertiesLayout>

 	</Composite.layout>

@@ -11,6 +10,8 @@
 		<Composite.layout>

 			<ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>

 		</Composite.layout>

+		<ppe:StringEditor input="{Binding}"

+			property="xygraph:XYGraphDescriptor:title"></ppe:StringEditor>

 		<ppe:MultiReference input="{Binding}"

 			property="xygraph:XYGraphDescriptor:visibleTraces"></ppe:MultiReference>

 	</Composite>