Index: branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs
===================================================================
--- branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs	(revision 9368)
+++ branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs	(revision 9444)
@@ -328,7 +328,6 @@
       if (!this.categoricalMapping.ContainsKey(dimension)) {
         this.categoricalMapping[dimension] = new Dictionary<object, double>();
-        var orderedCategories = Content.Where(r=> r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
-                                .Distinct()
-                                .OrderBy(x => x, new NaturalStringComparer());
+        var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString())
+                                       .Distinct().OrderBy(x => x, new NaturalStringComparer());
         int count = 1;
         foreach (var category in orderedCategories) {
@@ -389,5 +388,6 @@
       axis.CustomLabels.Clear();
       if (categoricalMapping.ContainsKey(dimension)) {
-        foreach (var pair in categoricalMapping[dimension]) {
+        int position = 1;
+        foreach (var pair in categoricalMapping[dimension].Where(x => seriesCache.ContainsKey(x.Value))) {
           string labelText = pair.Key.ToString();
           CustomLabel label = new CustomLabel();
@@ -397,7 +397,8 @@
           label.Text = labelText;
           label.GridTicks = GridTickTypes.TickMark;
-          label.FromPosition = pair.Value - 0.5;
-          label.ToPosition = pair.Value + 0.5;
+          label.FromPosition = position - 0.5;
+          label.ToPosition = position + 0.5;
           axis.CustomLabels.Add(label);
+          position++;
         }
       } else if (dimension > 0 && Content.GetValue(0, dimension) is TimeSpanValue) {
Index: branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs
===================================================================
--- branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs	(revision 9368)
+++ branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs	(revision 9444)
@@ -48,5 +48,4 @@
       System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
       System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
-      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView));
       this.yJitterLabel = new System.Windows.Forms.Label();
       this.xJitterlabel = new System.Windows.Forms.Label();
@@ -61,26 +60,28 @@
       this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
       this.openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-      this.hideRunToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.hideRunsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
       this.zoomButton = new System.Windows.Forms.RadioButton();
       this.selectButton = new System.Windows.Forms.RadioButton();
       this.radioButtonGroup = new System.Windows.Forms.GroupBox();
-      this.colorDialogButton = new System.Windows.Forms.Button();
+      this.colorRunsButton = new System.Windows.Forms.Button();
       this.colorDialog = new System.Windows.Forms.ColorDialog();
       this.tooltip = new System.Windows.Forms.ToolTip(this.components);
       this.colorXAxisButton = new System.Windows.Forms.Button();
       this.colorYAxisButton = new System.Windows.Forms.Button();
+      this.transparencyTrackBar = new System.Windows.Forms.TrackBar();
+      this.hideRunsButton = new System.Windows.Forms.Button();
       this.noRunsLabel = new System.Windows.Forms.Label();
       this.sizeTrackBar = new System.Windows.Forms.TrackBar();
       this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-      this.transparencyTrackBar = new System.Windows.Forms.TrackBar();
       this.transparencyLabel = new System.Windows.Forms.Label();
-      this.colorRunsButton = new System.Windows.Forms.Button();
-      this.hideRunsButton = new System.Windows.Forms.Button();
+      this.unhideAllRunToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.colorResetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.colorDialogButton = new System.Windows.Forms.Button();
       ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
       ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
       ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
       this.radioButtonGroup.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();
       ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).BeginInit();
-      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();
       this.SuspendLayout();
       // 
@@ -222,10 +223,10 @@
       this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click);
       // 
-      // hideRunToolStripMenuItem
-      // 
-      this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem";
-      this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
-      this.hideRunToolStripMenuItem.Text = "Hide Run";
-      this.hideRunToolStripMenuItem.Click += new System.EventHandler(this.hideRunToolStripMenuItem_Click);
+      // hideRunsToolStripMenuItem
+      // 
+      this.hideRunsToolStripMenuItem.Name = "hideRunsToolStripMenuItem";
+      this.hideRunsToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
+      this.hideRunsToolStripMenuItem.Text = "Hide selected Runs";
+      this.hideRunsToolStripMenuItem.Click += new System.EventHandler(this.hideRunsToolStripMenuItem_Click);
       // 
       // zoomButton
@@ -265,17 +266,16 @@
       this.radioButtonGroup.TabStop = false;
       // 
