Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9435


Ignore:
Timestamp:
05/03/13 16:46:26 (11 years ago)
Author:
mkommend
Message:

#2016: Added patch from sforsten, that improves the BubbleChart- and BoxPlotView.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs

    r9312 r9435  
    328328      if (!this.categoricalMapping.ContainsKey(dimension)) {
    329329        this.categoricalMapping[dimension] = new Dictionary<object, double>();
    330         var orderedCategories = Content.Where(r=> r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
    331                                 .Distinct()
    332                                 .OrderBy(x => x, new NaturalStringComparer());
     330        var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString())
     331                                       .Distinct().OrderBy(x => x, new NaturalStringComparer());
    333332        int count = 1;
    334333        foreach (var category in orderedCategories) {
     
    389388      axis.CustomLabels.Clear();
    390389      if (categoricalMapping.ContainsKey(dimension)) {
    391         foreach (var pair in categoricalMapping[dimension]) {
     390        int position = 1;
     391        foreach (var pair in categoricalMapping[dimension].Where(x => seriesCache.ContainsKey(x.Value))) {
    392392          string labelText = pair.Key.ToString();
    393393          CustomLabel label = new CustomLabel();
     
    397397          label.Text = labelText;
    398398          label.GridTicks = GridTickTypes.TickMark;
    399           label.FromPosition = pair.Value - 0.5;
    400           label.ToPosition = pair.Value + 0.5;
     399          label.FromPosition = position - 0.5;
     400          label.ToPosition = position + 0.5;
    401401          axis.CustomLabels.Add(label);
     402          position++;
    402403        }
    403404      } else if (dimension > 0 && Content.GetValue(0, dimension) is TimeSpanValue) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs

    r9313 r9435  
    4848      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4949      System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
    50       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView));
    5150      this.yJitterLabel = new System.Windows.Forms.Label();
    5251      this.xJitterlabel = new System.Windows.Forms.Label();
     
    6160      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    6261      this.openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    63       this.hideRunToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     62      this.hideRunsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    6463      this.zoomButton = new System.Windows.Forms.RadioButton();
    6564      this.selectButton = new System.Windows.Forms.RadioButton();
    6665      this.radioButtonGroup = new System.Windows.Forms.GroupBox();
    67       this.colorDialogButton = new System.Windows.Forms.Button();
     66      this.colorRunsButton = new System.Windows.Forms.Button();
    6867      this.colorDialog = new System.Windows.Forms.ColorDialog();
    6968      this.tooltip = new System.Windows.Forms.ToolTip(this.components);
    7069      this.colorXAxisButton = new System.Windows.Forms.Button();
    7170      this.colorYAxisButton = new System.Windows.Forms.Button();
     71      this.transparencyTrackBar = new System.Windows.Forms.TrackBar();
     72      this.hideRunsButton = new System.Windows.Forms.Button();
    7273      this.noRunsLabel = new System.Windows.Forms.Label();
    7374      this.sizeTrackBar = new System.Windows.Forms.TrackBar();
    7475      this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    75       this.transparencyTrackBar = new System.Windows.Forms.TrackBar();
    7676      this.transparencyLabel = new System.Windows.Forms.Label();
    77       this.colorRunsButton = new System.Windows.Forms.Button();
    78       this.hideRunsButton = new System.Windows.Forms.Button();
     77      this.unhideAllRunToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     78      this.colorResetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     79      this.colorDialogButton = new System.Windows.Forms.Button();
    7980      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    8081      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
    8182      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    8283      this.radioButtonGroup.SuspendLayout();
     84      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();
    8385      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).BeginInit();
    84       ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();
    8586      this.SuspendLayout();
    8687      //
     
    222223      this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click);
    223224      //
    224       // hideRunToolStripMenuItem
    225       //
    226       this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem";
    227       this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
    228       this.hideRunToolStripMenuItem.Text = "Hide Run";
    229       this.hideRunToolStripMenuItem.Click += new System.EventHandler(this.hideRunToolStripMenuItem_Click);
     225      // hideRunsToolStripMenuItem
     226      //
     227      this.hideRunsToolStripMenuItem.Name = "hideRunsToolStripMenuItem";
     228      this.hideRunsToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     229      this.hideRunsToolStripMenuItem.Text = "Hide selected Runs";
     230      this.hideRunsToolStripMenuItem.Click += new System.EventHandler(this.hideRunsToolStripMenuItem_Click);
    230231      //
    231232      // zoomButton
     
    265266      this.radioButtonGroup.TabStop = false;
    266267      //
    267       // colorDialogButton
    268       //
    269       this.colorDialogButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    270       this.colorDialogButton.Enabled = false;
    271       this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    272       this.colorDialogButton.Location = new System.Drawing.Point(130, 469);
    273       this.colorDialogButton.Name = "colorDialogButton";
    274       this.colorDialogButton.Size = new System.Drawing.Size(21, 21);
    275       this.colorDialogButton.TabIndex = 20;
    276       this.colorDialogButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    277       this.tooltip.SetToolTip(this.colorDialogButton, "Choose color");
    278       this.colorDialogButton.UseVisualStyleBackColor = true;
    279       this.colorDialogButton.Click += new System.EventHandler(this.colorDialogButton_Click);
     268      // colorRunsButton
     269      //
     270      this.colorRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     271      this.colorRunsButton.Enabled = false;
     272      this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     273      this.colorRunsButton.Location = new System.Drawing.Point(130, 469);
     274      this.colorRunsButton.Name = "colorRunsButton";
     275      this.colorRunsButton.Size = new System.Drawing.Size(21, 21);
     276      this.colorRunsButton.TabIndex = 20;
     277      this.tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");
     278      this.colorRunsButton.UseVisualStyleBackColor = true;
     279      this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);
    280280      //
    281281      // colorDialog
     
    309309      this.colorYAxisButton.Click += new System.EventHandler(this.colorYAxisButton_Click);
    310310      //
     311      // transparencyTrackBar
     312      //
     313      this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     314      this.transparencyTrackBar.LargeChange = 16;
     315      this.transparencyTrackBar.Location = new System.Drawing.Point(359, 470);
     316      this.transparencyTrackBar.Maximum = 254;
     317      this.transparencyTrackBar.Name = "transparencyTrackBar";
     318      this.transparencyTrackBar.Size = new System.Drawing.Size(64, 45);
     319      this.transparencyTrackBar.TabIndex = 24;
     320      this.transparencyTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     321      this.tooltip.SetToolTip(this.transparencyTrackBar, "Sets the transparency of the colors");
     322      this.transparencyTrackBar.ValueChanged += new System.EventHandler(this.transparencyTrackBar_ValueChanged);
     323      //
     324      // hideRunsButton
     325      //
     326      this.hideRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     327      this.hideRunsButton.Enabled = false;
     328      this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     329      this.hideRunsButton.Location = new System.Drawing.Point(177, 469);
     330      this.hideRunsButton.Name = "hideRunsButton";
     331      this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
     332      this.hideRunsButton.TabIndex = 26;
     333      this.hideRunsButton.Text = "Hide";
     334      this.tooltip.SetToolTip(this.hideRunsButton, "Hides all selected runs");
     335      this.hideRunsButton.UseVisualStyleBackColor = true;
     336      this.hideRunsButton.Click += new System.EventHandler(this.hideRunsButton_Click);
     337      //
    311338      // noRunsLabel
    312339      //
     
    339366      this.getDataAsMatrixToolStripMenuItem.Click += new System.EventHandler(this.getDataAsMatrixToolStripMenuItem_Click);
    340367      //
    341       // transparencyTrackBar
    342       //
    343       this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    344       this.transparencyTrackBar.LargeChange = 16;
    345       this.transparencyTrackBar.Location = new System.Drawing.Point(359, 470);
    346       this.transparencyTrackBar.Maximum = 254;
    347       this.transparencyTrackBar.Name = "transparencyTrackBar";
    348       this.transparencyTrackBar.Size = new System.Drawing.Size(64, 45);
    349       this.transparencyTrackBar.TabIndex = 24;
    350       this.transparencyTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    351       this.tooltip.SetToolTip(this.transparencyTrackBar, "Sets the transparency of the colors");
    352       this.transparencyTrackBar.ValueChanged += new System.EventHandler(this.transparencyTrackBar_ValueChanged);
    353       //
    354368      // transparencyLabel
    355369      //
     
    362376      this.transparencyLabel.Text = "Transparency:";
    363377      //
    364       // colorRunsButton
    365       //
    366       this.colorRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    367       this.colorRunsButton.Enabled = false;
    368       this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    369       this.colorRunsButton.Location = new System.Drawing.Point(151, 469);
    370       this.colorRunsButton.Name = "colorRunsButton";
    371       this.colorRunsButton.Size = new System.Drawing.Size(43, 21);
    372       this.colorRunsButton.TabIndex = 25;
    373       this.colorRunsButton.Text = "Color";
    374       this.colorRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    375       this.tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");
    376       this.colorRunsButton.UseVisualStyleBackColor = true;
    377       this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);
    378       //
    379       // hideRunsButton
    380       //
    381       this.hideRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    382       this.hideRunsButton.Enabled = false;
    383       this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    384       this.hideRunsButton.Location = new System.Drawing.Point(194, 469);
    385       this.hideRunsButton.Name = "hideRunsButton";
    386       this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
    387       this.hideRunsButton.TabIndex = 26;
    388       this.hideRunsButton.Text = "Hide";
    389       this.hideRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    390       this.tooltip.SetToolTip(this.hideRunsButton, "Hides all selected runs");
    391       this.hideRunsButton.UseVisualStyleBackColor = true;
    392       this.hideRunsButton.Click += new System.EventHandler(this.hideRunsButton_Click);
     378      // unhideAllRunToolStripMenuItem
     379      //
     380      this.unhideAllRunToolStripMenuItem.Name = "unhideAllRunToolStripMenuItem";
     381      this.unhideAllRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     382      this.unhideAllRunToolStripMenuItem.Text = "Unhide all";
     383      this.unhideAllRunToolStripMenuItem.Click += new System.EventHandler(this.unhideAllRunToolStripMenuItem_Click);
     384      //
     385      // colorResetToolStripMenuItem
     386      //
     387      this.colorResetToolStripMenuItem.Name = "colorResetToolStripMenuItem";
     388      this.colorResetToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     389      this.colorResetToolStripMenuItem.Text = "Color reset";
     390      this.colorResetToolStripMenuItem.Click += new System.EventHandler(this.colorResetToolStripMenuItem_Click);
     391      //
     392      // colorDialogButton
     393      //
     394      this.colorDialogButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     395      this.colorDialogButton.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     396      this.colorDialogButton.Enabled = false;
     397      this.colorDialogButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     398      this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     399      this.colorDialogButton.Location = new System.Drawing.Point(150, 469);
     400      this.colorDialogButton.Name = "colorDialogButton";
     401      this.colorDialogButton.Size = new System.Drawing.Size(14, 21);
     402      this.colorDialogButton.TabIndex = 25;
     403      this.colorDialogButton.Text = "v";
     404      this.tooltip.SetToolTip(this.colorDialogButton, "Choose color");
     405      this.colorDialogButton.UseVisualStyleBackColor = true;
     406      this.colorDialogButton.Click += new System.EventHandler(this.colorDialogButton_Click);
    393407      //
    394408      // RunCollectionBubbleChartView
     
    398412      this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    399413      this.Controls.Add(this.hideRunsButton);
    400       this.Controls.Add(this.colorRunsButton);
    401414      this.Controls.Add(this.transparencyTrackBar);
    402415      this.Controls.Add(this.sizeTrackBar);
     
    404417      this.Controls.Add(this.colorXAxisButton);
    405418      this.Controls.Add(this.noRunsLabel);
    406       this.Controls.Add(this.colorDialogButton);
     419      this.Controls.Add(this.colorRunsButton);
    407420      this.Controls.Add(this.radioButtonGroup);
    408       this.Controls.Add(this.chart);
    409421      this.Controls.Add(this.sizeLabel);
    410422      this.Controls.Add(this.sizeComboBox);
     
    418430      this.Controls.Add(this.yAxisComboBox);
    419431      this.Controls.Add(this.yTrackBar);
     432      this.Controls.Add(this.colorDialogButton);
     433      this.Controls.Add(this.chart);
    420434      this.Name = "RunCollectionBubbleChartView";
    421435      this.Size = new System.Drawing.Size(854, 496);
     
    425439      this.radioButtonGroup.ResumeLayout(false);
    426440      this.radioButtonGroup.PerformLayout();
     441      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();
    427442      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).EndInit();
    428       ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();
    429443      this.ResumeLayout(false);
    430444      this.PerformLayout();
     
    447461    private System.Windows.Forms.RadioButton selectButton;
    448462    private System.Windows.Forms.GroupBox radioButtonGroup;
    449     private System.Windows.Forms.Button colorDialogButton;
     463    private System.Windows.Forms.Button colorRunsButton;
    450464    private System.Windows.Forms.ColorDialog colorDialog;
    451465    private System.Windows.Forms.ToolTip tooltip;
    452466    private System.Windows.Forms.Label noRunsLabel;
    453467    private System.Windows.Forms.ToolStripMenuItem openBoxPlotViewToolStripMenuItem;
    454     private System.Windows.Forms.ToolStripMenuItem hideRunToolStripMenuItem;
     468    private System.Windows.Forms.ToolStripMenuItem hideRunsToolStripMenuItem;
    455469    private System.Windows.Forms.Button colorXAxisButton;
    456470    private System.Windows.Forms.Button colorYAxisButton;
     
    459473    private System.Windows.Forms.TrackBar transparencyTrackBar;
    460474    private System.Windows.Forms.Label transparencyLabel;
    461     private System.Windows.Forms.Button colorRunsButton;
    462475    private System.Windows.Forms.Button hideRunsButton;
     476    private System.Windows.Forms.ToolStripMenuItem unhideAllRunToolStripMenuItem;
     477    private System.Windows.Forms.ToolStripMenuItem colorResetToolStripMenuItem;
     478    private System.Windows.Forms.Button colorDialogButton;
    463479  }
    464480}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r9404 r9435  
    5656    private bool suppressUpdates = false;
    5757
     58    private const double transperencyExponent = 2.5;
     59
     60    private RunCollectionContentConstraint visibilityConstraint = new RunCollectionContentConstraint() { Active = true };
    5861
    5962    public RunCollectionBubbleChartView() {
    6063      InitializeComponent();
    6164
    62       chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem);
    63       chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem);
    64       chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem);
     65      chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem);
     66      chart.ContextMenuStrip.Items.Insert(1, getDataAsMatrixToolStripMenuItem);
     67      chart.ContextMenuStrip.Items.Insert(2, new ToolStripSeparator());
     68      chart.ContextMenuStrip.Items.Insert(3, hideRunsToolStripMenuItem);
     69      chart.ContextMenuStrip.Items.Insert(4, unhideAllRunToolStripMenuItem);
     70      chart.ContextMenuStrip.Items.Insert(5, colorResetToolStripMenuItem);
     71      chart.ContextMenuStrip.Items.Insert(6, new ToolStripSeparator());
    6572      chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);
    6673
    67       colorDialog.Color = Color.Black;
    68       colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
     74      colorDialog.Color = Color.Orange;
     75      colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
    6976      isSelecting = false;
    7077
     
    167174            point.MarkerStyle = MarkerStyle.Cross;
    168175          } else {
    169             point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, ((IRun)point.Tag).Color);
     176            point.Color = Color.FromArgb(255 - LogTransform(transparencyTrackBar.Value), ((IRun)point.Tag).Color);
    170177            point.MarkerStyle = MarkerStyle.Circle;
    171178          }
     
    310317      double sizeRange = maxSizeValue - minSizeValue;
    311318
    312       const int smallestBubbleSize = 5;
     319      const int smallestBubbleSize = 7;
    313320
    314321      foreach (DataPoint point in series.Points) {
     
    331338      var yAxis = this.chart.ChartAreas[0].AxisY;
    332339
    333       SetAutomaticUpdateOfAxis(xAxis, false);
    334       SetAutomaticUpdateOfAxis(yAxis, false);
    335 
    336340      double xAxisRange = xAxis.Maximum - xAxis.Minimum;
    337341      double yAxisRange = yAxis.Maximum - yAxis.Minimum;
     
    351355      }
    352356
     357      if (xJitterFactor.IsAlmost(0.0) && yJitterFactor.IsAlmost(0.0)) {
     358        SetAutomaticUpdateOfAxis(xAxis, true);
     359        SetAutomaticUpdateOfAxis(yAxis, true);
     360        chart.ChartAreas[0].RecalculateAxesScale();
     361      } else {
     362        SetAutomaticUpdateOfAxis(xAxis, false);
     363        SetAutomaticUpdateOfAxis(yAxis, false);
     364      }
    353365    }
    354366
     
    431443      if (!this.categoricalMapping.ContainsKey(dimension)) {
    432444        this.categoricalMapping[dimension] = new Dictionary<object, double>();
    433         var orderedCategories = Content.Where(r => r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
    434                                     .Distinct()
    435                                     .OrderBy(x => x, new NaturalStringComparer());
     445        var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString())
     446                                    .Distinct().OrderBy(x => x, new NaturalStringComparer());
    436447        int count = 1;
    437448        foreach (var category in orderedCategories) {
     
    535546      double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd);
    536547
     548      if (Control.ModifierKeys != Keys.Control) {
     549        ClearSelectedRuns();
     550      }
     551
    537552      //check for click to select a single model
    538553      if (minX == maxX && minY == maxY) {
     
    545560          point.MarkerStyle = MarkerStyle.Cross;
    546561          selectedRuns.Add(run);
    547 
    548         } else ClearSelectedRuns();
     562        }
    549563      } else {
    550564        foreach (DataPoint point in this.chart.Series[0].Points) {
    551           if (point.XValue < minX || point.XValue >= maxX) continue;
    552           if (point.YValues[0] < minY || point.YValues[0] >= maxY) continue;
     565          if (point.XValue < minX || point.XValue > maxX) continue;
     566          if (point.YValues[0] < minY || point.YValues[0] > maxY) continue;
    553567          point.MarkerStyle = MarkerStyle.Cross;
    554568          point.Color = Color.Red;
     
    688702    private void zoomButton_CheckedChanged(object sender, EventArgs e) {
    689703      this.isSelecting = selectButton.Checked;
     704      this.colorRunsButton.Enabled = this.isSelecting;
    690705      this.colorDialogButton.Enabled = this.isSelecting;
    691       this.colorRunsButton.Enabled = this.isSelecting;
    692706      this.hideRunsButton.Enabled = this.isSelecting;
    693707      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting;
     
    701715      var chartPos = chart.PointToClient(pos);
    702716
    703       HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y);
     717      HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y, ChartElementType.DataPoint);
    704718      if (h.ChartElementType == ChartElementType.DataPoint) {
    705719        runToHide = (IRun)((DataPoint)h.Object).Tag;
    706         hideRunToolStripMenuItem.Visible = true;
     720        hideRunsToolStripMenuItem.Visible = true;
    707721      } else {
    708722        runToHide = null;
    709         hideRunToolStripMenuItem.Visible = false;
    710       }
    711 
    712     }
    713     private void hideRunToolStripMenuItem_Click(object sender, EventArgs e) {
    714       var constraint = Content.Constraints.OfType<RunCollectionContentConstraint>().FirstOrDefault(c => c.Active);
    715       if (constraint == null) {
    716         constraint = new RunCollectionContentConstraint();
    717         Content.Constraints.Add(constraint);
    718         constraint.Active = true;
    719       }
    720       constraint.ConstraintData.Add(runToHide);
     723        hideRunsToolStripMenuItem.Visible = false;
     724      }
     725    }
     726
     727    private void unhideAllRunToolStripMenuItem_Click(object sender, EventArgs e) {
     728      visibilityConstraint.ConstraintData.Clear();
     729      if (Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Remove(visibilityConstraint);
     730    }
     731    private void hideRunsToolStripMenuItem_Click(object sender, EventArgs e) {
     732      HideRuns(selectedRuns);
     733      //could not use ClearSelectedRuns as the runs are not visible anymore
     734      selectedRuns.Clear();
    721735    }
    722736    private void hideRunsButton_Click(object sender, EventArgs e) {
    723       if (!selectedRuns.Any()) return;
    724       var constraint = new RunCollectionContentConstraint();
    725       constraint.ConstraintData = new ItemSet<IRun>(selectedRuns);
    726       Content.Constraints.Add(constraint);
    727       ClearSelectedRuns();
    728       constraint.Active = true;
     737      HideRuns(selectedRuns);
     738      //could not use ClearSelectedRuns as the runs are not visible anymore
     739      selectedRuns.Clear();
     740    }
     741
     742    private void HideRuns(IEnumerable<IRun> runs) {
     743      visibilityConstraint.Active = false;
     744      if (!Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Add(visibilityConstraint);
     745      foreach (var run in selectedRuns) {
     746        visibilityConstraint.ConstraintData.Add(run);
     747      }
     748      visibilityConstraint.Active = true;
    729749    }
    730750
     
    800820
    801821    #region coloring
     822    private void colorResetToolStripMenuItem_Click(object sender, EventArgs e) {
     823      Content.UpdateOfRunsInProgress = true;
     824
     825      IEnumerable<IRun> runs;
     826      if (selectedRuns.Any()) runs = selectedRuns;
     827      else runs = Content;
     828
     829      foreach (var run in runs)
     830        run.Color = Color.Black;
     831      ClearSelectedRuns();
     832
     833      Content.UpdateOfRunsInProgress = false;
     834    }
    802835    private void colorDialogButton_Click(object sender, EventArgs e) {
    803836      if (colorDialog.ShowDialog(this) == DialogResult.OK) {
    804         this.colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
     837        this.colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
     838        colorRunsButton_Click(sender, e);
    805839      }
    806840    }
Note: See TracChangeset for help on using the changeset viewer.