duheng
7 天以前 4de480ec624d3b79ca690dc906e10cd2fbdc9be7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using DevExpress.Charts.Native;
using DevExpress.XtraCharts;
using DevExpress.XtraCharts.Native;
using DevExpress.XtraEditors;
using IStation.Unit;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.River
{
    public partial class RiverWaterLevelMonthDataCtrl : XtraUserControl
    {
        public RiverWaterLevelMonthDataCtrl()
        {
            InitializeComponent();
           
            //this.mainChart.BoxSelCompleteEvent += TimeValueEasyChartView1_BoxSelCompleteEvent;
        }
        public class CurrentViewModel
        {
            public CurrentViewModel() { }
            public CurrentViewModel(DateTime time, double value)
            {
                this.Time = time;
               // this.Value = Book_Minor;
            }
 
            public DateTime Time { get; set; }
            public double RiverHeight { get; set; }
            public double BoxHeight { get; set; }
            public double Drop  { get; set; }
            public int PumpCount { get; set; }
        }
       // List<CurrentViewModel> _allBindList = null;
        List<Model.MonthSignalRecordPacket> _allPacketList = null;
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(List<Model.MonthSignalRecordPacket>  allPacketList)
        {
            this._allPacketList = allPacketList;
 
            List<DevExpress.XtraCharts.Series> sss = new List<Series>(allPacketList.Count);
            this.chartControl1.Series.Clear();
            //int indx = 0;
            foreach (var packet in _allPacketList)
            {
                DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView();
 
                DevExpress.XtraCharts.Series series  = new DevExpress.XtraCharts.Series();
                series.Name = string.Format("{0}年{1}月水位", packet.Year, packet.Month);
                series.View = lineSeriesView1;
                series.CrosshairLabelPattern = "{S}  {A:d日 HH:mm}  长江水位: {V}";
 
                foreach (var r in packet.StationSignalRecords)
                {
                    //if (r.PumpRunCount <= 0) continue;
                    if (r.ChangJiangWL == null) continue;
                    //if (r.QianChiWL == null) continue;
                    if (r.ChangJiangWL <= -100) continue;
                    //if (r.QianChiWL <= -100) continue;
                    series.Points.Add(new DevExpress.XtraCharts.SeriesPoint( 
                        new DateTime(2023,1,r.Time.Day,r.Time.Hour,r.Time.Month,0),
                        new double[] { Math.Round( r.ChangJiangWL.Value,2) } )); 
                }
 
                sss.Add(series);
            }
 
 
 
            this.chartControl1.SeriesSerializable = sss.ToArray();
 
 
        }
 
 
    }
 
}