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 _allBindList = null; List _allPacketList = null; /// /// 绑定数据 /// public void SetBindingData(List allPacketList) { this._allPacketList = allPacketList; List sss = new List(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(); } } }