Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/09 19:42:17 (15 years ago)
Author:
mstoeger
Message:

Implemented multiple Y-Axes. A LineChart has several Y-Axes and each Y-Axis has several data rows. The same clipping area is set for all data rows belonging to a Y-Axis. (#433)

File:
1 edited

Legend:

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

    r1343 r1350  
    11using System;
    22using System.Collections.Generic;
    3 using System.Drawing;
    43
    54namespace HeuristicLab.Visualization {
    6   public class AvgAggregator : IAggregator {
    7 
    8 
     5  public class AvgAggregator : DataRowBase {
    96    #region IAggregator Members
    107
     
    1714
    1815    public void RemoveWatch(IDataRow dataRow) {
    19 
    2016      dataRowWatches.Remove(dataRow);
    2117      dataRow.DataRowChanged -= dataRow_DataRowChanged;
     
    2420    }
    2521
    26 
    2722    #endregion
    2823
    29     List<IDataRow> dataRowWatches = new List<IDataRow>();
    30     double curAvgValue;
     24    private List<IDataRow> dataRowWatches = new List<IDataRow>();
     25    private double curAvgValue;
    3126
    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) {
    3328      refreshValue(value);
    3429    }
    3530
    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) {
    3732      for (int i = 0; i < values.Length; i++) {
    3833        refreshValue(values[i]);
     
    4035    }
    4136
    42     void dataRow_DataRowChanged(IDataRow row) {
     37    private void dataRow_DataRowChanged(IDataRow row) {
    4338      refreshValue(double.MinValue);
    4439    }
     
    5045      double tmpSum = 0;
    5146      int count = 0;
    52       foreach (var rows in dataRowWatches) {
     47      foreach (IDataRow rows in dataRowWatches) {
    5348        for (int i = 0; i < rows.Count; i++) {
    5449          tmpSum += rows[i];
     
    6358    #region IDataRow Members
    6459
    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) {
    13261      throw new NotSupportedException();
    13362    }
    13463
    135     public void AddValue(double value, int index) {
     64    public override void AddValue(double value, int index) {
    13665      throw new NotSupportedException();
    13766    }
    13867
    139     public void AddValues(double[] values) {
     68    public override void AddValues(double[] values) {
    14069      throw new NotSupportedException();
    14170    }
    14271
    143     public void AddValues(double[] values, int index) {
     72    public override void AddValues(double[] values, int index) {
    14473      throw new NotSupportedException();
    14574    }
    14675
    147     public void ModifyValue(double value, int index) {
     76    public override void ModifyValue(double value, int index) {
    14877      throw new NotSupportedException();
    14978    }
    15079
    151     public void ModifyValues(double[] values, int index) {
     80    public override void ModifyValues(double[] values, int index) {
    15281      throw new NotSupportedException();
    15382    }
    15483
    155     public void RemoveValue(int index) {
     84    public override void RemoveValue(int index) {
    15685      throw new NotSupportedException();
    15786    }
    15887
    159     public void RemoveValues(int index, int count) {
     88    public override void RemoveValues(int index, int count) {
    16089      throw new NotSupportedException();
    16190    }
    16291
    163     public int Count {
     92    public override int Count {
    16493      get { return 1; }
    16594    }
    16695
    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(); }
    17499    }
    175100
    176     public double MinValue {
    177       get { throw new System.NotImplementedException(); }
     101    public override double MinValue {
     102      get { return curAvgValue; }
    178103    }
    179104
    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; }
    206107    }
    207108
Note: See TracChangeset for help on using the changeset viewer.