Index: branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs
===================================================================
--- branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs	(revision 13808)
+++ branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs	(revision 13817)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Drawing;
+using System.Globalization;
 using System.Linq;
 using System.Windows.Forms;
@@ -32,4 +33,6 @@
   public partial class GradientChart : EnhancedChart {
     private ModifiableDataset internalDataset;
+
+    public bool ShowLegend { get; set; }
 
     private bool useMedianValues;
@@ -199,5 +202,4 @@
       if (points == 0)
         return;
-      CalculateAxisInterval();
       Series.Clear();
       var vla = VerticalLineAnnotation;
@@ -212,18 +214,21 @@
         var p = series.Points.Last();
         vla.X = p.XValue;
-        var ta = new TextAnnotation {
-          Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]),
-          Visible = true,
-          X = p.XValue,
-          Y = p.YValues[0],
-          AxisX = ChartAreas[0].AxisX,
-          AxisY = ChartAreas[0].AxisY
-        };
-        ta.ClipToChartArea = "ChartArea1";
-        ta.Name = series.Name;
-        Annotations.Add(ta);
-      }
+        ChartAreas[0].AxisX.Title = Variable + " " + vla.X.ToString("N3", CultureInfo.CurrentCulture);
+        //        var ta = new TextAnnotation {
+        //          Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]),
+        //          Visible = true,
+        //          X = p.XValue,
+        //          Y = p.YValues[0],
+        //          AxisX = ChartAreas[0].AxisX,
+        //          AxisY = ChartAreas[0].AxisY
+        //        };
+        //        ta.ClipToChartArea = "ChartArea1";
+        //        ta.Name = series.Name;
+        //        Annotations.Add(ta);
+      }
+      CalculateAxisInterval();
       AddStripLines();
-      AddLegends();
+      if (ShowLegend)
+        AddLegends();
     }
 
@@ -260,5 +265,5 @@
       var step = (max - min) / points;
       var axisX = ChartAreas[0].AxisX;
-      axisX.Title = Variable;
+      axisX.Title = Variable + " : " + v.ToString("N3", CultureInfo.CurrentCulture);
       var axisY = ChartAreas[0].AxisY;
       axisY.Title = Target;
@@ -290,5 +295,4 @@
       Legends.Clear();
       var legend = new Legend();
-      //      legend.Name = s.Name;
       legend.Alignment = StringAlignment.Center;
       legend.LegendStyle = LegendStyle.Row;
@@ -302,7 +306,4 @@
     private void AddStripLines() {
       var axisX = ChartAreas[0].AxisX;
-      axisX.Title = Variable;
-      var axisY = ChartAreas[0].AxisY;
-      axisY.Title = ProblemData.TargetVariable;
       axisX.StripLines.Clear();
       axisX.StripLines.Add(new StripLine { BackColor = Color.FromArgb(30, Color.Green), IntervalOffset = axisX.Minimum, StripWidth = min - axisX.Minimum });
@@ -317,4 +318,15 @@
       axis.Maximum = axisMax;
       axis.Interval = axisInterval;
+
+      double ymin = 0, ymax = 0;
+      foreach (var v in Series[0].Points.Select(x => x.YValues[0])) {
+        if (ymin > v) ymin = v;
+        if (ymax < v) ymax = v;
+      }
+      ChartUtil.CalculateAxisInterval(ymin, ymax, 5, out axisMin, out axisMax, out axisInterval);
+      axis = ChartAreas[0].AxisY;
+      axis.Minimum = axisMin;
+      axis.Maximum = axisMax;
+      axis.Interval = axisInterval;
     }
 
@@ -326,4 +338,11 @@
 
     #region events
+    public event EventHandler VariableValueChanged;
+    public void OnVariableValueChanged(object sender, EventArgs args) {
+      var changed = VariableValueChanged;
+      if (changed == null) return;
+      changed(sender, args);
+    }
+
     public event EventHandler ChartPropertyChanged;
     public void OnChartPropertyChanged(object sender, EventArgs args) {
@@ -353,8 +372,5 @@
         e.NewLocationX = axisX.Minimum;
       var x = e.NewLocationX;
-
-      //      var va = VerticalLineAnnotation;
-      //      Annotations.Clear();
-      //      Annotations.Add(va);
+      internalDataset.SetVariableValue(x, Variable, 0);
       for (int i = 0; i < solutionList.Count; ++i) {
         var y = GetEstimatedValue(solutionList[i], x);
@@ -363,11 +379,7 @@
         s.Points[n - 1] = new DataPoint(x, y) { MarkerColor = Color.Red, MarkerSize = 5 };
       }
-      foreach (var annotation in Annotations.OfType<TextAnnotation>()) {
-        var p = Series[annotation.Name].Points.Last();
-        annotation.Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]);
-        annotation.X = p.XValue;
-        annotation.Y = p.YValues[0];
-      }
+      ChartAreas[0].AxisX.Title = Variable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
       Update();
+      OnVariableValueChanged(this, EventArgs.Empty);
     }
 
@@ -390,5 +402,4 @@
       }
     }
-    #endregion
 
     private void GradientChart_DragDrop(object sender, DragEventArgs e) {
@@ -411,4 +422,5 @@
       }
     }
+    #endregion
   }
 }
