Changeset 9835 for branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
- Timestamp:
- 08/01/13 13:01:40 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking
- Property svn:ignore
-
old new 1 *.suo 2 _ReSharper.HeuristicLab.Tracking 1 _ReSharper.Sliding Window GP 3 2 bin
-
- Property svn:mergeinfo changed
/branches/Sliding Window GP (added) merged: 7820,7837,7845,7850,9047,9126,9145,9162-9165 -
Property
svn:global-ignores
set to
_ReSharper.HeuristicLab.Tracking
- Property svn:ignore
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimization.Views merged: 9435,9438,9441,9447-9448,9456,9462,9474,9476-9477,9506,9613
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r9421 r9835 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 56 56 private bool suppressUpdates = false; 57 57 58 private RunCollectionContentConstraint visibilityConstraint = new RunCollectionContentConstraint() { Active = true }; 58 59 59 60 public RunCollectionBubbleChartView() { 60 61 InitializeComponent(); 61 62 62 chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem); 63 chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem); 64 chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem); 63 chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem); 64 chart.ContextMenuStrip.Items.Insert(1, getDataAsMatrixToolStripMenuItem); 65 chart.ContextMenuStrip.Items.Insert(2, new ToolStripSeparator()); 66 chart.ContextMenuStrip.Items.Insert(3, hideRunsToolStripMenuItem); 67 chart.ContextMenuStrip.Items.Insert(4, unhideAllRunToolStripMenuItem); 68 chart.ContextMenuStrip.Items.Insert(5, colorResetToolStripMenuItem); 69 chart.ContextMenuStrip.Items.Insert(6, new ToolStripSeparator()); 65 70 chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening); 66 71 67 colorDialog.Color = Color. Black;68 color DialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);72 colorDialog.Color = Color.Orange; 73 colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color); 69 74 isSelecting = false; 70 75 … … 167 172 point.MarkerStyle = MarkerStyle.Cross; 168 173 } else { 169 point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, ((IRun)point.Tag).Color);174 point.Color = Color.FromArgb(255 - LogTransform(transparencyTrackBar.Value), ((IRun)point.Tag).Color); 170 175 point.MarkerStyle = MarkerStyle.Circle; 171 176 } … … 310 315 double sizeRange = maxSizeValue - minSizeValue; 311 316 312 const int smallestBubbleSize = 5;317 const int smallestBubbleSize = 7; 313 318 314 319 foreach (DataPoint point in series.Points) { … … 331 336 var yAxis = this.chart.ChartAreas[0].AxisY; 332 337 333 SetAutomaticUpdateOfAxis(xAxis, false);334 SetAutomaticUpdateOfAxis(yAxis, false);335 336 338 double xAxisRange = xAxis.Maximum - xAxis.Minimum; 337 339 double yAxisRange = yAxis.Maximum - yAxis.Minimum; … … 351 353 } 352 354 355 if (xJitterFactor.IsAlmost(0.0) && yJitterFactor.IsAlmost(0.0)) { 356 SetAutomaticUpdateOfAxis(xAxis, true); 357 SetAutomaticUpdateOfAxis(yAxis, true); 358 chart.ChartAreas[0].RecalculateAxesScale(); 359 } else { 360 SetAutomaticUpdateOfAxis(xAxis, false); 361 SetAutomaticUpdateOfAxis(yAxis, false); 362 } 353 363 } 354 364 … … 431 441 if (!this.categoricalMapping.ContainsKey(dimension)) { 432 442 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()); 443 var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString()) 444 .Distinct().OrderBy(x => x, new NaturalStringComparer()); 436 445 int count = 1; 437 446 foreach (var category in orderedCategories) { … … 535 544 double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd); 536 545 546 if (Control.ModifierKeys != Keys.Control) { 547 ClearSelectedRuns(); 548 } 549 537 550 //check for click to select a single model 538 551 if (minX == maxX && minY == maxY) { … … 542 555 var point = chart.Series[0].Points[pointIndex]; 543 556 IRun run = (IRun)point.Tag; 544 point.Color = Color.Red; 545 point.MarkerStyle = MarkerStyle.Cross; 546 selectedRuns.Add(run); 547 548 } else ClearSelectedRuns(); 557 if (selectedRuns.Contains(run)) { 558 point.MarkerStyle = MarkerStyle.Circle; 559 point.Color = Color.FromArgb(255 - LogTransform(transparencyTrackBar.Value), run.Color); 560 selectedRuns.Remove(run); 561 } else { 562 point.Color = Color.Red; 563 point.MarkerStyle = MarkerStyle.Cross; 564 selectedRuns.Add(run); 565 } 566 } 549 567 } else { 550 568 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;569 if (point.XValue < minX || point.XValue > maxX) continue; 570 if (point.YValues[0] < minY || point.YValues[0] > maxY) continue; 553 571 point.MarkerStyle = MarkerStyle.Cross; 554 572 point.Color = Color.Red; … … 688 706 private void zoomButton_CheckedChanged(object sender, EventArgs e) { 689 707 this.isSelecting = selectButton.Checked; 708 this.colorRunsButton.Enabled = this.isSelecting; 690 709 this.colorDialogButton.Enabled = this.isSelecting; 691 this.colorRunsButton.Enabled = this.isSelecting;692 710 this.hideRunsButton.Enabled = this.isSelecting; 693 711 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting; … … 696 714 } 697 715 698 private IRun runToHide = null;699 716 private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { 700 var pos = Control.MousePosition; 701 var chartPos = chart.PointToClient(pos); 702 703 HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y); 704 if (h.ChartElementType == ChartElementType.DataPoint) { 705 runToHide = (IRun)((DataPoint)h.Object).Tag; 706 hideRunToolStripMenuItem.Visible = true; 707 } else { 708 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); 717 hideRunsToolStripMenuItem.Visible = selectedRuns.Any(); 718 } 719 720 private void unhideAllRunToolStripMenuItem_Click(object sender, EventArgs e) { 721 visibilityConstraint.ConstraintData.Clear(); 722 if (Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Remove(visibilityConstraint); 723 } 724 private void hideRunsToolStripMenuItem_Click(object sender, EventArgs e) { 725 HideRuns(selectedRuns); 726 //could not use ClearSelectedRuns as the runs are not visible anymore 727 selectedRuns.Clear(); 721 728 } 722 729 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; 730 HideRuns(selectedRuns); 731 //could not use ClearSelectedRuns as the runs are not visible anymore 732 selectedRuns.Clear(); 733 } 734 735 private void HideRuns(IEnumerable<IRun> runs) { 736 visibilityConstraint.Active = false; 737 if (!Content.Constraints.Contains(visibilityConstraint)) Content.Constraints.Add(visibilityConstraint); 738 foreach (var run in runs) { 739 visibilityConstraint.ConstraintData.Add(run); 740 } 741 visibilityConstraint.Active = true; 729 742 } 730 743 … … 744 757 double max = transparencyTrackBar.Maximum; 745 758 double r = (x - min) / (max - min); // r \in [0..1] 746 double l = Math. Log(r + 1) / Math.Log(2.0); // l \in [0..1]759 double l = Math.Max(Math.Min((1.0 - Math.Pow(0.05, r)) / 0.95, 1), 0); // l \in [0..1] 747 760 return (int)Math.Round(255.0 * l); 748 761 } … … 800 813 801 814 #region coloring 815 private void colorResetToolStripMenuItem_Click(object sender, EventArgs e) { 816 Content.UpdateOfRunsInProgress = true; 817 818 IEnumerable<IRun> runs; 819 if (selectedRuns.Any()) runs = selectedRuns; 820 else runs = Content; 821 822 foreach (var run in runs) 823 run.Color = Color.Black; 824 ClearSelectedRuns(); 825 826 Content.UpdateOfRunsInProgress = false; 827 } 802 828 private void colorDialogButton_Click(object sender, EventArgs e) { 803 829 if (colorDialog.ShowDialog(this) == DialogResult.OK) { 804 this.colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color); 830 this.colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color); 831 colorRunsButton_Click(sender, e); 805 832 } 806 833 }
Note: See TracChangeset
for help on using the changeset viewer.