- Timestamp:
- 07/06/09 21:54:04 (15 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.