Changeset 9435
- Timestamp:
- 05/03/13 16:46:26 (12 years ago)
- 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 328 328 if (!this.categoricalMapping.ContainsKey(dimension)) { 329 329 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()); 333 332 int count = 1; 334 333 foreach (var category in orderedCategories) { … … 389 388 axis.CustomLabels.Clear(); 390 389 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))) { 392 392 string labelText = pair.Key.ToString(); 393 393 CustomLabel label = new CustomLabel(); … … 397 397 label.Text = labelText; 398 398 label.GridTicks = GridTickTypes.TickMark; 399 label.FromPosition = p air.Value- 0.5;400 label.ToPosition = p air.Value+ 0.5;399 label.FromPosition = position - 0.5; 400 label.ToPosition = position + 0.5; 401 401 axis.CustomLabels.Add(label); 402 position++; 402 403 } 403 404 } else if (dimension > 0 && Content.GetValue(0, dimension) is TimeSpanValue) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs
r9313 r9435 48 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 49 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));51 50 this.yJitterLabel = new System.Windows.Forms.Label(); 52 51 this.xJitterlabel = new System.Windows.Forms.Label(); … … 61 60 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 62 61 this.openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 63 this.hideRun ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();62 this.hideRunsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 64 63 this.zoomButton = new System.Windows.Forms.RadioButton(); 65 64 this.selectButton = new System.Windows.Forms.RadioButton(); 66 65 this.radioButtonGroup = new System.Windows.Forms.GroupBox(); 67 this.color DialogButton = new System.Windows.Forms.Button();66 this.colorRunsButton = new System.Windows.Forms.Button(); 68 67 this.colorDialog = new System.Windows.Forms.ColorDialog(); 69 68 this.tooltip = new System.Windows.Forms.ToolTip(this.components); 70 69 this.colorXAxisButton = new System.Windows.Forms.Button(); 71 70 this.colorYAxisButton = new System.Windows.Forms.Button(); 71 this.transparencyTrackBar = new System.Windows.Forms.TrackBar(); 72 this.hideRunsButton = new System.Windows.Forms.Button(); 72 73 this.noRunsLabel = new System.Windows.Forms.Label(); 73 74 this.sizeTrackBar = new System.Windows.Forms.TrackBar(); 74 75 this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 75 this.transparencyTrackBar = new System.Windows.Forms.TrackBar();76 76 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(); 79 80 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit(); 80 81 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit(); 81 82 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 82 83 this.radioButtonGroup.SuspendLayout(); 84 ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit(); 83 85 ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).BeginInit(); 84 ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();85 86 this.SuspendLayout(); 86 87 // … … 222 223 this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click); 223 224 // 224 // hideRun ToolStripMenuItem225 // 226 this.hideRun ToolStripMenuItem.Name = "hideRunToolStripMenuItem";227 this.hideRun ToolStripMenuItem.Size = new System.Drawing.Size(256, 22);228 this.hideRun ToolStripMenuItem.Text = "Hide Run";229 this.hideRun ToolStripMenuItem.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); 230 231 // 231 232 // zoomButton … … 265 266 this.radioButtonGroup.TabStop = false; 266 267 // 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); 280 280 // 281 281 // colorDialog … … 309 309 this.colorYAxisButton.Click += new System.EventHandler(this.colorYAxisButton_Click); 310 310 // 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 // 311 338 // noRunsLabel 312 339 // … … 339 366 this.getDataAsMatrixToolStripMenuItem.Click += new System.EventHandler(this.getDataAsMatrixToolStripMenuItem_Click); 340 367 // 341 // transparencyTrackBar342 //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 //354 368 // transparencyLabel 355 369 // … … 362 376 this.transparencyLabel.Text = "Transparency:"; 363 377 // 364 // colorRunsButton365 // 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.colorR unsButton.Text = "Color";374 this.colorR unsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;375 this. tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");376 this.colorR unsButton.UseVisualStyleBackColor = true;377 this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);378 // 379 // hideRunsButton380 //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); 393 407 // 394 408 // RunCollectionBubbleChartView … … 398 412 this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 399 413 this.Controls.Add(this.hideRunsButton); 400 this.Controls.Add(this.colorRunsButton);401 414 this.Controls.Add(this.transparencyTrackBar); 402 415 this.Controls.Add(this.sizeTrackBar); … … 404 417 this.Controls.Add(this.colorXAxisButton); 405 418 this.Controls.Add(this.noRunsLabel); 406 this.Controls.Add(this.color DialogButton);419 this.Controls.Add(this.colorRunsButton); 407 420 this.Controls.Add(this.radioButtonGroup); 408 this.Controls.Add(this.chart);409 421 this.Controls.Add(this.sizeLabel); 410 422 this.Controls.Add(this.sizeComboBox); … … 418 430 this.Controls.Add(this.yAxisComboBox); 419 431 this.Controls.Add(this.yTrackBar); 432 this.Controls.Add(this.colorDialogButton); 433 this.Controls.Add(this.chart); 420 434 this.Name = "RunCollectionBubbleChartView"; 421 435 this.Size = new System.Drawing.Size(854, 496); … … 425 439 this.radioButtonGroup.ResumeLayout(false); 426 440 this.radioButtonGroup.PerformLayout(); 441 ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit(); 427 442 ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).EndInit(); 428 ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();429 443 this.ResumeLayout(false); 430 444 this.PerformLayout(); … … 447 461 private System.Windows.Forms.RadioButton selectButton; 448 462 private System.Windows.Forms.GroupBox radioButtonGroup; 449 private System.Windows.Forms.Button color DialogButton;463 private System.Windows.Forms.Button colorRunsButton; 450 464 private System.Windows.Forms.ColorDialog colorDialog; 451 465 private System.Windows.Forms.ToolTip tooltip; 452 466 private System.Windows.Forms.Label noRunsLabel; 453 467 private System.Windows.Forms.ToolStripMenuItem openBoxPlotViewToolStripMenuItem; 454 private System.Windows.Forms.ToolStripMenuItem hideRun ToolStripMenuItem;468 private System.Windows.Forms.ToolStripMenuItem hideRunsToolStripMenuItem; 455 469 private System.Windows.Forms.Button colorXAxisButton; 456 470 private System.Windows.Forms.Button colorYAxisButton; … … 459 473 private System.Windows.Forms.TrackBar transparencyTrackBar; 460 474 private System.Windows.Forms.Label transparencyLabel; 461 private System.Windows.Forms.Button colorRunsButton;462 475 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; 463 479 } 464 480 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs
r9404 r9435 56 56 private bool suppressUpdates = false; 57 57 58 private const double transperencyExponent = 2.5; 59 60 private RunCollectionContentConstraint visibilityConstraint = new RunCollectionContentConstraint() { Active = true }; 58 61 59 62 public RunCollectionBubbleChartView() { 60 63 InitializeComponent(); 61 64 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()); 65 72 chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening); 66 73 67 colorDialog.Color = Color. Black;68 color DialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);74 colorDialog.Color = Color.Orange; 75 colorRunsButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color); 69 76 isSelecting = false; 70 77 … … 167 174 point.MarkerStyle = MarkerStyle.Cross; 168 175 } 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); 170 177 point.MarkerStyle = MarkerStyle.Circle; 171 178 } … … 310 317 double sizeRange = maxSizeValue - minSizeValue; 311 318 312 const int smallestBubbleSize = 5;319 const int smallestBubbleSize = 7; 313 320 314 321 foreach (DataPoint point in series.Points) { … … 331 338 var yAxis = this.chart.ChartAreas[0].AxisY; 332 339 333 SetAutomaticUpdateOfAxis(xAxis, false);334 SetAutomaticUpdateOfAxis(yAxis, false);335 336 340 double xAxisRange = xAxis.Maximum - xAxis.Minimum; 337 341 double yAxisRange = yAxis.Maximum - yAxis.Minimum; … … 351 355 } 352 356 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 } 353 365 } 354 366 … … 431 443 if (!this.categoricalMapping.ContainsKey(dimension)) { 432 444 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()); 436 447 int count = 1; 437 448 foreach (var category in orderedCategories) { … … 535 546 double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd); 536 547 548 if (Control.ModifierKeys != Keys.Control) { 549 ClearSelectedRuns(); 550 } 551 537 552 //check for click to select a single model 538 553 if (minX == maxX && minY == maxY) { … … 545 560 point.MarkerStyle = MarkerStyle.Cross; 546 561 selectedRuns.Add(run); 547 548 } else ClearSelectedRuns(); 562 } 549 563 } else { 550 564 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; 553 567 point.MarkerStyle = MarkerStyle.Cross; 554 568 point.Color = Color.Red; … … 688 702 private void zoomButton_CheckedChanged(object sender, EventArgs e) { 689 703 this.isSelecting = selectButton.Checked; 704 this.colorRunsButton.Enabled = this.isSelecting; 690 705 this.colorDialogButton.Enabled = this.isSelecting; 691 this.colorRunsButton.Enabled = this.isSelecting;692 706 this.hideRunsButton.Enabled = this.isSelecting; 693 707 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting; … … 701 715 var chartPos = chart.PointToClient(pos); 702 716 703 HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y );717 HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y, ChartElementType.DataPoint); 704 718 if (h.ChartElementType == ChartElementType.DataPoint) { 705 719 runToHide = (IRun)((DataPoint)h.Object).Tag; 706 hideRun ToolStripMenuItem.Visible = true;720 hideRunsToolStripMenuItem.Visible = true; 707 721 } else { 708 722 runToHide = null; 709 hideRun ToolStripMenuItem.Visible = false;710 } 711 712 } 713 private void hideRunToolStripMenuItem_Click(object sender, EventArgs e) {714 v ar 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(); 721 735 } 722 736 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; 729 749 } 730 750 … … 800 820 801 821 #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 } 802 835 private void colorDialogButton_Click(object sender, EventArgs e) { 803 836 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); 805 839 } 806 840 }
Note: See TracChangeset
for help on using the changeset viewer.