(1) Production Tracing tab removed from MoreWMResultsDlg, (2) WMChart: testRslt.TestTime used instead of mtr.TestTime, AxisX Minimum and Maximum.

This commit is contained in:
Milan Hanajik
2019-09-15 06:24:42 +02:00
parent 886d87c03d
commit 604c59723f
2 changed files with 34 additions and 11 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Results.Forms
if (refRecords == null) if (refRecords == null)
{ {
tabControl1.SelectTab(1); tabControl1.SelectTab(1);
tabControl1.TabPages[2].Hide(); tabControl1.TabPages.RemoveAt(2);
} }
else else
{ {
+33 -10
View File
@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
using Config.Entities; using Config.Entities;
using Results.Entities; using Results.Entities;
@@ -22,9 +21,9 @@ namespace Results.Output
IList<PointF> unsortedPoints = new List<PointF>(); IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.MeterTestRslts) foreach (var mtr in wm.MeterTestRslts)
{ {
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0)) if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{ {
double flow = Config.Units.ConvertTo(flowUnit, mtr.TestRslt.VolumeCTV / mtr.TestTime * 3.6 * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster); double flow = Config.Units.ConvertTo(flowUnit, 3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow > 0) if (flow > 0)
{ {
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error)); unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
@@ -47,7 +46,7 @@ namespace Results.Output
chArea.AxisX.Title = Strings.Flow; chArea.AxisX.Title = Strings.Flow;
chArea.AxisX.IsLogarithmic = true; chArea.AxisX.IsLogarithmic = true;
chArea.AxisX.LogarithmBase = 10; chArea.AxisX.LogarithmBase = 10;
chArea.AxisX.IsLabelAutoFit = false; chArea.AxisX.IsLabelAutoFit = true;
List<double> xs = new List<double>() { 0.0001, 0.0002, 0.0005, List<double> xs = new List<double>() { 0.0001, 0.0002, 0.0005,
0.001, 0.002, 0.005, 0.001, 0.002, 0.005,
@@ -59,19 +58,43 @@ namespace Results.Output
1000, 2000, 5000, 1000, 2000, 5000,
10000, 20000, 50000, 10000, 20000, 50000,
100000, 200000, 500000, 100000, 200000, 500000,
1000000, 2000000, 5000000 }; 1000000, 2000000, 5000000,
10000000 };
double spacer = 0.8; double spacer = 0.8;
double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin); double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn); double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
for (int i = 1; i < xs.Count - 1; i++) bool inRange = false;
for (int i = 0; i < xs.Count - 3; i += 3)
{ {
if ((xs[i + 1] > from) && (xs[i - 1] < to)) if (xs[i] <= from && from < xs[i + 3])
{ {
chArea.AxisX.Minimum = xs[i];
inRange = true;
}
if (inRange)
{
for (int j = i; j < i + 3; j++)
{
CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[j], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[j] * spacer);
cl.ToPosition = Math.Log10(xs[j] / spacer);
chArea.AxisX.CustomLabels.Add(cl);
}
}
if (xs[i] < to && to <= xs[i + 3])
{
chArea.AxisX.Maximum = xs[i + 3];
CustomLabel cl = new CustomLabel(); CustomLabel cl = new CustomLabel();
cl.Text = string.Format("{0} {1}", xs[i], flowUnit.ToDescription()); cl.Text = string.Format("{0} {1}", xs[i + 3], flowUnit.ToDescription());
cl.FromPosition = Math.Log10(xs[i] * spacer); cl.FromPosition = Math.Log10(xs[i + 3] * spacer);
cl.ToPosition = Math.Log10(xs[i] / spacer); cl.ToPosition = Math.Log10(xs[i + 3] / spacer);
chArea.AxisX.CustomLabels.Add(cl); chArea.AxisX.CustomLabels.Add(cl);
break;
} }
} }