GUI/PlotPanel.cs
changeset 159 eda3e3458cf4
parent 158 119693c3b7d1
child 298 96263190189a
     1.1 --- a/GUI/PlotPanel.cs	Sat Jul 24 20:15:49 2010 +0000
     1.2 +++ b/GUI/PlotPanel.cs	Tue Jul 27 18:38:11 2010 +0000
     1.3 @@ -86,12 +86,12 @@
     1.4        float? minTempNullable = null;
     1.5        float? maxTempNullable = null;
     1.6        foreach (ISensor sensor in temperatures) {
     1.7 -        IEnumerable<ISensorEntry> graph = sensor.Plot;
     1.8 -        foreach (ISensorEntry entry in graph) {
     1.9 -          if (!minTempNullable.HasValue || minTempNullable > entry.Value)
    1.10 -            minTempNullable = entry.Value;
    1.11 -          if (!maxTempNullable.HasValue || maxTempNullable < entry.Value)
    1.12 -            maxTempNullable = entry.Value;
    1.13 +        IEnumerable<SensorValue> values = sensor.Values;
    1.14 +        foreach (SensorValue value in values) {
    1.15 +          if (!minTempNullable.HasValue || minTempNullable > value.Value)
    1.16 +            minTempNullable = value.Value;
    1.17 +          if (!maxTempNullable.HasValue || maxTempNullable < value.Value)
    1.18 +            maxTempNullable = value.Value;
    1.19          }
    1.20        }
    1.21        if (!minTempNullable.HasValue) {
    1.22 @@ -125,8 +125,8 @@
    1.23  
    1.24        float maxTime = 5;
    1.25        if (temperatures.Count > 0) {
    1.26 -        IEnumerator<ISensorEntry> enumerator =
    1.27 -          temperatures[0].Plot.GetEnumerator();
    1.28 +        IEnumerator<SensorValue> enumerator =
    1.29 +          temperatures[0].Values.GetEnumerator();
    1.30          if (enumerator.MoveNext()) {
    1.31            maxTime = (float)(now - enumerator.Current.Time).TotalMinutes;
    1.32          }
    1.33 @@ -193,13 +193,13 @@
    1.34          float deltaTime = timeGrid[timeGrid.Count - 1];
    1.35          foreach (ISensor sensor in temperatures) {
    1.36            using (Pen pen = new Pen(colors[sensor])) {
    1.37 -            IEnumerable<ISensorEntry> graph = sensor.Plot;
    1.38 +            IEnumerable<SensorValue> values = sensor.Values;
    1.39              PointF last = new PointF();
    1.40              bool first = true;
    1.41 -            foreach (ISensorEntry entry in graph) {
    1.42 +            foreach (SensorValue value in values) {
    1.43                PointF point = new PointF(
    1.44 -                  x0 + w - w * (float)(now - entry.Time).TotalMinutes / deltaTime,
    1.45 -                  y0 + h - h * (entry.Value - tempGrid[0]) / deltaTemp);
    1.46 +                  x0 + w - w * (float)(now - value.Time).TotalMinutes / deltaTime,
    1.47 +                  y0 + h - h * (value.Value - tempGrid[0]) / deltaTemp);
    1.48                if (!first)
    1.49                  g.DrawLine(pen, last, point);
    1.50                last = point;