-      // colorDialogButton
-      // 
-      this.colorDialogButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.colorDialogButton.Enabled = false;
-      this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
-      this.colorDialogButton.Location = new System.Drawing.Point(130, 469);
-      this.colorDialogButton.Name = "colorDialogButton";
-      this.colorDialogButton.Size = new System.Drawing.Size(21, 21);
-      this.colorDialogButton.TabIndex = 20;
-      this.colorDialogButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-      this.tooltip.SetToolTip(this.colorDialogButton, "Choose color");
-      this.colorDialogButton.UseVisualStyleBackColor = true;
-      this.colorDialogButton.Click += new System.EventHandler(this.colorDialogButton_Click);
+      // colorRunsButton
+      // 
+      this.colorRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+      this.colorRunsButton.Enabled = false;
+      this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
+      this.colorRunsButton.Location = new System.Drawing.Point(130, 469);
+      this.colorRunsButton.Name = "colorRunsButton";
+      this.colorRunsButton.Size = new System.Drawing.Size(21, 21);
+      this.colorRunsButton.TabIndex = 20;
+      this.tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");
+      this.colorRunsButton.UseVisualStyleBackColor = true;
+      this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);
       // 
       // colorDialog
@@ -309,4 +309,31 @@
       this.colorYAxisButton.Click += new System.EventHandler(this.colorYAxisButton_Click);
       // 
+      // transparencyTrackBar
+      // 
+      this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+      this.transparencyTrackBar.LargeChange = 16;
+      this.transparencyTrackBar.Location = new System.Drawing.Point(359, 470);
+      this.transparencyTrackBar.Maximum = 254;
+      this.transparencyTrackBar.Name = "transparencyTrackBar";
+      this.transparencyTrackBar.Size = new System.Drawing.Size(64, 45);
+      this.transparencyTrackBar.TabIndex = 24;
+      this.transparencyTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
+      this.tooltip.SetToolTip(this.transparencyTrackBar, "Sets the transparency of the colors");
+      this.transparencyTrackBar.ValueChanged += new System.EventHandler(this.transparencyTrackBar_ValueChanged);
+      // 
+      // hideRunsButton
+      // 
+      this.hideRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+      this.hideRunsButton.Enabled = false;
+      this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
+      this.hideRunsButton.Location = new System.Drawing.Point(177, 469);
+      this.hideRunsButton.Name = "hideRunsButton";
+      this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
+      this.hideRunsButton.TabIndex = 26;
+      this.hideRunsButton.Text = "Hide";
+      this.tooltip.SetToolTip(this.hideRunsButton, "Hides all selected runs");
+      this.hideRunsButton.UseVisualStyleBackColor = true;
+      this.hideRunsButton.Click += new System.EventHandler(this.hideRunsButton_Click);
+      // 
       // noRunsLabel
       // 
@@ -339,17 +366,4 @@
       this.getDataAsMatrixToolStripMenuItem.Click += new System.EventHandler(this.getDataAsMatrixToolStripMenuItem_Click);
       // 
-      // transparencyTrackBar
-      // 
-      this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.transparencyTrackBar.LargeChange = 16;
-      this.transparencyTrackBar.Location = new System.Drawing.Point(359, 470);
-      this.transparencyTrackBar.Maximum = 254;
-      this.transparencyTrackBar.Name = "transparencyTrackBar";
-      this.transparencyTrackBar.Size = new System.Drawing.Size(64, 45);
-      this.transparencyTrackBar.TabIndex = 24;
-      this.transparencyTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
-      this.tooltip.SetToolTip(this.transparencyTrackBar, "Sets the transparency of the colors");
-      this.transparencyTrackBar.ValueChanged += new System.EventHandler(this.transparencyTrackBar_ValueChanged);
-      // 
       // transparencyLabel
       // 
@@ -362,33 +376,33 @@
       this.transparencyLabel.Text = "Transparency:";
       // 
