Free cookie consent management tool by TermsFeed Policy Generator

Changeset 926


Ignore:
Timestamp:
12/09/08 14:17:56 (15 years ago)
Author:
abeham
Message:

Added automatic update of the zoom region (#423)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Logging/LinechartView.cs

    r362 r926  
    3434namespace HeuristicLab.Logging {
    3535  public partial class LinechartView : ViewBase {
     36    private double maxY = double.MinValue, minY = double.MaxValue;
    3637    private static int[] colors = new int[] {
    3738      182,182,255,
     
    8687      datachart.Group.Clear();
    8788      datachart.Group.Add(new Axis(datachart, 0, 0, AxisType.Both));
    88       double maxY = double.MinValue, minY = double.MaxValue;
    8989      if(Linechart != null) {
    9090        datachart.UpdateEnabled = false;
     
    100100          ItemList list = (ItemList)Linechart.Values[i];
    101101          for(int j = 0; j < list.Count; j++) {
    102             double value = ((DoubleData)list[j]).Data;
     102            double value = 0.0;
     103            if (list[j] is IntData) value = (double)((IntData)list[j]).Data;
     104            else value = ((DoubleData)list[j]).Data;
    103105            if(!double.IsInfinity(value) && !double.IsNaN(value)) {
    104106              if(value < minY) minY = value;
     
    130132        ItemList list = (ItemList)e.Item;
    131133        datachart.UpdateEnabled = false;
    132         for(int i = 0; i < list.Count; i++)
    133           datachart.AddDataPoint(i, e.Index, ((DoubleData)list[i]).Data);
     134        for (int i = 0; i < list.Count; i++) {
     135          double value = 0.0;
     136          if (list[i] is IntData) value = (double)((IntData)list[i]).Data;
     137          else value = ((DoubleData)list[i]).Data;
     138          datachart.AddDataPoint(i, e.Index, value);
     139          if (value < minY) minY = value;
     140          if (value > maxY) maxY = value;
     141        }
     142        datachart.ZoomIn(-Linechart.Values.Count * 0.05, minY - (minY * 0.1), Linechart.Values.Count * 1.05, maxY * 1.05);
    134143        datachart.UpdateEnabled = true;
    135144        datachart.EnforceUpdate();
Note: See TracChangeset for help on using the changeset viewer.