- Timestamp:
- 03/16/09 19:42:17 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/AvgAggregator.cs
r1343 r1350 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Drawing;4 3 5 4 namespace HeuristicLab.Visualization { 6 public class AvgAggregator : IAggregator { 7 8 5 public class AvgAggregator : DataRowBase { 9 6 #region IAggregator Members 10 7 … … 17 14 18 15 public void RemoveWatch(IDataRow dataRow) { 19 20 16 dataRowWatches.Remove(dataRow); 21 17 dataRow.DataRowChanged -= dataRow_DataRowChanged; … … 24 20 } 25 21 26 27 22 #endregion 28 23 29 List<IDataRow> dataRowWatches = new List<IDataRow>();30 double curAvgValue;24 private List<IDataRow> dataRowWatches = new List<IDataRow>(); 25 private double curAvgValue; 31 26 32 void dataRow_ValueChanged(IDataRow row, double value, int index, Action action) {27 private void dataRow_ValueChanged(IDataRow row, double value, int index, Action action) { 33 28 refreshValue(value); 34 29 } 35 30 36 void dataRow_ValuesChanged(IDataRow row, double[] values, int index, Action action) {31 private void dataRow_ValuesChanged(IDataRow row, double[] values, int index, Action action) { 37 32 for (int i = 0; i < values.Length; i++) { 38 33 refreshValue(values[i]); … … 40 35 } 41 36 42 void dataRow_DataRowChanged(IDataRow row) {37 private void dataRow_DataRowChanged(IDataRow row) { 43 38 refreshValue(double.MinValue); 44 39 } … … 50 45 double tmpSum = 0; 51 46 int count = 0; 52 foreach ( varrows in dataRowWatches) {47 foreach (IDataRow rows in dataRowWatches) { 53 48 for (int i = 0; i < rows.Count; i++) { 54 49 tmpSum += rows[i]; … … 63 58 #region IDataRow Members 64 59 65 private string label = ""; 66 private Color color = Color.Black; 67 private int thickness = 2; 68 private DrawingStyle style = DrawingStyle.Solid; 69 private DataRowType lineType = DataRowType.Normal; 70 71 72 public string Label { 73 get { return label; } 74 set { 75 label = value; 76 OnDataRowChanged(this); 77 } 78 } 79 80 public Color Color { 81 get { return color; } 82 set { 83 color = value; 84 OnDataRowChanged(this); 85 } 86 } 87 88 public int Thickness { 89 get { return thickness; } 90 set { 91 thickness = value; 92 OnDataRowChanged(this); 93 } 94 } 95 96 public DrawingStyle Style { 97 get { return style; } 98 set { 99 style = value; 100 OnDataRowChanged(this); 101 } 102 } 103 104 public DataRowType LineType { 105 get { return lineType; } 106 set { 107 lineType = value; 108 OnDataRowChanged(this); 109 } 110 } 111 112 private bool showYAxis = false; 113 114 public bool ShowYAxis { 115 get { return showYAxis; } 116 set { 117 showYAxis = value; 118 OnDataRowChanged(this); 119 } 120 } 121 122 public LabelProvider.ILabelProvider YAxisLabelProvider { 123 get { 124 throw new NotImplementedException(); 125 } 126 set { 127 throw new NotImplementedException(); 128 } 129 } 130 131 public void AddValue(double value) { 60 public override void AddValue(double value) { 132 61 throw new NotSupportedException(); 133 62 } 134 63 135 public void AddValue(double value, int index) {64 public override void AddValue(double value, int index) { 136 65 throw new NotSupportedException(); 137 66 } 138 67 139 public void AddValues(double[] values) {68 public override void AddValues(double[] values) { 140 69 throw new NotSupportedException(); 141 70 } 142 71 143 public void AddValues(double[] values, int index) {72 public override void AddValues(double[] values, int index) { 144 73 throw new NotSupportedException(); 145 74 } 146 75 147 public void ModifyValue(double value, int index) {76 public override void ModifyValue(double value, int index) { 148 77 throw new NotSupportedException(); 149 78 } 150 79 151 public void ModifyValues(double[] values, int index) {80 public override void ModifyValues(double[] values, int index) { 152 81 throw new NotSupportedException(); 153 82 } 154 83 155 public void RemoveValue(int index) {84 public override void RemoveValue(int index) { 156 85 throw new NotSupportedException(); 157 86 } 158 87 159 public void RemoveValues(int index, int count) {88 public override void RemoveValues(int index, int count) { 160 89 throw new NotSupportedException(); 161 90 } 162 91 163 public int Count {92 public override int Count { 164 93 get { return 1; } 165 94 } 166 95 167 public double this[int index] { 168 get { 169 return curAvgValue; 170 } 171 set { 172 throw new NotSupportedException(); 173 } 96 public override double this[int index] { 97 get { return curAvgValue; } 98 set { throw new NotSupportedException(); } 174 99 } 175 100 176 public double MinValue {177 get { throw new System.NotImplementedException(); }101 public override double MinValue { 102 get { return curAvgValue; } 178 103 } 179 104 180 public double MaxValue { 181 get { throw new System.NotImplementedException(); } 182 } 183 184 public event ValuesChangedHandler ValuesChanged; 185 186 protected void OnValuesChanged(double[] values, int index, Action action) { 187 if (ValuesChanged != null) { 188 ValuesChanged(this, values, index, action); 189 } 190 } 191 192 public event ValueChangedHandler ValueChanged; 193 194 protected void OnValueChanged(double value, int index, Action action) { 195 if (ValueChanged != null) { 196 ValueChanged(this, value, index, action); 197 } 198 } 199 200 public event DataRowChangedHandler DataRowChanged; 201 202 protected void OnDataRowChanged(IDataRow row) { 203 if (DataRowChanged != null) { 204 DataRowChanged(this); 205 } 105 public override double MaxValue { 106 get { return curAvgValue; } 206 107 } 207 108
Note: See TracChangeset
for help on using the changeset viewer.