63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
///
|
|
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms.DataVisualization.Charting;
|
|
using Results.Entities;
|
|
using Statistics.Resources;
|
|
|
|
namespace Statistics.UserControls
|
|
{
|
|
public partial class StatisticsCtrl : UserControl
|
|
{
|
|
public int Id; /// Index of the tab page
|
|
public MidOrWaterMetersCtrl MidCtrl; /// Reference to the parent control
|
|
|
|
public StatisticsCtrl()
|
|
{
|
|
InitializeComponent();
|
|
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
|
|
chart1.ChartAreas[0].AxisX.Interval = 1;
|
|
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;
|
|
}
|
|
|
|
private void updateButton_Click(object sender, EventArgs e)
|
|
{
|
|
if (MidCtrl != null)
|
|
{
|
|
for (int i = 1; i <= 5; i++)
|
|
{
|
|
chart1.Series[string.Format("Flow {0}", i)].Points.Clear();
|
|
}
|
|
|
|
IList<TestRslt> results = MidCtrl.UpdateRequest(Id);
|
|
|
|
if (results != null)
|
|
{
|
|
foreach (var r in results)
|
|
{
|
|
if (r.ErrorMaster != 0)
|
|
{
|
|
for (int i = 1; i <= 5; i++)
|
|
{
|
|
if (MidCtrl.IsFlowEnabled(i) && (MidCtrl.FlowFrom(i) <= r.FlowMean) && (r.FlowMean <= MidCtrl.FlowTo(i)))
|
|
{
|
|
chart1.Series[string.Format("Flow {0}", i)].Points.AddXY(r.StartTime, r.ErrorMaster);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void exportButton_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|