-      // colorRunsButton
-      // 
-      this.colorRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.colorRunsButton.Enabled = false;
-      this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
-      this.colorRunsButton.Location = new System.Drawing.Point(151, 469);
-      this.colorRunsButton.Name = "colorRunsButton";
-      this.colorRunsButton.Size = new System.Drawing.Size(43, 21);
-      this.colorRunsButton.TabIndex = 25;
-      this.colorRunsButton.Text = "Color";
-      this.colorRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");
-      this.colorRunsButton.UseVisualStyleBackColor = true;
-      this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);
-      // 
-      // hideRunsButton
-      // 
-      this.hideRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.hideRunsButton.Enabled = false;
-      this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
-      this.hideRunsButton.Location = new System.Drawing.Point(194, 469);
-      this.hideRunsButton.Name = "hideRunsButton";
-      this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
-      this.hideRunsButton.TabIndex = 26;
-      this.hideRunsButton.Text = "Hide";
-      this.hideRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-      this.tooltip.SetToolTip(this.hideRunsButton, "Hides all selected runs");
-      this.hideRunsButton.UseVisualStyleBackColor = true;
-      this.hideRunsButton.Click += new System.EventHandler(this.hideRunsButton_Click);
+      // unhideAllRunToolStripMenuItem
+      // 
+      this.unhideAllRunToolStripMenuItem.Name = "unhideAllRunToolStripMenuItem";
+      this.unhideAllRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
+      this.unhideAllRunToolStripMenuItem.Text = "Unhide all";
+      this.unhideAllRunToolStripMenuItem.Click += new System.EventHandler(this.unhideAllRunToolStripMenuItem_Click);
+      // 
+      // colorResetToolStripMenuItem
+      // 
+      this.colorResetToolStripMenuItem.Name = "colorResetToolStripMenuItem";
+      this.colorResetToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
+      this.colorResetToolStripMenuItem.Text = "Color reset";
+      this.colorResetToolStripMenuItem.Click += new System.EventHandler(this.colorResetToolStripMenuItem_Click);
+      // 
+      // colorDialogButton
+      // 
+      this.colorDialogButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+      this.colorDialogButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+      this.colorDialogButton.Enabled = false;
+      this.colorDialogButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
+      this.colorDialogButton.Location = new System.Drawing.Point(150, 469);
+      this.colorDialogButton.Name = "colorDialogButton";
+      this.colorDialogButton.Size = new System.Drawing.Size(14, 21);
+      this.colorDialogButton.TabIndex = 25;
+      this.colorDialogButton.Text = "v";
+      this.tooltip.SetToolTip(this.colorDialogButton, "Choose color");
+      this.colorDialogButton.UseVisualStyleBackColor = true;
+      this.colorDialogButton.Click += new System.EventHandler(this.colorDialogButton_Click);
       // 
       // RunCollectionBubbleChartView
@@ -398,5 +412,4 @@
       this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
       this.Controls.Add(this.hideRunsButton);
-      this.Controls.Add(this.colorRunsButton);
       this.Controls.Add(this.transparencyTrackBar);
       this.Controls.Add(this.sizeTrackBar);
@@ -404,7 +417,6 @@
       this.Controls.Add(this.colorXAxisButton);
       this.Controls.Add(this.noRunsLabel);
-      this.Controls.Add(this.colorDialogButton);
+      this.Controls.Add(this.colorRunsButton);
       this.Controls.Add(this.radioButtonGroup);
-      this.Controls.Add(this.chart);
       this.Controls.Add(this.sizeLabel);
       this.Controls.Add(this.sizeComboBox);
@@ -418,4 +430,6 @@
       this.Controls.Add(this.yAxisComboBox);
       this.Controls.Add(this.yTrackBar);
+      this.Controls.Add(this.colorDialogButton);
+      this.Controls.Add(this.chart);
       this.Name = "RunCollectionBubbleChartView";
       this.Size = new System.Drawing.Size(854, 496);
@@ -425,6 +439,6 @@
       this.radioButtonGroup.ResumeLayout(false);
       this.radioButtonGroup.PerformLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();
       ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).EndInit();
-      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -447,10 +461,10 @@
     private System.Windows.Forms.RadioButton selectButton;
     private System.Windows.Forms.GroupBox radioButtonGroup;
-    private System.Windows.Forms.Button colorDialogButton;
+    private System.Windows.Forms.Button colorRunsButton;
     private System.Windows.Forms.ColorDialog colorDialog;
     private System.Windows.Forms.ToolTip tooltip;
     private System.Windows.Forms.Label noRunsLabel;
     private System.Windows.Forms.ToolStripMenuItem openBoxPlotViewToolStripMenuItem;
-    private System.Windows.Forms.ToolStripMenuItem hideRunToolStripMenuItem;
+    private System.Windows.Forms.ToolStripMenuItem hideRunsToolStripMenuItem;
     private System.Windows.Forms.Button colorXAxisButton;
     private System.Windows.Forms.Button colorYAxisButton;
