Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Persistence Test/HeuristicLab.Visualization/3.2/ChartDataRowsModelInjector.cs @ 4021

Last change on this file since 4021 was 1975, checked in by shofstad, 16 years ago

DataRowSettings updated (#636)

File size: 3.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Drawing;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28
29namespace HeuristicLab.Visualization {
30  public class ChartDataRowsModelInjector : OperatorBase {
31    /// <inheritdoc select="summary"/>
32    public override string Description {
33      get { return @"Operator to test the new charting framework of the visualization project team."; }
34    }
35
36    public ChartDataRowsModelInjector() {
37      AddVariableInfo(new VariableInfo("Model", "New data model which should be injected into a scope.", typeof(IChartDataRowsModel), VariableKind.New | VariableKind.Out));
38    }
39
40    public override IOperation Apply(IScope scope) {
41      ChartDataRowsModel model = new ChartDataRowsModel();
42      model.Title = "Solution Quality / Selection Pressure";
43      model.XAxis.Label = "Generations";
44      model.DefaultYAxis.Label = "Solution Quality";
45
46      IDataRow dataRow;
47      dataRow = new DataRow("Best Quality");
48      dataRow.RowSettings.Color = Color.Green;
49      dataRow.RowSettings.Thickness = 1;
50      dataRow.RowSettings.Style = DrawingStyle.Solid;
51      dataRow.RowSettings.ShowMarkers = true;
52      model.AddDataRow(dataRow);
53
54      dataRow = new DataRow("Average Quality");
55      dataRow.RowSettings.Color = Color.Blue;
56      dataRow.RowSettings.Thickness = 2;
57      dataRow.RowSettings.Style = DrawingStyle.Dashed;
58      dataRow.RowSettings.ShowMarkers = true;
59      model.AddDataRow(dataRow);
60
61      dataRow = new DataRow("Worst Quality");
62      dataRow.RowSettings.Color = Color.Red;
63      dataRow.RowSettings.Thickness = 1;
64      dataRow.RowSettings.Style = DrawingStyle.Solid;
65      dataRow.RowSettings.ShowMarkers = true;
66      model.AddDataRow(dataRow);
67
68      dataRow = new DataRow("Selection Pressure");
69      dataRow.RowSettings.Color = Color.Gray;
70      dataRow.RowSettings.Thickness = 1;
71      dataRow.RowSettings.Style = DrawingStyle.Solid;
72      dataRow.RowSettings.ShowMarkers = true;
73      YAxisDescriptor yAxisDescriptor = new YAxisDescriptor();
74      yAxisDescriptor.Label = "Selection Pressure";
75      dataRow.YAxis = yAxisDescriptor;
76      model.AddDataRow(dataRow);
77
78      IVariableInfo modelInfo = GetVariableInfo("Model");
79      if (modelInfo.Local) {
80        this.AddVariable(new Variable(modelInfo.ActualName, model));
81      } else {
82        scope.AddVariable(new Variable(modelInfo.ActualName, model));
83      }
84      return null;
85    }
86  }
87}
Note: See TracBrowser for help on using the repository browser.