Changeset 2139 for trunk/sources
- Timestamp:
- 07/06/09 21:54:04 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs
r2137 r2139 56 56 private double maxX = double.NegativeInfinity; 57 57 private double maxY = double.NegativeInfinity; 58 private List<ResultsEntry> records;58 private List<ResultsEntry> filteredEntries; 59 59 private Results results; 60 60 private Dictionary<IPrimitive, ResultsEntry> primitiveToEntryDictionary; … … 64 64 public BubbleChart(Results results, PointD lowerLeft, PointD upperRight) 65 65 : base(lowerLeft, upperRight) { 66 records = new List<ResultsEntry>();66 // records = new List<ResultsEntry>(); 67 67 primitiveToEntryDictionary = new Dictionary<IPrimitive, ResultsEntry>(); 68 68 this.results = results; 69 filteredEntries = new List<ResultsEntry>(); 69 70 70 71 foreach (var resultsEntry in results.GetEntries()) { … … 73 74 if (resultsEntry.Get(Y_JITTER) == null) 74 75 resultsEntry.Set(Y_JITTER, random.NextDouble() * 2.0 - 1.0); 75 records.Add(resultsEntry);76 // records.Add(resultsEntry); 76 77 } 77 78 … … 123 124 double minSize = 1; 124 125 if (sizeDimension != null && results.OrdinalVariables.Contains(sizeDimension)) { 125 var sizes = re cords126 var sizes = results.GetEntries() 126 127 .Select(x => Convert.ToDouble(x.Get(sizeDimension))) 127 128 .Where(size => !double.IsInfinity(size) && size != double.MaxValue && size != double.MinValue) … … 139 140 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 140 141 UpdateViewSize(0, 0, 5); 141 foreach (ResultsEntry r in re cords) {142 foreach (ResultsEntry r in results.GetEntries().Where(x => x.Visible)) { 142 143 List<double> xs = new List<double>(); 143 144 List<double> ys = new List<double>(); … … 145 146 List<object> actualYValues = new List<object>(); 146 147 int size; 147 if (results.OrdinalVariables.Contains(xDimension) ) {148 if (results.OrdinalVariables.Contains(xDimension) && r.Get(xDimension) != null) { 148 149 xs.Add(Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor); 149 150 actualXValues.Add(r.Get(xDimension)); 150 } else if (results.CategoricalVariables.Contains(xDimension) ) {151 } else if (results.CategoricalVariables.Contains(xDimension) && r.Get(xDimension) != null) { 151 152 xs.Add(results.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor); 152 153 actualXValues.Add(r.Get(xDimension)); … … 155 156 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 156 157 foreach (ResultsEntry subEntry in subEntries) { 157 xs.Add(results.IndexOfCategoricalValue(xDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 158 actualXValues.Add(subEntry.Get(path.ElementAt(1))); 158 if (subEntry.Get(path.ElementAt(1)) != null) { 159 xs.Add(results.IndexOfCategoricalValue(xDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 160 actualXValues.Add(subEntry.Get(path.ElementAt(1))); 161 } 159 162 } 160 163 } else if (results.MultiDimensionalOrdinalVariables.Contains(xDimension)) { … … 162 165 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 163 166 foreach (ResultsEntry subEntry in subEntries) { 164 xs.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 165 actualXValues.Add(subEntry.Get(path.ElementAt(1))); 166 } 167 } 168 if (results.OrdinalVariables.Contains(yDimension)) { 167 if (subEntry.Get(path.ElementAt(1)) != null) { 168 xs.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 169 actualXValues.Add(subEntry.Get(path.ElementAt(1))); 170 } 171 } 172 } 173 if (results.OrdinalVariables.Contains(yDimension) && r.Get(yDimension) != null) { 169 174 ys.Add(Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor); 170 175 actualYValues.Add(r.Get(yDimension)); 171 } else if (results.CategoricalVariables.Contains(yDimension) ) {176 } else if (results.CategoricalVariables.Contains(yDimension) && r.Get(yDimension) != null) { 172 177 ys.Add(results.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor); 173 178 actualYValues.Add(r.Get(yDimension)); … … 176 181 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 177 182 foreach (ResultsEntry subEntry in subEntries) { 178 ys.Add(results.IndexOfCategoricalValue(yDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 179 actualYValues.Add(subEntry.Get(path.ElementAt(1))); 183 if (subEntry.Get(path.ElementAt(1)) != null) { 184 ys.Add(results.IndexOfCategoricalValue(yDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 185 actualYValues.Add(subEntry.Get(path.ElementAt(1))); 186 } 180 187 } 181 188 } else if (results.MultiDimensionalOrdinalVariables.Contains(yDimension)) { … … 183 190 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 184 191 foreach (ResultsEntry subEntry in subEntries) { 185 ys.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 186 actualYValues.Add(subEntry.Get(path.ElementAt(1))); 192 if (subEntry.Get(path.ElementAt(1)) != null) { 193 ys.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 194 actualYValues.Add(subEntry.Get(path.ElementAt(1))); 195 } 187 196 } 188 197 } … … 324 333 } 325 334 } 335 336 internal void ToggleSelected() { 337 foreach (ResultsEntry entry in results.GetEntries()) { 338 entry.ToggleSelected(); 339 } 340 results.FireChanged(); 341 } 342 343 internal void ClearSelection() { 344 foreach (ResultsEntry entry in results.GetEntries().Where(x=>x.Selected)) { 345 entry.ToggleSelected(); 346 } 347 results.FireChanged(); 348 } 349 350 internal void ApplyFilter(Func<ResultsEntry, bool> filterPred) { 351 foreach (ResultsEntry r in results.GetEntries()) { 352 if (filterPred(r)) { 353 r.Visible = false; 354 r.Selected = false; 355 filteredEntries.Add(r); 356 } 357 } 358 results.FireChanged(); 359 } 360 361 internal void ClearFilter() { 362 foreach (ResultsEntry r in filteredEntries) { 363 r.Visible = true; 364 } 365 filteredEntries.Clear(); 366 results.FireChanged(); 367 } 326 368 } 327 369 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.Designer.cs
r1529 r2139 51 51 this.zoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 52 52 this.selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.invertSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 this.filterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 55 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 56 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 57 this.clearSelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 this.showHiddenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 59 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 55 60 this.pictureBoxContextMenuStrip.SuspendLayout(); … … 82 87 this.moveToolStripMenuItem, 83 88 this.zoomToolStripMenuItem, 84 this.selectToolStripMenuItem}); 89 this.selectToolStripMenuItem, 90 this.toolStripSeparator1, 91 this.clearSelectionMenuItem, 92 this.invertSelectionToolStripMenuItem, 93 this.filterToolStripMenuItem, 94 this.showHiddenToolStripMenuItem}); 85 95 this.pictureBoxContextMenuStrip.Name = "pictureBoxContextMenuStrip"; 86 this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(15 3, 92);96 this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(155, 186); 87 97 // 88 98 // moveToolStripMenuItem 89 99 // 90 100 this.moveToolStripMenuItem.Name = "moveToolStripMenuItem"; 91 this.moveToolStripMenuItem.Size = new System.Drawing.Size(15 2, 22);101 this.moveToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 92 102 this.moveToolStripMenuItem.Text = "Move"; 93 103 this.moveToolStripMenuItem.Click += new System.EventHandler(this.moveToolStripMenuItem_Click); … … 96 106 // 97 107 this.zoomToolStripMenuItem.Name = "zoomToolStripMenuItem"; 98 this.zoomToolStripMenuItem.Size = new System.Drawing.Size(15 2, 22);108 this.zoomToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 99 109 this.zoomToolStripMenuItem.Text = "&Zoom"; 100 110 this.zoomToolStripMenuItem.Click += new System.EventHandler(this.zoomToolStripMenuItem_Click); … … 103 113 // 104 114 this.selectToolStripMenuItem.Name = "selectToolStripMenuItem"; 105 this.selectToolStripMenuItem.Size = new System.Drawing.Size(15 2, 22);115 this.selectToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 106 116 this.selectToolStripMenuItem.Text = "&Select"; 107 117 this.selectToolStripMenuItem.Click += new System.EventHandler(this.selectToolStripMenuItem_Click); 118 // 119 // invertSelectionToolStripMenuItem 120 // 121 this.invertSelectionToolStripMenuItem.Name = "invertSelectionToolStripMenuItem"; 122 this.invertSelectionToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 123 this.invertSelectionToolStripMenuItem.Text = "Invert selection"; 124 this.invertSelectionToolStripMenuItem.Click += new System.EventHandler(this.invertSelectionToolStripMenuItem_Click); 125 // 126 // filterToolStripMenuItem 127 // 128 this.filterToolStripMenuItem.Name = "filterToolStripMenuItem"; 129 this.filterToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 130 this.filterToolStripMenuItem.Text = "Hide selected"; 131 this.filterToolStripMenuItem.Click += new System.EventHandler(this.hideSelectedToolStripMenuItem_Click); 132 // 133 // toolStripSeparator1 134 // 135 this.toolStripSeparator1.Name = "toolStripSeparator1"; 136 this.toolStripSeparator1.Size = new System.Drawing.Size(151, 6); 137 // 138 // clearSelectionMenuItem 139 // 140 this.clearSelectionMenuItem.Name = "clearSelectionMenuItem"; 141 this.clearSelectionMenuItem.Size = new System.Drawing.Size(154, 22); 142 this.clearSelectionMenuItem.Text = "Clear selection"; 143 this.clearSelectionMenuItem.Click += new System.EventHandler(this.clearSelectionMenuItem_Click); 144 // 145 // showHiddenToolStripMenuItem 146 // 147 this.showHiddenToolStripMenuItem.Enabled = false; 148 this.showHiddenToolStripMenuItem.Name = "showHiddenToolStripMenuItem"; 149 this.showHiddenToolStripMenuItem.Size = new System.Drawing.Size(154, 22); 150 this.showHiddenToolStripMenuItem.Text = "Show hidden"; 151 this.showHiddenToolStripMenuItem.Click += new System.EventHandler(this.showHiddenToolStripMenuItem_Click); 108 152 // 109 153 // BubbleChartControl … … 129 173 protected System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem; 130 174 private System.Windows.Forms.ToolStripMenuItem moveToolStripMenuItem; 175 private System.Windows.Forms.ToolStripMenuItem invertSelectionToolStripMenuItem; 176 private System.Windows.Forms.ToolStripMenuItem filterToolStripMenuItem; 177 private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 178 private System.Windows.Forms.ToolStripMenuItem clearSelectionMenuItem; 179 private System.Windows.Forms.ToolStripMenuItem showHiddenToolStripMenuItem; 131 180 132 181 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartControl.cs
r2132 r2139 177 177 Chart.MouseDoubleClick(e.Location, e.Button); 178 178 } 179 180 private void invertSelectionToolStripMenuItem_Click(object sender, EventArgs e) { 181 Chart.ToggleSelected(); 182 } 183 184 private void hideSelectedToolStripMenuItem_Click(object sender, EventArgs e) { 185 showHiddenToolStripMenuItem.Enabled = true; 186 Chart.ApplyFilter(x => x.Selected == true && x.Visible==true); 187 } 188 189 private void clearSelectionMenuItem_Click(object sender, EventArgs e) { 190 Chart.ClearSelection(); 191 } 192 193 private void showHiddenToolStripMenuItem_Click(object sender, EventArgs e) { 194 Chart.ClearFilter(); 195 showHiddenToolStripMenuItem.Enabled = false; 196 } 179 197 } 180 198 } -
trunk/sources/HeuristicLab.CEDMA.Core/3.3/Results.cs
r2137 r2139 117 117 nStatements += resultsReturned; 118 118 int nModels = Math.Max(10, resultsReturned * 10 / 100); 119 nModels = Math.Min(nModels, resultsReturned); 119 120 foreach (var modelBindings in targetVariableBindings.Take(nModels)) { 120 121 ResultsEntry entry = new ResultsEntry(); -
trunk/sources/HeuristicLab.CEDMA.Core/3.3/ResultsEntry.cs
r2133 r2139 42 42 } 43 43 44 private bool visible = true; 45 public bool Visible { 46 get { return visible; } 47 set { visible = value; } 48 } 49 44 50 private string uri; 45 51 public string Uri { -
trunk/sources/HeuristicLab.CEDMA.Core/3.3/TableResultsView.cs
r2047 r2139 43 43 var entries = Results.GetEntries(); 44 44 foreach (var entry in entries) { 45 int rowIndex = dataGridView.Rows.Add(); 46 dataGridView.Rows[rowIndex].Tag = entry; 47 foreach (string attrName in attributeNames) { 48 dataGridView.Rows[rowIndex].Cells[attrName].Value = entry.Get(attrName); 45 if (entry.Visible) { 46 int rowIndex = dataGridView.Rows.Add(); 47 dataGridView.Rows[rowIndex].Tag = entry; 48 foreach (string attrName in attributeNames) { 49 dataGridView.Rows[rowIndex].Cells[attrName].Value = entry.Get(attrName); 50 } 51 if (entry.Selected) dataGridView.Rows[rowIndex].Selected = true; 49 52 } 50 if (entry.Selected) dataGridView.Rows[rowIndex].Selected = true;51 53 } 52 54 dataGridView.Update();
Note: See TracChangeset
for help on using the changeset viewer.