1.1 --- a/GUI/PlotPanel.cs Sat Jun 04 13:27:11 2011 +0000
1.2 +++ b/GUI/PlotPanel.cs Sun Jun 19 12:41:18 2011 +0000
1.3 @@ -16,7 +16,7 @@
1.4
1.5 The Initial Developer of the Original Code is
1.6 Michael Möller <m.moeller@gmx.ch>.
1.7 - Portions created by the Initial Developer are Copyright (C) 2009-2010
1.8 + Portions created by the Initial Developer are Copyright (C) 2009-2011
1.9 the Initial Developer. All Rights Reserved.
1.10
1.11 Contributor(s):
1.12 @@ -88,10 +88,12 @@
1.13 foreach (ISensor sensor in temperatures) {
1.14 IEnumerable<SensorValue> values = sensor.Values;
1.15 foreach (SensorValue value in values) {
1.16 - if (!minTempNullable.HasValue || minTempNullable > value.Value)
1.17 - minTempNullable = value.Value;
1.18 - if (!maxTempNullable.HasValue || maxTempNullable < value.Value)
1.19 - maxTempNullable = value.Value;
1.20 + if (!float.IsNaN(value.Value)) {
1.21 + if (!minTempNullable.HasValue || minTempNullable > value.Value)
1.22 + minTempNullable = value.Value;
1.23 + if (!maxTempNullable.HasValue || maxTempNullable < value.Value)
1.24 + maxTempNullable = value.Value;
1.25 + }
1.26 }
1.27 }
1.28 if (!minTempNullable.HasValue) {
1.29 @@ -140,6 +142,10 @@
1.30 deltaTime += 2;
1.31 while (deltaTime + 5 < maxTime && deltaTime < 100)
1.32 deltaTime += 5;
1.33 + while (deltaTime + 50 < maxTime && deltaTime < 1000)
1.34 + deltaTime += 50;
1.35 + while (deltaTime + 100 < maxTime && deltaTime < 10000)
1.36 + deltaTime += 100;
1.37
1.38 List<float> grid = new List<float>(countTime + 1);
1.39 for (int i = 0; i <= countTime; i++) {
1.40 @@ -149,7 +155,6 @@
1.41 }
1.42
1.43 protected override void OnPaint(PaintEventArgs e) {
1.44 -
1.45 now = DateTime.Now - new TimeSpan(0, 0, 4);
1.46
1.47 List<float> timeGrid = GetTimeGrid();
1.48 @@ -196,14 +201,18 @@
1.49 IEnumerable<SensorValue> values = sensor.Values;
1.50 PointF last = new PointF();
1.51 bool first = true;
1.52 - foreach (SensorValue value in values) {
1.53 - PointF point = new PointF(
1.54 - x0 + w - w * (float)(now - value.Time).TotalMinutes / deltaTime,
1.55 - y0 + h - h * (value.Value - tempGrid[0]) / deltaTemp);
1.56 - if (!first)
1.57 - g.DrawLine(pen, last, point);
1.58 - last = point;
1.59 - first = false;
1.60 + foreach (SensorValue v in values) {
1.61 + if (!float.IsNaN(v.Value)) {
1.62 + PointF point = new PointF(
1.63 + x0 + w - w * (float)(now - v.Time).TotalMinutes / deltaTime,
1.64 + y0 + h - h * (v.Value - tempGrid[0]) / deltaTemp);
1.65 + if (!first)
1.66 + g.DrawLine(pen, last, point);
1.67 + last = point;
1.68 + first = false;
1.69 + } else {
1.70 + first = true;
1.71 + }
1.72 }
1.73 }
1.74 }