Changeset 1607 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 04/18/09 14:41:05 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization/3.2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs
r1605 r1607 22 22 #endregion 23 23 24 private List<IDataRow> dataRowWatches = new List<IDataRow>();24 private readonly List<IDataRow> dataRowWatches = new List<IDataRow>(); 25 25 private double curAvgValue; 26 26 … … 126 126 } 127 127 128 public override void RemoveValues(int index, int count ) {128 public override void RemoveValues(int index, int countVals) { 129 129 throw new NotSupportedException(); 130 130 } -
trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs
r1605 r1607 6 6 7 7 private readonly List<double> dataRow = new List<double>(); 8 readonly List<IDataRow> dataRowWatches = new List<IDataRow>(); 8 9 9 10 #region IAggregator Members 10 11 11 public void AddWatch(IDataRow dataRow) {12 dataRowWatches.Add( dataRow);13 dataRow.ValueChanged += dataRow_ValueChanged;14 dataRow.ValuesChanged += dataRow_ValuesChanged;15 dataRow.DataRowChanged += dataRow_DataRowChanged;12 public void AddWatch(IDataRow watchDataRow) { 13 dataRowWatches.Add(watchDataRow); 14 watchDataRow.ValueChanged += dataRow_ValueChanged; 15 watchDataRow.ValuesChanged += dataRow_ValuesChanged; 16 watchDataRow.DataRowChanged += dataRow_DataRowChanged; 16 17 } 17 18 18 public void RemoveWatch(IDataRow dataRow) { 19 20 dataRowWatches.Remove(dataRow); 21 dataRow.DataRowChanged -= dataRow_DataRowChanged; 22 dataRow.ValuesChanged -= dataRow_ValuesChanged; 23 dataRow.ValueChanged -= dataRow_ValueChanged; 19 public void RemoveWatch(IDataRow watchDataRow) { 20 dataRowWatches.Remove(watchDataRow); 21 watchDataRow.DataRowChanged -= dataRow_DataRowChanged; 22 watchDataRow.ValuesChanged -= dataRow_ValuesChanged; 23 watchDataRow.ValueChanged -= dataRow_ValueChanged; 24 24 } 25 25 26 27 26 #endregion 28 29 List<IDataRow> dataRowWatches = new List<IDataRow>();30 27 31 28 void dataRow_ValueChanged(IDataRow row, double value, int index, Action action) { 32 29 switch (action) { 33 30 case Action.Added: 34 refresh Value(row, value, Action.Added);31 refreshLastValues(row); 35 32 break; 36 33 case Action.Modified: … … 38 35 break; 39 36 case Action.Deleted: 40 refresh Value(row, value, Action.Deleted);37 refreshLastValues(row); 41 38 break; 42 39 default: 43 40 throw new ArgumentOutOfRangeException("action"); 44 41 } 45 46 42 } 47 43 … … 57 53 58 54 private void refreshValue() { 59 double tmpSum = 0;55 60 56 int count = dataRowWatches.Count; 61 57 62 58 IDataRow firstRow = dataRowWatches[0]; 63 59 int count1 = firstRow.Count; 64 System.Console.WriteLine("count: " + count1);60 Console.WriteLine("count: " + count1); 65 61 66 62 dataRow.Clear(); … … 68 64 if (dataRowWatches.Count >= 2) { 69 65 for (int i = 0; i < count1; i++) { 70 tmpSum = 0;66 double tmpSum = 0; 71 67 for (int j = 0; j < count; j++) { 72 68 if (dataRowWatches[j].Count > i) { … … 75 71 } 76 72 77 this.dataRow.Add(tmpSum / count);73 dataRow.Add(tmpSum / count); 78 74 OnValueChanged(tmpSum / count, dataRow.Count - 1, Action.Added); 79 75 } … … 81 77 } 82 78 83 private void refresh Value(IDataRow row, double newVal, Action action) {79 private void refreshLastValues(IDataRow row) { 84 80 85 81 int index = row.Count - 1; 86 87 88 89 90 82 double curAvg = 0; 91 // if (dataRow.Count > 0) {92 // curAvg = dataRow[0]; //?93 // } else {94 // curAvg = 0;95 // }96 97 83 98 84 foreach (IDataRow watch in dataRowWatches) { 99 85 if (watch.Count >= index +1) { 100 curAvg += watch[index]; 101 86 curAvg += watch[index]; 102 87 } 103 //curAvg += watch[watch.Count - 1];104 88 } 105 89 … … 116 100 OnValueChanged(curAvg, dataRow.Count - 1, Action.Modified); 117 101 } 118 119 120 121 // curAvg *= dataRow.Count * dataRowWatches.Count;122 // switch (action) {123 // case Action.Added:124 // curAvg += newVal;125 // break;126 // case Action.Modified:127 // throw new InvalidOperationException();128 // case Action.Deleted:129 // curAvg -= newVal;130 // break;131 // default:132 // throw new ArgumentOutOfRangeException("action");133 // }134 //135 // dataRow.Add((curAvg / (dataRow.Count + 1)) / dataRowWatches.Count);136 // OnValueChanged((curAvg / (dataRow.Count + 1)) / dataRowWatches.Count, dataRow.Count - 1, Action.Added); // nicht immer adden!137 138 // double tmpSum = 0;139 // int count = dataRowWatches.Count;140 //141 // IDataRow firstRow = dataRowWatches[0];142 // int count1 = firstRow.Count;143 // System.Console.WriteLine("count: " + count1);144 //145 // dataRow.Clear();146 //147 // if (dataRowWatches.Count >= 2) {148 // for (int i = 0; i < count1; i++) {149 // tmpSum = 0;150 // for (int j = 0; j < count; j++) {151 // if (dataRowWatches[j].Count > i) {152 // tmpSum += dataRowWatches[j][i];153 // }154 // }155 //156 // this.dataRow.Add(tmpSum/count);157 // OnValueChanged(tmpSum / count, dataRow.Count - 1, Action.Added);158 // }159 // }160 161 // evtl nur feuern wenn sich geändert hat (jedes mal?)162 //OnDataRowChanged(this);163 102 } 164 103 … … 171 110 172 111 public override void AddValue(double value, int index) { 173 throw new Not ImplementedException();112 throw new NotSupportedException(); 174 113 } 175 114 … … 194 133 } 195 134 196 public override void RemoveValues(int index, int count ) {135 public override void RemoveValues(int index, int countVals) { 197 136 throw new NotSupportedException(); 198 137 } … … 210 149 } 211 150 212 // TODO calculate min value213 151 public override double MinValue { 214 152 get { return 0; } 215 153 } 216 154 217 // TODO calculate max value218 155 public override double MaxValue { 219 156 get { return 0; } -
trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs
r1530 r1607 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing;4 3 5 4 namespace HeuristicLab.Visualization {
Note: See TracChangeset
for help on using the changeset viewer.