Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/14/08 18:48:35 (16 years ago)
Author:
mstoeger
Message:

Implemented simple XAxis (#433)

File:
1 edited

Legend:

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

    r985 r987  
    5151      minDataValue = Double.PositiveInfinity;
    5252      maxDataValue = Double.NegativeInfinity;
    53 
    5453    }
    5554
     
    8887        maxDataRowCount = row.Count;
    8988     
    90       InitShapes(row);
     89      InitLineShapes(row);
     90      InitXAxis();
     91    }
     92
     93    private void InitXAxis() {
     94      int numLabels = 0;
     95
     96      foreach (IDataRow row in model.Rows) {
     97        numLabels = Math.Max(numLabels, row.Count);
     98      }
     99
     100      xAxis.ClearLabels();
     101
     102      for (int i = 0; i < numLabels; i++) {
     103        xAxis.SetLabel(i, i.ToString());
     104      }
    91105    }
    92106
     
    101115    }
    102116
    103     private void InitShapes(IDataRow row) {
    104      
    105        
     117    private void InitLineShapes(IDataRow row) {
    106118      List<LineShape> lineShapes = new List<LineShape>();
    107119      if (row.Count > 0) {
     
    132144    // TODO use action parameter
    133145    private void OnRowValueChanged(IDataRow row, double value, int index, Action action) {
     146      xAxis.SetLabel(index, index.ToString());
     147
    134148      List<LineShape> lineShapes = rowToLineShapes[row];
    135149      maxDataValue = Math.Max(value, maxDataValue);
     
    142156      // new value was added
    143157      if (index > 0 && index == lineShapes.Count + 1) {
    144        
    145158        if (maxDataRowCount < row.Count)
    146159          maxDataRowCount = row.Count;
     
    148161        lineShapes.Add(lineShape);
    149162        // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently.
    150         canvasUI1.MainCanvas.WorldShape.AddShape(lineShape);
     163        root.AddShape(lineShape);
    151164      }
    152165
     
    171184    }
    172185
    173     private void OnModelChanged() {}
     186    private void OnModelChanged() {
     187      InitXAxis();
     188    }
    174189
    175190    #endregion
Note: See TracChangeset for help on using the changeset viewer.