Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1607


Ignore:
Timestamp:
04/18/09 14:41:05 (15 years ago)
Author:
cbahner
Message:

#519 test cases + code review

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTests.cs

    r1530 r1607  
    3737      row2.Style = DrawingStyle.Solid;
    3838      row3.Style = DrawingStyle.Dashed;
    39      
     39
    4040
    4141      model.AddDataRow(row1);
     
    6363
    6464      for (int i = 0; i < 10000; i++) {
    65         row1.AddValue(rand.NextDouble()*10);
    66         row2.AddValue(rand.NextDouble()*10);
    67         row3.AddValue(rand.NextDouble()*10);
    68       }
    69 
    70       f.ShowDialog();
    71     }
    72      
     65        row1.AddValue(rand.NextDouble() * 10);
     66        row2.AddValue(rand.NextDouble() * 10);
     67        row3.AddValue(rand.NextDouble() * 10);
     68      }
     69
     70      f.ShowDialog();
     71    }
     72
    7373    [Test]
    7474    public void TestAxes() {
     
    119119
    120120      for (int i = 0; i < 10; i++) {
    121         row1.AddValue(rand.NextDouble()*10);
    122         row2.AddValue(rand.NextDouble()*10);
    123         row3.AddValue(rand.NextDouble()*1);
     121        row1.AddValue(rand.NextDouble() * 10);
     122        row2.AddValue(rand.NextDouble() * 10);
     123        row3.AddValue(rand.NextDouble() * 1);
    124124      }
    125125
    126126      f.AddValue += delegate {
    127         row1.AddValue(rand.NextDouble()*10);
    128         row2.AddValue(rand.NextDouble()*10);
    129         row3.AddValue(rand.NextDouble()*1);
     127        row1.AddValue(rand.NextDouble() * 10);
     128        row2.AddValue(rand.NextDouble() * 10);
     129        row3.AddValue(rand.NextDouble() * 1);
    130130      };
    131131
     
    134134
    135135    [Test]
    136     public void TestAggregator() {
    137       LineChartTestForm f = new LineChartTestForm(model);
    138 
    139       IDataRow row1 = new DataRow();
    140       row1.Label = "row";
    141       row1.Color = Color.Red;
    142       row1.Thickness = 3;
    143       row1.Style = DrawingStyle.Solid;
     136    public void SimpleTestAggregator() {
     137      LineChartTestForm f = new LineChartTestForm(model);
     138
     139      IDataRow row1 = new DataRow { Label = "row", Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
    144140
    145141      model.AddDataRow(row1);
    146142
    147143
    148       MinAggregator aggregator = new MinAggregator();
    149       aggregator.Label = "MinAggregator";
    150       aggregator.Color = Color.Pink;
    151       aggregator.Thickness = 5;
    152       aggregator.Style = DrawingStyle.Solid;
    153       aggregator.AddValue(2);
    154       aggregator.LineType = DataRowType.SingleValue;
    155 
    156       IDataRow lineTest = new DataRow("testline");
    157       lineTest.Color = Color.DarkSalmon;
    158       lineTest.Thickness = 2;
    159       lineTest.Style = DrawingStyle.Dashed;
    160       lineTest.LineType = DataRowType.SingleValue;
    161       model.AddDataRow(lineTest);
    162       lineTest.AddValue(9);
    163       lineTest.AddValue(2);
    164       lineTest.AddValue(3);
    165       lineTest.AddValue(4);
    166 
     144      MaxAggregator aggregator = new MaxAggregator {
     145        Label = "MinAggregator",
     146        Color = Color.Pink,
     147        Thickness = 5,
     148        Style = DrawingStyle.Solid,
     149        LineType = DataRowType.SingleValue
     150      };
    167151      aggregator.AddWatch(row1);
    168152
    169153      model.AddDataRow(aggregator);
    170 
    171154
    172155      row1.AddValue(10);
     
    183166    public class Worker {
    184167      // This method will be called when the thread is started.
    185       private ChartDataRowsModel model;
     168      private readonly ChartDataRowsModel model;
     169
    186170      public Worker(ChartDataRowsModel model) {
    187171        this.model = model;
    188172      }
    189      
     173
    190174      public void DoWorkMultiLine() {
    191 
    192         IDataRow row1 = new DataRow();
    193         row1.Color = Color.Red;
    194         row1.Thickness = 2;
    195         row1.Label = "Sinus";
    196         row1.Style = DrawingStyle.Solid;
     175        IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 2, Label = "Sinus", Style = DrawingStyle.Solid, ShowMarkers = false };
    197176        model.AddDataRow(row1);
    198177
    199         IDataRow row2 = new DataRow();
    200         row2.Color = Color.Red;
    201         row2.Thickness = 3;
    202         row2.Label = "Growing";
    203         row2.Style = DrawingStyle.Solid;
     178        IDataRow row2 = new DataRow { Color = Color.Red, Thickness = 3, Label = "Growing", Style = DrawingStyle.Solid, ShowMarkers = false };
    204179        model.AddDataRow(row2);
    205180
    206         AvgAggregator multiAvgAggregator = new AvgAggregator();
    207         multiAvgAggregator.Label = "MultiAvgAggregator";
    208         multiAvgAggregator.Color = Color.DarkOliveGreen;
    209         multiAvgAggregator.Thickness = 3;
    210         multiAvgAggregator.Style = DrawingStyle.Solid;
    211         multiAvgAggregator.LineType = DataRowType.SingleValue;
     181        AvgAggregator multiAvgAggregator = new AvgAggregator {
     182          Label = "MultiAvgAggregator",
     183          Color = Color.DarkOliveGreen,
     184          Thickness = 3,
     185          Style = DrawingStyle.Solid,
     186          LineType = DataRowType.SingleValue,
     187          ShowMarkers = false
     188        };
    212189        multiAvgAggregator.AddWatch(row1);
    213190        multiAvgAggregator.AddWatch(row2);
    214191        model.AddDataRow(multiAvgAggregator);
    215192
    216         MaxAggregator multiMaxAggregator = new MaxAggregator();
    217         multiMaxAggregator.Label = "MultiMaxAggregator";
    218         multiMaxAggregator.Color = Color.DarkKhaki;
    219         multiMaxAggregator.Thickness = 3;
    220         multiMaxAggregator.Style = DrawingStyle.Solid;
    221         multiMaxAggregator.LineType = DataRowType.SingleValue;
     193        MaxAggregator multiMaxAggregator = new MaxAggregator {
     194          Label = "MultiMaxAggregator",
     195          Color = Color.DarkKhaki,
     196          Thickness = 3,
     197          Style = DrawingStyle.Solid,
     198          LineType = DataRowType.SingleValue,
     199          ShowMarkers = false
     200        };
    222201        multiMaxAggregator.AddWatch(row1);
    223202        multiMaxAggregator.AddWatch(row2);
    224203        model.AddDataRow(multiMaxAggregator);
    225204
    226         MinAggregator multiMinAggregator = new MinAggregator();
    227         multiMinAggregator.Label = "MultiMinAggregator";
    228         multiMinAggregator.Color = Color.DarkRed;
    229         multiMinAggregator.Thickness = 3;
    230         multiMinAggregator.Style = DrawingStyle.Solid;
    231         multiMinAggregator.LineType = DataRowType.SingleValue;
     205        MinAggregator multiMinAggregator = new MinAggregator {
     206          Label = "MultiMinAggregator",
     207          Color = Color.DarkRed,
     208          Thickness = 3,
     209          Style = DrawingStyle.Solid,
     210          LineType = DataRowType.SingleValue,
     211          ShowMarkers = false
     212        };
    232213        multiMinAggregator.AddWatch(row1);
    233214        multiMinAggregator.AddWatch(row2);
    234215        model.AddDataRow(multiMinAggregator);
    235216
    236         AvgLineAggregator multiLineAvgAggregator = new AvgLineAggregator();
    237         multiLineAvgAggregator.Label = "MultiLineAvgAggregator";
    238         multiLineAvgAggregator.Color = Color.Red;
    239         multiLineAvgAggregator.Thickness = 4;
    240         multiLineAvgAggregator.Style = DrawingStyle.Solid;
    241         multiLineAvgAggregator.LineType = DataRowType.Normal;
    242         multiLineAvgAggregator.AddWatch(row1);
    243         multiLineAvgAggregator.AddWatch(row2);
    244         multiLineAvgAggregator.AddValue(0);
    245         model.AddDataRow(multiLineAvgAggregator);
     217        //        AvgLineAggregator multiLineAvgAggregator = new AvgLineAggregator {
     218        //                                                                           Label = "MultiLineAvgAggregator",
     219        //                                                                           Color = Color.Red,
     220        //                                                                           Thickness = 4,
     221        //                                                                           Style = DrawingStyle.Solid,
     222        //                                                                           LineType = DataRowType.Normal,
     223        //                                                                           ShowMarkers = false
     224        //                                                                         };
     225        //        multiLineAvgAggregator.AddWatch(row1);
     226        //        multiLineAvgAggregator.AddWatch(row2);
     227        //        multiLineAvgAggregator.AddValue(0);
     228        //        model.AddDataRow(multiLineAvgAggregator);
    246229
    247230        double i = 0;
    248         double newY;
    249 
    250         Random rand = new Random();
     231
     232
    251233        while (!_shouldStop && i <= 24) {
    252234          i += 0.2;
    253           newY = Math.Sin(i);
    254           System.Console.WriteLine("working");
    255           //row1.AddValue(rand.NextDouble() * 10);
    256           row1.AddValue(newY * 10);
    257           row2.AddValue(i*2-15);
    258           System.Threading.Thread.Sleep(100);
    259         }
    260         Console.WriteLine("worker thread: terminating gracefully.");
    261       }
    262       public void DoWorkSingleLine() {
    263 
    264         IDataRow row1 = new DataRow();
    265         row1.Color = Color.Red;
    266         row1.Thickness = 2;
    267         row1.Label = "Sinus";
    268         row1.Style = DrawingStyle.Solid;
    269         model.AddDataRow(row1);
    270 
    271         IDataRow row2 = new DataRow();
    272         row2.Color = Color.Red;
    273         row2.Thickness = 3;
    274         row2.Label = "Growing";
    275         row2.Style = DrawingStyle.Solid;
    276         model.AddDataRow(row2);
    277 
    278         MinAggregator aggregator = new MinAggregator();
    279         aggregator.Label = "MinAggregator";
    280         aggregator.Color = Color.Pink;
    281         aggregator.Thickness = 3;
    282         aggregator.Style = DrawingStyle.Solid;
    283         aggregator.LineType = DataRowType.SingleValue;
    284         aggregator.AddWatch(row1);
    285         model.AddDataRow(aggregator);
    286 
    287         MaxAggregator maxAggregator = new MaxAggregator();
    288         maxAggregator.Label = "MaxAggregator";
    289         maxAggregator.Color = Color.DeepSkyBlue;
    290         maxAggregator.Thickness = 3;
    291         maxAggregator.Style = DrawingStyle.Solid;
    292         maxAggregator.LineType = DataRowType.SingleValue;
    293         maxAggregator.AddWatch(row1);
    294         model.AddDataRow(maxAggregator);
    295 
    296         AvgAggregator avgAggregator = new AvgAggregator();
    297         avgAggregator.Label = "AvgAggregator";
    298         avgAggregator.Color = Color.Violet;
    299         avgAggregator.Thickness = 3;
    300         avgAggregator.Style = DrawingStyle.Solid;
    301         avgAggregator.LineType = DataRowType.SingleValue;
    302         avgAggregator.AddWatch(row1);
    303         model.AddDataRow(avgAggregator);
    304 
    305         double i = 0;
    306         double newY;
    307 
    308         Random rand = new Random();
    309         while (!_shouldStop && i <= 24) {
    310           i += 0.2;
    311           newY = Math.Sin(i);
    312           System.Console.WriteLine("working");
     235          double newY = Math.Sin(i);
     236          Console.WriteLine("working");
    313237          //row1.AddValue(rand.NextDouble() * 10);
    314238          row1.AddValue(newY * 10);
    315239          row2.AddValue(i * 2 - 15);
    316           System.Threading.Thread.Sleep(100);
     240          Thread.Sleep(100);
    317241        }
    318242        Console.WriteLine("worker thread: terminating gracefully.");
    319243      }
     244
     245      public void DoWorkSingleLine() {
     246        IDataRow row1 = new DataRow {
     247          Color = Color.Red,
     248          Thickness = 2,
     249          Label = "Sinus",
     250          Style = DrawingStyle.Solid,
     251          ShowMarkers = false
     252        };
     253        model.AddDataRow(row1);
     254
     255        IDataRow row2 = new DataRow {
     256          Color = Color.Red,
     257          Thickness = 3,
     258          Label = "Growing",
     259          Style = DrawingStyle.Solid,
     260          ShowMarkers = false
     261        };
     262        model.AddDataRow(row2);
     263
     264        MinAggregator aggregator = new MinAggregator {
     265          Label = "MinAggregator",
     266          Color = Color.Pink,
     267          Thickness = 3,
     268          Style = DrawingStyle.Solid,
     269          LineType = DataRowType.SingleValue
     270        };
     271        aggregator.AddWatch(row1);
     272        model.AddDataRow(aggregator);
     273
     274        MaxAggregator maxAggregator = new MaxAggregator {
     275          Label = "MaxAggregator",
     276          Color = Color.DeepSkyBlue,
     277          Thickness = 3,
     278          Style = DrawingStyle.Solid,
     279          LineType = DataRowType.SingleValue
     280        };
     281        maxAggregator.AddWatch(row1);
     282        model.AddDataRow(maxAggregator);
     283
     284        AvgAggregator avgAggregator = new AvgAggregator {
     285          Label = "AvgAggregator",
     286          Color = Color.Violet,
     287          Thickness = 3,
     288          Style = DrawingStyle.Solid,
     289          LineType = DataRowType.SingleValue
     290        };
     291        avgAggregator.AddWatch(row1);
     292        model.AddDataRow(avgAggregator);
     293
     294        double i = 0;
     295
     296
     297        while (!_shouldStop && i <= 240) {
     298          i += 0.2;
     299          double newY = Math.Sin(i);
     300          Console.WriteLine("working");
     301          //row1.AddValue(rand.NextDouble() * 10);
     302          row1.AddValue(newY * 10);
     303          row2.AddValue(i * 2 - 15);
     304          //System.Threading.Thread.Sleep(100);
     305        }
     306        Console.WriteLine("worker thread: terminating gracefully.");
     307      }
     308
    320309      public void DoWorkAvgLine() {
    321 
    322         IDataRow row1 = new DataRow();
    323         row1.Color = Color.Red;
    324         row1.Thickness = 2;
    325         row1.Label = "Sinus";
    326         row1.Style = DrawingStyle.Solid;
     310        IDataRow row1 = new DataRow {
     311          Color = Color.Red,
     312          Thickness = 2,
     313          Label = "Sinus",
     314          Style = DrawingStyle.Solid,
     315          ShowMarkers = false
     316        };
    327317        model.AddDataRow(row1);
    328318
    329         IDataRow row2 = new DataRow();
    330         row2.Color = Color.Red;
    331         row2.Thickness = 3;
    332         row2.Label = "Growing";
    333         row2.Style = DrawingStyle.Solid;
     319        IDataRow row2 = new DataRow {
     320          Color = Color.Red,
     321          Thickness = 3,
     322          Label = "Growing",
     323          Style = DrawingStyle.Solid,
     324          ShowMarkers = false
     325        };
    334326        model.AddDataRow(row2);
    335327
    336         AvgLineAggregator avgLineAggregator = new AvgLineAggregator();
    337         avgLineAggregator.Label = "AvgLineAggregator";
    338         avgLineAggregator.Color = Color.Violet;
    339         avgLineAggregator.Thickness = 3;
    340         avgLineAggregator.Style = DrawingStyle.Solid;
    341         avgLineAggregator.LineType = DataRowType.Normal;
     328        AvgLineAggregator avgLineAggregator = new AvgLineAggregator {
     329          Label = "AvgLineAggregator",
     330          Color = Color.Violet,
     331          Thickness = 3,
     332          Style = DrawingStyle.Solid,
     333          LineType = DataRowType.Normal,
     334          ShowMarkers = false
     335        };
    342336        avgLineAggregator.AddWatch(row1);
    343337        avgLineAggregator.AddWatch(row2);
     
    345339
    346340        double i = 0;
    347         double newY;
    348 
    349         Random rand = new Random();
    350         while (!_shouldStop && i <= 24) {
     341
     342        while (!_shouldStop && i <= 240) {
    351343          i += 0.2;
    352           newY = Math.Sin(i);
    353           System.Console.WriteLine("working");
     344          double newY = Math.Sin(i);
     345          Console.WriteLine("working");
    354346          //row1.AddValue(rand.NextDouble() * 10);
    355347          row1.AddValue(newY * 10);
    356348          row2.AddValue(i * 2 - 15);
    357           System.Threading.Thread.Sleep(100);
     349          //Thread.Sleep(100);
    358350        }
    359351        Console.WriteLine("worker thread: terminating gracefully.");
    360352      }
     353
     354      public void DoWorkFloatingAvg() {
     355        IDataRow row1 = new DataRow {
     356          Color = Color.Red,
     357          Thickness = 2,
     358          Label = "SinusHacked",
     359          Style = DrawingStyle.Solid,
     360          ShowMarkers = false
     361        };
     362        model.AddDataRow(row1);
     363
     364        IDataRow row2 = new DataRow {
     365          Color = Color.Red,
     366          Thickness = 3,
     367          Label = "GrowingHacked",
     368          Style = DrawingStyle.Solid,
     369          ShowMarkers = false
     370        };
     371        model.AddDataRow(row2);
     372
     373        // insert 2 floating avg line aggregators (for each hacked line)
     374
     375        // test floating avg aggregator without visible watcher line
     376
     377        double i = 0;
     378        Random rnd = new Random();
     379
     380        while (!_shouldStop && i <= 240) {
     381          i += 0.2;
     382          double newY = Math.Sin(i);
     383
     384          double hack = rnd.NextDouble() * i / 10;
     385          row1.AddValue(newY * 10 + hack);
     386
     387          hack = rnd.NextDouble() * i / 10;
     388          row2.AddValue(i * 2 - 15 + hack);
     389          //Thread.Sleep(100);
     390        }
     391        Console.WriteLine("worker thread: terminating gracefully.");
     392      }
     393
    361394      public void RequestStop() {
    362395        _shouldStop = true;
    363396      }
     397
    364398      // Volatile is used as hint to the compiler that this data
    365399      // member will be accessed by multiple threads.
     
    386420    public void TestAggregatorSingleLine() {
    387421      LineChartTestForm f = new LineChartTestForm(model);
    388    
     422      model.Title = "SingleLineAggregator Tests";
     423
    389424      // Create the thread object. This does not start the thread.
    390425      Worker workerObject = new Worker(model);
     
    397432      workerObject.RequestStop();
    398433    }
     434
    399435    [Test]
    400436    public void TestAggregatorAvgLine() {
    401437      LineChartTestForm f = new LineChartTestForm(model);
     438      model.Title = "AvgLineTest";
    402439
    403440      // Create the thread object. This does not start the thread.
     
    412449    }
    413450
    414    
     451    [Test]
     452    public void TestFloatingAvg() {
     453      LineChartTestForm f = new LineChartTestForm(model);
     454      model.Title = "FloatingAvg Test";
     455      model.ViewSettings.LegendPosition = Legend.LegendPosition.Top;
     456
     457      // Create the thread object. This does not start the thread.
     458      Worker workerObject = new Worker(model);
     459      Thread workerThread = new Thread(workerObject.DoWorkFloatingAvg);
     460
     461      // Start the worker thread.
     462      workerThread.Start();
     463
     464      f.ShowDialog();
     465      workerObject.RequestStop();
     466    }
     467
    415468
    416469    [Test]
    417470    public void TestAutoZoomInConstructor() {
    418       IDataRow row1 = new DataRow();
    419 
    420       row1.Color = Color.Red;
    421       row1.Thickness = 3;
    422       row1.Style = DrawingStyle.Solid;
     471      IDataRow row1 = new DataRow { Color = Color.Red, Thickness = 3, Style = DrawingStyle.Solid };
    423472
    424473      model.AddDataRow(row1);
     
    485534
    486535      row2.AddValue(5);
    487      
     536
    488537
    489538      row3.AddValue(2);
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgAggregator.cs

    r1605 r1607  
    2222    #endregion
    2323
    24     private List<IDataRow> dataRowWatches = new List<IDataRow>();
     24    private readonly List<IDataRow> dataRowWatches = new List<IDataRow>();
    2525    private double curAvgValue;
    2626
     
    126126    }
    127127
    128     public override void RemoveValues(int index, int count) {
     128    public override void RemoveValues(int index, int countVals) {
    129129      throw new NotSupportedException();
    130130    }
  • trunk/sources/HeuristicLab.Visualization/3.2/AvgLineAggregator.cs

    r1605 r1607  
    66
    77    private readonly List<double> dataRow = new List<double>();
     8    readonly List<IDataRow> dataRowWatches = new List<IDataRow>();
    89
    910    #region IAggregator Members
    1011
    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;
    1617    }
    1718
    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;
    2424    }
    2525
    26 
    2726    #endregion
    28 
    29     List<IDataRow> dataRowWatches = new List<IDataRow>();
    3027
    3128    void dataRow_ValueChanged(IDataRow row, double value, int index, Action action) {
    3229      switch (action) {
    3330        case Action.Added:
    34           refreshValue(row, value, Action.Added);
     31          refreshLastValues(row);
    3532          break;
    3633        case Action.Modified:
     
    3835          break;
    3936        case Action.Deleted:
    40           refreshValue(row, value, Action.Deleted);
     37          refreshLastValues(row);
    4138          break;
    4239        default:
    4340          throw new ArgumentOutOfRangeException("action");
    4441      }
    45 
    4642    }
    4743
     
    5753
    5854    private void refreshValue() {
    59       double tmpSum = 0;
     55     
    6056      int count = dataRowWatches.Count;
    6157
    6258      IDataRow firstRow = dataRowWatches[0];
    6359      int count1 = firstRow.Count;
    64       System.Console.WriteLine("count: " + count1);
     60      Console.WriteLine("count: " + count1);
    6561
    6662      dataRow.Clear();
     
    6864      if (dataRowWatches.Count >= 2) {
    6965        for (int i = 0; i < count1; i++) {
    70           tmpSum = 0;
     66          double tmpSum = 0;
    7167          for (int j = 0; j < count; j++) {
    7268            if (dataRowWatches[j].Count > i) {
     
    7571          }
    7672
    77           this.dataRow.Add(tmpSum / count);
     73          dataRow.Add(tmpSum / count);
    7874          OnValueChanged(tmpSum / count, dataRow.Count - 1, Action.Added);
    7975        }
     
    8177    }
    8278
    83     private void refreshValue(IDataRow row, double newVal, Action action) {
     79    private void refreshLastValues(IDataRow row) {
    8480
    8581      int index = row.Count - 1;
    86 
    87 
    88      
    89      
    9082      double curAvg = 0;
    91 //      if (dataRow.Count > 0) {
    92 //        curAvg = dataRow[0];   //?
    93 //      } else {
    94 //        curAvg = 0;
    95 //      }
    96 
    9783
    9884      foreach (IDataRow watch in dataRowWatches) {
    9985        if (watch.Count >= index +1) {
    100           curAvg += watch[index];
    101          
     86          curAvg += watch[index];
    10287        }
    103         //curAvg += watch[watch.Count - 1];
    10488      }
    10589
     
    116100        OnValueChanged(curAvg, dataRow.Count - 1, Action.Modified); 
    117101      }
    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);
    163102    }
    164103
     
    171110
    172111    public override void AddValue(double value, int index) {
    173       throw new NotImplementedException();
     112      throw new NotSupportedException();
    174113    }
    175114
     
    194133    }
    195134
    196     public override void RemoveValues(int index, int count) {
     135    public override void RemoveValues(int index, int countVals) {
    197136      throw new NotSupportedException();
    198137    }
     
    210149    }
    211150
    212     // TODO calculate min value
    213151    public override double MinValue {
    214152      get { return 0; }
    215153    }
    216154
    217     // TODO calculate max value
    218155    public override double MaxValue {
    219156      get { return 0; }
  • trunk/sources/HeuristicLab.Visualization/3.2/MaxAggregator.cs

    r1530 r1607  
    11using System;
    22using System.Collections.Generic;
    3 using System.Drawing;
    43
    54namespace HeuristicLab.Visualization {
Note: See TracChangeset for help on using the changeset viewer.