@@ -459,6 +473,8 @@
     private System.Windows.Forms.TrackBar transparencyTrackBar;
     private System.Windows.Forms.Label transparencyLabel;
-    private System.Windows.Forms.Button colorRunsButton;
     private System.Windows.Forms.Button hideRunsButton;
+    private System.Windows.Forms.ToolStripMenuItem unhideAllRunToolStripMenuItem;
+    private System.Windows.Forms.ToolStripMenuItem colorResetToolStripMenuItem;
+    private System.Windows.Forms.Button colorDialogButton;
   }
 }
Index: branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
===================================================================
--- branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs	(revision 9368)
+++ branches/HivePerformance/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs	(revision 9444)
@@ -56,15 +56,22 @@
     private bool suppressUpdates = false;
 
+    private const double transperencyExponent = 2.5;
+
+    private RunCollectionContentConstraint visibilityConstraint = new RunCollectionContentConstraint() { Active = true };
 
     public RunCollectionBubbleChartView() {
       InitializeComponent();
 
-      chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem);
-      chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem);
-      chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(1, getDataAsMatrixToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(2, new ToolStripSeparator());
+      chart.ContextMenuStrip.Items.Insert(3, hideRunsToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(4, unhideAllRunToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(5, colorResetToolStripMenuItem);
+      chart.ContextMenuStrip.Items.Insert(6, new ToolStripSeparator());
       chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);
 
-      colorDialog.Color = Color.Black;
-      colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
+      colorDialog.Color = Color.Orange;
+      colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
       isSelecting = false;
 
@@ -167,5 +174,5 @@
             point.MarkerStyle = MarkerStyle.Cross;
           } else {
-            point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, ((IRun)point.Tag).Color);
+            point.Color = Color.FromArgb(255 - LogTransform(transparencyTrackBar.Value), ((IRun)point.Tag).Color);
             point.MarkerStyle = MarkerStyle.Circle;
           }
@@ -310,5 +317,5 @@
       double sizeRange = maxSizeValue - minSizeValue;
 
-      const int smallestBubbleSize = 5;
+      const int smallestBubbleSize = 7;
 
       foreach (DataPoint point in series.Points) {
@@ -331,7 +338,4 @@
       var yAxis = this.chart.ChartAreas[0].AxisY;
 
-      SetAutomaticUpdateOfAxis(xAxis, false);
-      SetAutomaticUpdateOfAxis(yAxis, false);
-
       double xAxisRange = xAxis.Maximum - xAxis.Minimum;
       double yAxisRange = yAxis.Maximum - yAxis.Minimum;
@@ -351,4 +355,12 @@
       }
 
+      if (xJitterFactor.IsAlmost(0.0) && yJitterFactor.IsAlmost(0.0)) {
+        SetAutomaticUpdateOfAxis(xAxis, true);
+        SetAutomaticUpdateOfAxis(yAxis, true);
+        chart.ChartAreas[0].RecalculateAxesScale();
+      } else {
+        SetAutomaticUpdateOfAxis(xAxis, false);
+        SetAutomaticUpdateOfAxis(yAxis, false);
+      }
     }
 
