Free cookie consent management tool by TermsFeed Policy Generator

Changeset 859


Ignore:
Timestamp:
11/29/08 10:57:47 (15 years ago)
Author:
cbahner
Message:

#318 implemented interfaces of ChartDataRowsModel

Location:
trunk/sources/HeuristicLab.Visualization
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/ChartDataRowsModel.cs

    r761 r859  
    77  public delegate void DataRowAddedHandler(IDataRow row);
    88  public delegate void DataRowRemovedHandler(IDataRow row);
    9 
    109  public delegate void ModelChangedHandler();
    1110
    12   public class ChartDataRowsModel : ChartDataModelBase, IChartDataRowsModel {
     11  public class ChartDataRowsModel : ChartDataModelBase, IChartDataRowsModel{
    1312    private string title;
    1413    private string xAxisLabel;
    15     private string yAxisLabel;
    1614
    17     public void AddLabel(string label) {
    18       throw new NotImplementedException();
    19       // TODO ModelChangedEvent auslösen
     15    private readonly List<IDataRow> rows = new List<IDataRow>();
     16    private readonly List<string> xLabels = new List<string>();
     17
     18    public List<string> XLabels{
     19      get { return xLabels; }
    2020    }
    2121
    22     public void AddLabel(string label, int index) {
    23       throw new NotImplementedException();
    24       // TODO ModelChangedEvent auslösen
    25     }
    26 
    27     public void AddLabels(string[] labels) {
    28       throw new NotImplementedException();
    29       // TODO ModelChangedEvent auslösen
    30     }
    31 
    32     public void AddLabels(string[] labels, int index) {
    33       throw new NotImplementedException();
    34       // TODO ModelChangedEvent auslösen
    35     }
    36 
    37     public void ModifyLabel(string label, int index) {
    38       throw new NotImplementedException();
    39       // TODO ModelChangedEvent auslösen
    40     }
    41 
    42     public void ModifyLabels(string[] labels, int index) {
    43       throw new NotImplementedException();
    44       // TODO ModelChangedEvent auslösen
    45     }
    46 
    47     public void RemoveLabel(int index) {
    48       throw new NotImplementedException();
    49       // TODO ModelChangedEvent auslösen
    50     }
    51 
    52     public void RemoveLabels(int index, int count) {
    53       throw new NotImplementedException();
    54       // TODO ModelChangedEvent auslösen
     22    public List<IDataRow> Rows{
     23      get { return rows; }
    5524    }
    5625
     
    6231      }
    6332    }
    64 
    6533    public string XAxisLabel {
    6634      get { return xAxisLabel; }
     
    7139    }
    7240
    73     public string YAxisLabel {
    74       get { return yAxisLabel; }
    75       set {
    76         yAxisLabel = value;
    77         OnModelChanged();
    78       }
     41    public override IView CreateView() {
     42      return new LineChart(this);
    7943    }
    8044
    81     public event ModelChangedHandler ModelChanged;
    82 
    83     protected void OnModelChanged() {
    84       if (ModelChanged != null) {
    85         ModelChanged();
    86       }
     45    public void AddLabel(string label) {
     46      xLabels.Add(label);
     47      OnModelChanged();
    8748    }
    8849
    89     private readonly List<IDataRow> rows = new List<IDataRow>();
    90    
    91     public static IDataRow CreateDataRow() {
    92       throw new NotImplementedException();
     50    public void AddLabel(string label, int index) {
     51      xLabels[index] = label;
     52      OnModelChanged();
     53    }
     54
     55    public void AddLabels(string[] labels) {
     56      foreach (var s in labels){
     57        AddLabel(s);
     58      }
     59      //OnModelChanged();
     60    }
     61
     62    public void AddLabels(string[] labels, int index) {
     63      int i = 0;
     64      foreach (var s in labels){
     65        AddLabel(s, index + i);
     66        i++;
     67      }
     68      //OnModelChanged();
     69    }
     70
     71    public void ModifyLabel(string label, int index) {
     72      xLabels[index] = label;
     73      OnModelChanged();
     74    }
     75
     76    public void ModifyLabels(string[] labels, int index) {
     77      int i = 0;
     78      foreach (var s in labels){
     79        ModifyLabel(s, index + i);
     80        i++;
     81      }
     82      //OnModelChanged();
     83    }
     84
     85    public void RemoveLabel(int index) {
     86      xLabels.RemoveAt(index);
     87      OnModelChanged();
     88    }
     89
     90    public void RemoveLabels(int index, int count) {
     91      for (int i = index; i < index + count; i++ ){
     92        RemoveLabel(i);
     93      }
     94      //OnModelChanged();
    9395    }
    9496
     
    101103      rows.Remove(row);
    102104      OnDataRowRemoved(row);
     105    }
     106
     107    public event ModelChangedHandler ModelChanged;
     108
     109    protected void OnModelChanged() {
     110      if (ModelChanged != null) {
     111        ModelChanged();
     112      }
    103113    }
    104114
     
    119129    }
    120130
    121     public override IView CreateView() {
    122       return new LineChart(this); //when LineChart is implemented
    123     }
     131   
    124132
    125133    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
  • trunk/sources/HeuristicLab.Visualization/IChartDataRowsModel.cs

    r761 r859  
    1 namespace HeuristicLab.Visualization {
     1using System.Collections.Generic;
     2
     3namespace HeuristicLab.Visualization {
    24  public interface IChartDataRowsModel {
    35    string Title { get; set; }
    46    string XAxisLabel { get; set; }
    5     string YAxisLabel { get; set; }
     7    List<string> XLabels { get; }
     8    List<IDataRow> Rows { get; }
    69
    710    void AddDataRow(IDataRow row);
Note: See TracChangeset for help on using the changeset viewer.