Changeset 4799 for trunk/sources
- Timestamp:
- 11/15/10 17:13:21 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.Designer.cs
r4717 r4799 48 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 49 System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView)); 50 51 this.yJitterLabel = new System.Windows.Forms.Label(); 51 52 this.xJitterlabel = new System.Windows.Forms.Label(); … … 59 60 this.sizeLabel = new System.Windows.Forms.Label(); 60 61 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 62 this.openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 61 63 this.zoomButton = new System.Windows.Forms.RadioButton(); 62 64 this.selectButton = new System.Windows.Forms.RadioButton(); … … 65 67 this.colorDialog = new System.Windows.Forms.ColorDialog(); 66 68 this.tooltip = new System.Windows.Forms.ToolTip(this.components); 69 this.colorXAxisButton = new System.Windows.Forms.Button(); 67 70 this.noRunsLabel = new System.Windows.Forms.Label(); 68 this. openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();71 this.colorYAxisButton = new System.Windows.Forms.Button(); 69 72 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit(); 70 73 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit(); … … 76 79 // 77 80 this.yJitterLabel.AutoSize = true; 78 this.yJitterLabel.Location = new System.Drawing.Point( 257, 6);81 this.yJitterLabel.Location = new System.Drawing.Point(350, 6); 79 82 this.yJitterLabel.Name = "yJitterLabel"; 80 83 this.yJitterLabel.Size = new System.Drawing.Size(32, 13); … … 86 89 this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 87 90 this.xJitterlabel.AutoSize = true; 88 this.xJitterlabel.Location = new System.Drawing.Point( 539, 295);91 this.xJitterlabel.Location = new System.Drawing.Point(635, 316); 89 92 this.xJitterlabel.Name = "xJitterlabel"; 90 93 this.xJitterlabel.Size = new System.Drawing.Size(32, 13); … … 95 98 // 96 99 this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 97 this.xTrackBar.Location = new System.Drawing.Point( 577, 292);100 this.xTrackBar.Location = new System.Drawing.Point(673, 313); 98 101 this.xTrackBar.Maximum = 100; 99 102 this.xTrackBar.Name = "xTrackBar"; … … 107 110 this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 108 111 this.xAxisLabel.AutoSize = true; 109 this.xAxisLabel.Location = new System.Drawing.Point( 290, 294);112 this.xAxisLabel.Location = new System.Drawing.Point(357, 316); 110 113 this.xAxisLabel.Name = "xAxisLabel"; 111 114 this.xAxisLabel.Size = new System.Drawing.Size(15, 13); … … 119 122 this.xAxisComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 120 123 this.xAxisComboBox.FormattingEnabled = true; 121 this.xAxisComboBox.Location = new System.Drawing.Point(3 11, 292);124 this.xAxisComboBox.Location = new System.Drawing.Point(378, 313); 122 125 this.xAxisComboBox.Name = "xAxisComboBox"; 123 126 this.xAxisComboBox.Size = new System.Drawing.Size(221, 21); … … 147 150 // yTrackBar 148 151 // 149 this.yTrackBar.Location = new System.Drawing.Point( 295, 3);152 this.yTrackBar.Location = new System.Drawing.Point(388, 3); 150 153 this.yTrackBar.Maximum = 100; 151 154 this.yTrackBar.Name = "yTrackBar"; … … 161 164 this.sizeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 162 165 this.sizeComboBox.FormattingEnabled = true; 163 this.sizeComboBox.Location = new System.Drawing.Point( 418, 3);166 this.sizeComboBox.Location = new System.Drawing.Point(514, 3); 164 167 this.sizeComboBox.Name = "sizeComboBox"; 165 168 this.sizeComboBox.Size = new System.Drawing.Size(221, 21); … … 171 174 this.sizeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 172 175 this.sizeLabel.AutoSize = true; 173 this.sizeLabel.Location = new System.Drawing.Point( 348, 6);176 this.sizeLabel.Location = new System.Drawing.Point(444, 6); 174 177 this.sizeLabel.Name = "sizeLabel"; 175 178 this.sizeLabel.Size = new System.Drawing.Size(66, 13); … … 194 197 series2.YValuesPerPoint = 2; 195 198 this.chart.Series.Add(series2); 196 this.chart.Size = new System.Drawing.Size( 633, 248);199 this.chart.Size = new System.Drawing.Size(729, 269); 197 200 this.chart.TabIndex = 16; 198 201 this.chart.Text = "chart"; … … 201 204 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 202 205 this.chart.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chart_MouseUp); 206 // 207 // openBoxPlotViewToolStripMenuItem 208 // 209 this.openBoxPlotViewToolStripMenuItem.Name = "openBoxPlotViewToolStripMenuItem"; 210 this.openBoxPlotViewToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 211 this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View"; 212 this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click); 203 213 // 204 214 // zoomButton … … 232 242 this.radioButtonGroup.Controls.Add(this.zoomButton); 233 243 this.radioButtonGroup.Controls.Add(this.selectButton); 234 this.radioButtonGroup.Location = new System.Drawing.Point(3, 284);244 this.radioButtonGroup.Location = new System.Drawing.Point(3, 305); 235 245 this.radioButtonGroup.Name = "radioButtonGroup"; 236 246 this.radioButtonGroup.Size = new System.Drawing.Size(135, 32); … … 243 253 this.colorButton.Enabled = false; 244 254 this.colorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 245 this.colorButton.Location = new System.Drawing.Point(144, 292);255 this.colorButton.Location = new System.Drawing.Point(144, 313); 246 256 this.colorButton.Name = "colorButton"; 247 257 this.colorButton.Size = new System.Drawing.Size(64, 21); … … 257 267 this.colorDialog.FullOpen = true; 258 268 // 269 // colorXAxisButton 270 // 271 this.colorXAxisButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 272 this.colorXAxisButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.DisplayInColor; 273 this.colorXAxisButton.Location = new System.Drawing.Point(605, 313); 274 this.colorXAxisButton.Name = "colorXAxisButton"; 275 this.colorXAxisButton.Size = new System.Drawing.Size(21, 21); 276 this.colorXAxisButton.TabIndex = 22; 277 this.tooltip.SetToolTip(this.colorXAxisButton, "Color all runs according to their x-values"); 278 this.colorXAxisButton.UseVisualStyleBackColor = true; 279 this.colorXAxisButton.Click += new System.EventHandler(this.colorXAxisButton_Click); 280 // 259 281 // noRunsLabel 260 282 // 261 283 this.noRunsLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 262 284 this.noRunsLabel.AutoSize = true; 263 this.noRunsLabel.Location = new System.Drawing.Point( 261, 139);285 this.noRunsLabel.Location = new System.Drawing.Point(309, 150); 264 286 this.noRunsLabel.Name = "noRunsLabel"; 265 287 this.noRunsLabel.Size = new System.Drawing.Size(138, 13); … … 267 289 this.noRunsLabel.Text = "No runs could be displayed."; 268 290 // 269 // openBoxPlotViewToolStripMenuItem 270 // 271 this.chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem); 272 this.openBoxPlotViewToolStripMenuItem.Name = "openBoxPlotViewToolStripMenuItem"; 273 this.openBoxPlotViewToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 274 this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View"; 275 this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click); 291 // colorYAxisButton 292 // 293 this.colorYAxisButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.DisplayInColor; 294 this.colorYAxisButton.Location = new System.Drawing.Point(251, 3); 295 this.colorYAxisButton.Name = "colorYAxisButton"; 296 this.colorYAxisButton.Size = new System.Drawing.Size(21, 21); 297 this.colorYAxisButton.TabIndex = 23; 298 this.tooltip.SetToolTip(this.colorYAxisButton, "Color all runs according to their y-values"); 299 this.colorYAxisButton.UseVisualStyleBackColor = true; 300 this.colorYAxisButton.Click += new System.EventHandler(this.colorYAxisButton_Click); 276 301 // 277 302 // RunCollectionBubbleChartView … … 281 306 this.BackColor = System.Drawing.SystemColors.Window; 282 307 this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 308 this.Controls.Add(this.colorYAxisButton); 309 this.Controls.Add(this.colorXAxisButton); 283 310 this.Controls.Add(this.noRunsLabel); 284 311 this.Controls.Add(this.colorButton); … … 296 323 this.Controls.Add(this.yTrackBar); 297 324 this.Name = "RunCollectionBubbleChartView"; 298 this.Size = new System.Drawing.Size( 644, 319);325 this.Size = new System.Drawing.Size(740, 340); 299 326 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit(); 300 327 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit(); … … 327 354 private System.Windows.Forms.Label noRunsLabel; 328 355 private System.Windows.Forms.ToolStripMenuItem openBoxPlotViewToolStripMenuItem; 356 private System.Windows.Forms.Button colorXAxisButton; 357 private System.Windows.Forms.Button colorYAxisButton; 329 358 } 330 359 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r4653 r4799 43 43 private string sizeAxisValue; 44 44 45 private Dictionary<IRun, DataPoint> runToDataPointMapping; 45 46 private Dictionary<int, Dictionary<object, double>> categoricalMapping; 46 47 private Dictionary<IRun, double> xJitter; … … 54 55 InitializeComponent(); 55 56 57 runToDataPointMapping = new Dictionary<IRun, DataPoint>(); 56 58 categoricalMapping = new Dictionary<int, Dictionary<object, double>>(); 57 59 xJitter = new Dictionary<IRun, double>(); … … 123 125 124 126 private void UpdateRun(IRun run) { 125 DataPoint point = this.chart.Series[0].Points.Where(p => p.Tag == run).SingleOrDefault();127 DataPoint point = runToDataPointMapping[run]; 126 128 if (point != null) { 127 129 point.Color = run.Color; 128 if (!run.Visible) 130 if (!run.Visible) { 129 131 this.chart.Series[0].Points.Remove(point); 130 } else 132 runToDataPointMapping.Remove(run); 133 UpdateCursorInterval(); 134 chart.ChartAreas[0].RecalculateAxesScale(); 135 } 136 } else { 131 137 AddDataPoint(run); 132 UpdateCursorInterval(); 133 chart.ChartAreas[0].RecalculateAxesScale(); 138 UpdateCursorInterval(); 139 chart.ChartAreas[0].RecalculateAxesScale(); 140 } 134 141 135 142 … … 201 208 Series series = this.chart.Series[0]; 202 209 series.Points.Clear(); 210 runToDataPointMapping.Clear(); 203 211 if (Content != null) { 204 212 foreach (IRun run in this.Content) … … 249 257 point.Color = run.Color; 250 258 series.Points.Add(point); 259 runToDataPointMapping[run] = point; 251 260 } 252 261 } … … 569 578 } 570 579 #endregion 580 581 #region automatic coloring 582 private static Color[] colors; 583 protected static Color[] Colors { 584 get { 585 if (colors == null) InitializeColors(); 586 return colors; 587 } 588 } 589 private static void InitializeColors() { 590 colors = new Color[256]; 591 int stepWidth = (256 * 4) / colors.Length; 592 int currentValue; 593 int currentClass; 594 for (int i = 0; i < colors.Length; i++) { 595 currentValue = (i * stepWidth) % 256; 596 currentClass = (i * stepWidth) / 256; 597 switch (currentClass) { 598 case 0: { colors[i] = Color.FromArgb(0, currentValue, 255); break; } // blue -> cyan 599 case 1: { colors[i] = Color.FromArgb(0, 255, 255 - currentValue); break; } // cyan -> green 600 case 2: { colors[i] = Color.FromArgb(currentValue, 255, 0); break; } // green -> yellow 601 case 3: { colors[i] = Color.FromArgb(255, 255 - currentValue, 0); break; } // yellow -> red 602 } 603 } 604 } 605 606 private void colorXAxisButton_Click(object sender, EventArgs e) { 607 double minValue = chart.Series[0].Points.Min(p => p.XValue); 608 double maxValue = chart.Series[0].Points.Max(p => p.XValue); 609 foreach (DataPoint point in chart.Series[0].Points) { 610 int colorIndex = (int)((Colors.Length - 1) * (point.XValue - minValue) / (maxValue - minValue)); 611 IRun run = point.Tag as IRun; 612 if (run != null) 613 run.Color = Colors[colorIndex]; 614 } 615 } 616 617 private void colorYAxisButton_Click(object sender, EventArgs e) { 618 double minValue = chart.Series[0].Points.Min(p => p.YValues[0]); 619 double maxValue = chart.Series[0].Points.Max(p => p.YValues[0]); 620 foreach (DataPoint point in chart.Series[0].Points) { 621 int colorIndex = (int)((Colors.Length - 1) * (point.YValues[0] - minValue) / (maxValue - minValue)); 622 IRun run = point.Tag as IRun; 623 if (run != null) 624 run.Color = Colors[colorIndex]; 625 } 626 } 627 #endregion 571 628 } 572 629 }
Note: See TracChangeset
for help on using the changeset viewer.