Changeset 2131 for trunk/sources/HeuristicLab.CEDMA.Charting
- Timestamp:
- 07/03/09 15:56:05 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Charting/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChart.cs
r2047 r2131 31 31 using HeuristicLab.Core; 32 32 using HeuristicLab.CEDMA.DB.Interfaces; 33 using System.Diagnostics; 33 34 34 35 namespace HeuristicLab.CEDMA.Charting { … … 58 59 private Results results; 59 60 private Dictionary<IPrimitive, ResultsEntry> primitiveToEntryDictionary; 60 private Dictionary<ResultsEntry, IPrimitive> entryToPrimitiveDictionary;61 //private Dictionary<ResultsEntry, IList<IPrimitive>> entryToPrimitivesDictionary; 61 62 private Random random = new Random(); 62 63 private Group points; … … 66 67 records = new List<ResultsEntry>(); 67 68 primitiveToEntryDictionary = new Dictionary<IPrimitive, ResultsEntry>(); 68 entryToPrimitiveDictionary = new Dictionary<ResultsEntry, IPrimitive>();69 // entryToPrimitivesDictionary = new Dictionary<ResultsEntry, IList<IPrimitive>>(); 69 70 this.results = results; 70 71 … … 132 133 Group.Clear(); 133 134 primitiveToEntryDictionary.Clear(); 134 entryToPrimitiveDictionary.Clear();135 // entryToPrimitivesDictionary.Clear(); 135 136 points = new Group(this); 136 137 Group.Add(new Axis(this, 0, 0, AxisType.Both)); 137 138 UpdateViewSize(0, 0, 5); 138 139 foreach (ResultsEntry r in records) { 139 double x, y; 140 List<double> xs = new List<double>(); 141 List<double> ys = new List<double>(); 140 142 int size; 141 143 if (results.OrdinalVariables.Contains(xDimension)) { 142 x = Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor;144 xs.Add(Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor); 143 145 } else if (results.CategoricalVariables.Contains(xDimension)) { 144 x = results.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor; 146 xs.Add(results.IndexOfCategoricalValue(xDimension, r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor); 147 } else if (results.MultiDimensionalCategoricalVariables.Contains(xDimension)) { 148 var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 149 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 150 foreach (ResultsEntry subEntry in subEntries) { 151 xs.Add(results.IndexOfCategoricalValue(xDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 152 } 153 } else if (results.MultiDimensionalOrdinalVariables.Contains(xDimension)) { 154 var path = xDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 155 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 156 foreach (ResultsEntry subEntry in subEntries) { 157 xs.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(X_JITTER) * xJitterFactor); 158 } 145 159 } else { 146 x = double.NaN;160 xs.Add(double.NaN); 147 161 } 148 162 if (results.OrdinalVariables.Contains(yDimension)) { 149 y = Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor;163 ys.Add(Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor); 150 164 } else if (results.CategoricalVariables.Contains(yDimension)) { 151 y = results.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor; 165 ys.Add(results.IndexOfCategoricalValue(yDimension, r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor); 166 } else if (results.MultiDimensionalCategoricalVariables.Contains(yDimension)) { 167 var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 168 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 169 foreach (ResultsEntry subEntry in subEntries) { 170 ys.Add(results.IndexOfCategoricalValue(yDimension, subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 171 } 172 } else if (results.MultiDimensionalOrdinalVariables.Contains(yDimension)) { 173 var path = yDimension.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); 174 IEnumerable<ResultsEntry> subEntries = (IEnumerable<ResultsEntry>)r.Get(path.ElementAt(0)); 175 foreach (ResultsEntry subEntry in subEntries) { 176 ys.Add(Convert.ToDouble(subEntry.Get(path.ElementAt(1))) + (double)r.Get(Y_JITTER) * yJitterFactor); 177 } 152 178 } else { 153 y = double.NaN;179 ys.Add(double.NaN); 154 180 } 155 181 size = CalculateSize(Convert.ToDouble(r.Get(sizeDimension)), minSize, maxSize); 156 157 if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN; 158 if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN; 159 if (!double.IsNaN(x) && !double.IsNaN(y)) { 160 UpdateViewSize(x, y, size); 161 int alpha = CalculateAlpha(size); 162 Pen pen = new Pen(Color.FromArgb(alpha, r.Selected ? selectionColor : defaultColor)); 163 Brush brush = pen.Brush; 164 FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush); 165 c.ToolTipText = r.GetToolTipText(); 166 points.Add(c); 167 if (!r.Selected) c.IntoBackground(); 168 primitiveToEntryDictionary[c] = r; 169 entryToPrimitiveDictionary[r] = c; 182 Debug.Assert(xs.Count() == ys.Count() || xs.Count() == 1 || ys.Count() == 1); 183 int n = Math.Max(xs.Count(), ys.Count()); 184 for (int i = 0; i < n; i++) { 185 double x = xs[Math.Min(i, xs.Count()-1)]; 186 double y = ys[Math.Min(i, ys.Count()-1)]; 187 if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN; 188 if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN; 189 if (!double.IsNaN(x) && !double.IsNaN(y)) { 190 UpdateViewSize(x, y, size); 191 int alpha = CalculateAlpha(size); 192 Pen pen = new Pen(Color.FromArgb(alpha, r.Selected ? selectionColor : defaultColor)); 193 Brush brush = pen.Brush; 194 FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush); 195 c.ToolTipText = r.GetToolTipText(); 196 points.Add(c); 197 if (!r.Selected) c.IntoBackground(); 198 primitiveToEntryDictionary[c] = r; 199 //if (!entryToPrimitivesDictionary.ContainsKey(r)) entryToPrimitivesDictionary[r] = new List<IPrimitive>(); 200 //entryToPrimitivesDictionary[r].Add(c); 201 } 170 202 } 171 203 } -
trunk/sources/HeuristicLab.CEDMA.Charting/3.3/BubbleChartView.cs
r1529 r2131 40 40 xAxisComboBox.Items.AddRange(Results.OrdinalVariables); 41 41 xAxisComboBox.Items.AddRange(Results.CategoricalVariables); 42 xAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables); 43 xAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables); 42 44 yAxisComboBox.Items.AddRange(Results.OrdinalVariables); 43 45 yAxisComboBox.Items.AddRange(Results.CategoricalVariables); 46 yAxisComboBox.Items.AddRange(Results.MultiDimensionalCategoricalVariables); 47 yAxisComboBox.Items.AddRange(Results.MultiDimensionalOrdinalVariables); 44 48 sizeComboBox.Items.Add(CONSTANT_SIZE); 45 49 sizeComboBox.Items.AddRange(Results.OrdinalVariables);
Note: See TracChangeset
for help on using the changeset viewer.