@@ -431,7 +443,6 @@
       if (!this.categoricalMapping.ContainsKey(dimension)) {
         this.categoricalMapping[dimension] = new Dictionary<object, double>();
-        var orderedCategories = Content.Where(r => r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
-                                    .Distinct()
-                                    .OrderBy(x => x, new NaturalStringComparer());
+        var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString())
+                                    .Distinct().OrderBy(x => x, new NaturalStringComparer());
         int count = 1;
         foreach (var category in orderedCategories) {
@@ -535,4 +546,8 @@
       double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd);
 
+      if (Control.ModifierKeys != Keys.Control) {
+        ClearSelectedRuns();
+      }
+
       //check for click to select a single model
       if (minX == maxX && minY == maxY) {
@@ -545,10 +560,9 @@
           point.MarkerStyle = MarkerStyle.Cross;
           selectedRuns.Add(run);
-
-        } else ClearSelectedRuns();
+        }
       } else {
         foreach (DataPoint point in this.chart.Series[0].Points) {
-          if (point.XValue < minX || point.XValue >= maxX) continue;
-          if (point.YValues[0] < minY || point.YValues[0] >= maxY) continue;
+          if (point.XValue < minX || point.XValue > maxX) continue;
+          if (point.YValues[0] < minY || point.YValues[0] > maxY) continue;
           point.MarkerStyle = MarkerStyle.Cross;
           point.Color = Color.Red;
@@ -688,6 +702,6 @@
     private void zoomButton_CheckedChanged(object sender, EventArgs e) {
       this.isSelecting = selectButton.Checked;
+      this.colorRunsButton.Enabled = this.isSelecting;
       this.colorDialogButton.Enabled = this.isSelecting;
-      this.colorRunsButton.Enabled = this.isSelecting;
       this.hideRunsButton.Enabled = this.isSelecting;
       this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting;
@@ -701,30 +715,36 @@
       var chartPos = chart.PointToClient(pos);
 
-      HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y);
+      HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y, ChartElementType.DataPoint);
       if (h.ChartElementType == ChartElementType.DataPoint) {
         runToHide = (IRun)((DataPoint)h.Object).Tag;
-        hideRunToolStripMenuItem.Visible = true;
+        hideRunsToolStripMenuItem.Visible = true;
       } else {
         runToHide = null;
-        hideRunToolStripMenuItem.Visible = false;
-      }
-
-    }
-    private void hideRunToolStripMenuItem_Click(object sender, EventArgs e) {
-      var constraint = Content.Constraints.OfType<RunCollectionContentConstraint>().FirstOrDefault(c => c.Active);
-      if (constraint == null) {
-        constraint = new RunCollectionContentConstraint();
-        Content.Constraints.Add(constraint);
-        constraint.Active = true;
-      }
-      constraint.ConstraintData.Add(runToHide);
+        hideRunsToolStripMenuItem.Visible = false;
+      }
+    }
+
+    private void unhideAllRunToolStripMenuItem_Click(object sender, EventArgs e) {
+      visibilityConstraint.ConstraintData.Clear();
+      if (Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Remove(visibilityConstraint);
+    }
+    private void hideRunsToolStripMenuItem_Click(object sender, EventArgs e) {
+      HideRuns(selectedRuns);
+      //could not use ClearSelectedRuns as the runs are not visible anymore
+      selectedRuns.Clear();
     }
     private void hideRunsButton_Click(object sender, EventArgs e) {
-      if (!selectedRuns.Any()) return;
-      var constraint = new RunCollectionContentConstraint();
-      constraint.ConstraintData = new ItemSet<IRun>(selectedRuns);
-      Content.Constraints.Add(constraint);
-      ClearSelectedRuns();
-      constraint.Active = true;
+      HideRuns(selectedRuns);
+      //could not use ClearSelectedRuns as the runs are not visible anymore
+      selectedRuns.Clear();
+    }
+
+    private void HideRuns(IEnumerable<IRun> runs) {
+      visibilityConstraint.Active = false;
+      if (!Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Add(visibilityConstraint);
+      foreach (var run in selectedRuns) {
+        visibilityConstraint.ConstraintData.Add(run);
+      }
+      visibilityConstraint.Active = true;
     }
 
@@ -733,8 +753,17 @@
         foreach (var point in runToDataPointMapping[run]) {
           point.MarkerStyle = MarkerStyle.Circle;
-          point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, run.Color);
+          point.Color = Color.FromArgb(255 - LogTransform(transparencyTrackBar.Value), run.Color);
         }
       }
       selectedRuns.Clear();
+    }
+
+    // returns a value in [0..255]
+    private int LogTransform(int x) {
+      double min = transparencyTrackBar.Minimum;
+      double max = transparencyTrackBar.Maximum;
+      double r = (x - min) / (max - min);  // r \in [0..1]
+      double l = Math.Max(Math.Min((1.0 - Math.Pow(0.05, r)) / 0.95, 1), 0); // l \in [0..1]
+      return (int)Math.Round(255.0 * l);
     }
 
@@ -791,7 +820,21 @@
 
     #region coloring
+    private void colorResetToolStripMenuItem_Click(object sender, EventArgs e) {
+      Content.UpdateOfRunsInProgress = true;
+
+      IEnumerable<IRun> runs;
+      if (selectedRuns.Any()) runs = selectedRuns;
+      else runs = Content;
+
+      foreach (var run in runs)
+        run.Color = Color.Black;
+      ClearSelectedRuns();
+
+      Content.UpdateOfRunsInProgress = false;
+    }
     private void colorDialogButton_Click(object sender, EventArgs e) {
       if (colorDialog.ShowDialog(this) == DialogResult.OK) {
-        this.colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
+        this.colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
+        colorRunsButton_Click(sender, e);
       }
     }
