using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Drawing;
|
using System.Drawing.Drawing2D;
|
using System.Linq;
|
using System.Windows.Forms;
|
using DevExpress.XtraCharts;
|
using DevExpress.XtraGrid.Views.Grid;
|
using DevExpress.XtraRichEdit.Utils;
|
using IStation.CalcModel;
|
|
namespace IStation.WinFrmUI.CalcErQu
|
{
|
public partial class AnaResultInfoManuCtrl : UserControl
|
{
|
DevExpress.XtraCharts.XYDiagram mainDiagram;
|
//计算时间跨度
|
//protected int _calcSpaceMinute = 10;
|
//public int CalcSpaceMinute { get { return _calcSpaceMinute; } set { _calcSpaceMinute = Book_Minor; } }
|
|
DevExpress.XtraCharts.ConstantLine _moveConstantLineIn实时数据 = null;
|
|
public AnaResultInfoManuCtrl()
|
{
|
InitializeComponent();
|
|
tabPage实时数据.PageVisible = false;
|
|
this.chartControl实时数据.CustomPaint += new DevExpress.XtraCharts.CustomPaintEventHandler(this.ChartControl实时数据_CustomPaint);
|
this.chartControl实时数据.MouseClick += ChartControl实时数据_MouseClick;
|
this.mainDiagram = this.chartControl实时数据.Diagram as DevExpress.XtraCharts.XYDiagram;
|
|
|
_moveConstantLineIn实时数据 = mainDiagram.AxisX.ConstantLines[0];
|
_moveConstantLineIn实时数据.Visible = false;
|
|
CraeteMaxMinLabel();
|
}
|
|
|
|
private void CraeteMaxMinLabel()
|
{
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = new DevExpress.XtraCharts.PaneAnchorPoint();
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint2 = new DevExpress.XtraCharts.PaneAnchorPoint();
|
DevExpress.XtraCharts.TextAnnotation textAnnotation1 = new DevExpress.XtraCharts.TextAnnotation();
|
DevExpress.XtraCharts.TextAnnotation textAnnotation2 = new DevExpress.XtraCharts.TextAnnotation();
|
DevExpress.XtraCharts.RelativePosition relativePosition1 = new DevExpress.XtraCharts.RelativePosition();
|
DevExpress.XtraCharts.RelativePosition relativePosition2 = new DevExpress.XtraCharts.RelativePosition();
|
|
var axis_sw = mainDiagram.AxisY;
|
|
paneAnchorPoint1.AxisXCoordinate.AxisValueSerializable = "09/10/2023 22:00:00.000";
|
paneAnchorPoint1.AxisYCoordinate.AxisValueSerializable = "5.9";
|
paneAnchorPoint1.AxisYCoordinate.Axis = axis_sw;
|
paneAnchorPoint1.Pane = this.mainDiagram.DefaultPane;//.Panes[0];
|
|
textAnnotation1.AnchorPoint = paneAnchorPoint1;
|
textAnnotation1.AutoHeight = false;
|
textAnnotation1.AutoSize = false;
|
textAnnotation1.AutoWidth = false;
|
textAnnotation1.Height = 23;
|
textAnnotation1.Name = "Maximum";
|
textAnnotation1.RuntimeAnchoring = true;
|
textAnnotation1.RuntimeResizing = true;
|
textAnnotation1.RuntimeRotation = true;
|
textAnnotation1.RuntimeMoving = true;
|
textAnnotation1.TextColor = Color.Magenta;
|
relativePosition1.Angle = -45D;
|
|
textAnnotation1.ShapePosition = relativePosition1;
|
textAnnotation1.Text = "Maximum";
|
textAnnotation1.Width = 77;
|
|
|
|
paneAnchorPoint2.AxisXCoordinate.AxisValueSerializable = "09/10/2023 22:00:00.000";
|
paneAnchorPoint2.AxisYCoordinate.AxisValueSerializable = "7.3";
|
paneAnchorPoint2.AxisYCoordinate.Axis = axis_sw;
|
paneAnchorPoint2.Pane = this.mainDiagram.DefaultPane;//this.mainDiagram.Panes[0];
|
textAnnotation2.AnchorPoint = paneAnchorPoint2;
|
textAnnotation2.AutoHeight = true;
|
textAnnotation2.AutoWidth = true;
|
textAnnotation2.Name = "Minimum";
|
textAnnotation2.TextColor = Color.Magenta;
|
relativePosition2.Angle = 135D;
|
textAnnotation2.ShapePosition = relativePosition2;
|
textAnnotation2.Text = "Minimum";
|
textAnnotation2.RuntimeAnchoring = true;
|
textAnnotation2.RuntimeResizing = true;
|
textAnnotation2.RuntimeRotation = true;
|
textAnnotation2.RuntimeMoving = true;
|
|
this.chartControl实时数据.AnnotationRepository.AddRange(new DevExpress.XtraCharts.Annotation[] {
|
textAnnotation1,
|
textAnnotation2});
|
}
|
public void SetTipLineVisible(bool isShow)
|
{
|
_moveConstantLineIn实时数据.Visible = isShow;
|
}
|
public void SetTipLineValue(DateTime t)
|
{
|
_moveConstantLineIn实时数据.Title.Text = t.ToString("HH:mm");
|
_moveConstantLineIn实时数据.AxisValueSerializable = t.ToString();
|
//_moveConstantLineIn实时数据.Visible = isShow;
|
|
//if (d == null || d.OpenPumpCount == 0)
|
// return;
|
//chartPumpCurveParalCtrl1.SetPumpRun(d);
|
}
|
|
|
//
|
IStation.CalcModel.AnaPrj _current_anaPrj = null;
|
|
public IStation.CalcModel.AnaPrj GetAnaPrj()
|
{
|
return this._current_anaPrj;
|
}
|
|
|
//初始化 实时数据
|
//List<IStation.CalcModel.AnaPrjPointTime> _realTimeDataList;
|
//public List<IStation.CalcModel.AnaPrjPointTime> GetRealTimeDataList()
|
//{
|
// return _realTimeDataList;
|
//}
|
|
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="current_anaPrj"></param>
|
public void SetBindingData(
|
IStation.CalcModel.AnaPrj current_anaPrj )//前日
|
{
|
if (current_anaPrj == null)
|
return;
|
|
|
this._current_anaPrj = current_anaPrj;
|
|
InitialChart实时数据(current_anaPrj);
|
InitialChart累计数据(current_anaPrj);
|
|
tabPage今日开机策略.Text = string.Format("开机策略({0})", current_anaPrj.StartTime.ToString("yyyy-MM-dd"));
|
blockTimeListDispCtrl1.SetBindingData(current_anaPrj);
|
|
|
|
//tabPageYesterday2.Text = string.Format("开机策略({0})", current_anaPrj.StartTime.AddDays(-2).ToString("yyyy-MM-dd"));
|
//blockTimeListDispCtrl3.SetBindingData(prj_yesteday2);
|
|
}
|
|
#region 累计数据
|
private void InitialChart累计数据(IStation.CalcModel.AnaPrj anaPrj)
|
{
|
var series累计流量 = chartControl累计数据.Series[0];
|
var series累计电量 = chartControl累计数据.Series[1];
|
var series累计电费 = chartControl累计数据.Series[2];
|
var series用水量 = chartControl累计数据.Series[3];
|
|
series累计流量.Points.Clear();
|
series累计电量.Points.Clear();
|
series累计电费.Points.Clear();
|
series用水量.Points.Clear();
|
double sumFlow = 0;
|
double sumPower = 0;
|
double sumMoney = 0;
|
|
var allTime = _current_anaPrj.GetAllPointTimeList();
|
for (int i = 0; i < allTime.Count; i++)
|
{
|
var time = allTime[i].Time;
|
|
series累计流量.Points.Add(new SeriesPoint(time, new double[] { sumFlow }));
|
series累计电量.Points.Add(new SeriesPoint(time, new double[] { sumPower }));
|
series累计电费.Points.Add(new SeriesPoint(time, new double[] { sumMoney }));
|
series用水量.Points.Add(new SeriesPoint(time, new double[] { allTime[i].ReservoirDropFlowTotal }));
|
|
sumFlow += allTime[i].SumFlow;
|
sumPower += allTime[i].SumPower;
|
sumMoney += allTime[i].SumMoney;
|
}
|
|
|
var diagram =
|
chartControl累计数据.Diagram as DevExpress.XtraCharts.XYDiagram;
|
var axis = diagram.AxisX;
|
axis.VisualRange.Auto = false;
|
axis.WholeRange.Auto = false;
|
axis.WholeRange.SideMarginsValue = 0;
|
axis.VisualRange.SideMarginsValue = 0;
|
axis.WholeRange.SetMinMaxValues(_current_anaPrj.StartTime, _current_anaPrj.EndTime);
|
axis.VisualRange.SetMinMaxValues(_current_anaPrj.StartTime, _current_anaPrj.EndTime);
|
axis.WholeRange.AlwaysShowZeroLevel = false;
|
|
|
this.textEdit总供水量.Text = anaPrj.SumFlow4Disp.ToString();
|
this.textEdit总用电量.Text = anaPrj.SumPower4Disp.ToString();
|
this.textEdit千吨水能耗.Text = anaPrj.QDSLN.ToString();
|
this.textEdit总电费.Text = anaPrj.SumMoney.ToString();
|
}
|
private void tabbedControlGroup2_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs e)
|
{
|
if (chartControl实时数据.Legend.Visibility == DevExpress.Utils.DefaultBoolean.True)
|
{
|
chartControl实时数据.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
|
chartControl累计数据.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
|
}
|
else
|
{
|
chartControl实时数据.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;
|
chartControl累计数据.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;
|
}
|
}
|
#endregion
|
|
|
#region 实时数据
|
double max_flow = 0;
|
double max_power = 0;
|
double min_sw = double.MaxValue, max_sw = 0;
|
private void InitialChart实时数据(IStation.CalcModel.AnaPrj anaPrj)
|
{
|
IStation.CalcModel.AnaPrjPointTime max_level = null;
|
IStation.CalcModel.AnaPrjPointTime min_level = null;
|
var allTime = anaPrj.GetAllPointTimeList();
|
for (int i = 0; i < allTime.Count; i++)
|
{
|
var sd = allTime[i];
|
if (max_level == null || max_level.WaterLevelH < sd.WaterLevelH)
|
{
|
max_level = sd;
|
}
|
if (min_level == null || min_level.WaterLevelH > sd.WaterLevelH)
|
{
|
min_level = sd;
|
}
|
}
|
|
DevExpress.XtraCharts.TextAnnotation textAnnotationMax = this.chartControl实时数据.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPointMax = textAnnotationMax.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
|
DevExpress.XtraCharts.TextAnnotation textAnnotationMin = this.chartControl实时数据.AnnotationRepository[1] as DevExpress.XtraCharts.TextAnnotation;
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPointMin = textAnnotationMin.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint;
|
|
paneAnchorPointMax.AxisXCoordinate.AxisValueSerializable = max_level.Time.ToString();
|
paneAnchorPointMax.AxisYCoordinate.AxisValueSerializable = max_level.WaterLevelH.ToString();
|
textAnnotationMax.Text = string.Format("max:{0}", Math.Round(max_level.WaterLevelH, 2));
|
|
paneAnchorPointMin.AxisXCoordinate.AxisValueSerializable = min_level.Time.ToString();
|
paneAnchorPointMin.AxisYCoordinate.AxisValueSerializable = min_level.WaterLevelH.ToString();
|
textAnnotationMin.Text = string.Format("min:{0}", Math.Round(min_level.WaterLevelH, 2));
|
|
|
DevExpress.XtraCharts.Series series长江水位 = this.chartControl实时数据.Series[0];
|
DevExpress.XtraCharts.Series series前池水位 = this.chartControl实时数据.Series[1];
|
DevExpress.XtraCharts.Series series水库水位 = this.chartControl实时数据.Series[2];
|
|
DevExpress.XtraCharts.Series series流量 = this.chartControl实时数据.Series[3];
|
DevExpress.XtraCharts.Series series功率 = this.chartControl实时数据.Series[4];
|
|
|
(series长江水位.View).Color = IStation.Settings.DispSetting.ChartColor长江水位;
|
(series前池水位.View).Color = IStation.Settings.DispSetting.ChartColor前池水位;
|
(series水库水位.View).Color = IStation.Settings.DispSetting.ChartColor水库水位;
|
(series流量.View).Color = IStation.Settings.DispSetting.ChartColor瞬时流量;
|
(series功率.View).Color = IStation.Settings.DispSetting.ChartColor瞬时功率;
|
|
series流量.Points.Clear();
|
series功率.Points.Clear();
|
|
series长江水位.Points.Clear();
|
series前池水位.Points.Clear();
|
series水库水位.Points.Clear();
|
|
max_flow = 0;
|
max_power = 0;
|
min_sw = double.MaxValue; max_sw = 0;
|
|
|
|
|
|
BuildRealTimeDataList(_current_anaPrj.GetAllPointTimeList());
|
|
|
|
SetChartCoord实时数据(0, max_flow, min_sw, max_sw, 0, max_power);
|
|
|
}
|
|
private void BuildRealTimeDataList(List<AnaPrjPointTime> realTimeDataList)
|
{
|
DevExpress.XtraCharts.Series series长江水位 = this.chartControl实时数据.Series[0];
|
DevExpress.XtraCharts.Series series前池水位 = this.chartControl实时数据.Series[1];
|
DevExpress.XtraCharts.Series series水库水位 = this.chartControl实时数据.Series[2];
|
|
DevExpress.XtraCharts.Series series流量 = this.chartControl实时数据.Series[3];
|
DevExpress.XtraCharts.Series series功率 = this.chartControl实时数据.Series[4];
|
for (int i = 0; i < realTimeDataList.Count; i++)
|
{
|
var time = realTimeDataList[i].Time;
|
series长江水位.Points.Add(new SeriesPoint(time, new double[] {
|
Math.Round( realTimeDataList[i].WaterLevelC, 2) }));
|
series流量.Points.Add(new SeriesPoint(time, new double[] {
|
100 * ((int)( realTimeDataList[i].RealFlow/100 )) }));
|
series功率.Points.Add(new SeriesPoint(time, new double[] {
|
10 * ((int)( realTimeDataList[i].RealPower / 10)) }));
|
series前池水位.Points.Add(new SeriesPoint(time, new double[] {
|
Math.Round(realTimeDataList[i].WaterLevelQ, 2) }));
|
|
series水库水位.Points.Add(new SeriesPoint(time, new double[] {
|
Math.Round(realTimeDataList[i].WaterLevelH, 4) }));
|
|
//if (_realTimeDataList[i].WaterLevelQ < 0)
|
// isHaveNavigetLevel = true;
|
|
min_sw = Math.Min(min_sw, realTimeDataList[i].WaterLevelQ);
|
max_sw = Math.Max(max_sw, realTimeDataList[i].WaterLevelQ);
|
|
min_sw = Math.Min(min_sw, realTimeDataList[i].WaterLevelC);
|
max_sw = Math.Max(max_sw, realTimeDataList[i].WaterLevelC);
|
|
min_sw = Math.Min(min_sw, realTimeDataList[i].WaterLevelH);
|
max_sw = Math.Max(max_sw, realTimeDataList[i].WaterLevelH);
|
|
if (realTimeDataList[i].RealFlow > 1000)
|
{
|
// min_power = Math.Min(min_power, realTimeDataList[i].RealPower);
|
max_power = Math.Max(max_power, realTimeDataList[i].RealPower);
|
|
// min_flow = Math.Min(min_flow, realTimeDataList[i].RealFlow);
|
max_flow = Math.Max(max_flow, realTimeDataList[i].RealFlow);
|
}
|
}
|
}
|
|
double rang_up_firstAxis = 0;
|
double rang_down_firstAxis = 0;
|
double rang_min_firstAxis = 0;
|
private void SetChartCoord实时数据(
|
double min_flow, double max_flow,
|
double min_sw, double max_sw,
|
double min_power, double max_power)
|
{
|
if (this.mainDiagram == null)
|
return;
|
|
var axis_time = this.mainDiagram.AxisX;
|
axis_time.VisualRange.Auto = false;
|
axis_time.WholeRange.Auto = false;
|
axis_time.WholeRange.SideMarginsValue = 0;
|
axis_time.VisualRange.SideMarginsValue = 0;
|
axis_time.WholeRange.SetMinMaxValues(_current_anaPrj.StartTime, _current_anaPrj.EndTime);
|
axis_time.VisualRange.SetMinMaxValues(_current_anaPrj.StartTime, _current_anaPrj.EndTime);
|
axis_time.WholeRange.AlwaysShowZeroLevel = false;
|
|
|
|
|
double coord_space_flow = max_flow / 6;
|
coord_space_flow = Math.Max(5000, 5000 * (int)(coord_space_flow / 5000));
|
double coord_min_flow = -coord_space_flow;
|
var coord_flows = new List<CustomAxisLabel>();
|
double disp_flow = coord_min_flow;
|
for (int i = 0; i < 20; i++)
|
{
|
if (disp_flow < 0)
|
{
|
coord_flows.Add(new CustomAxisLabel("", disp_flow));
|
}
|
else
|
{
|
coord_flows.Add(new CustomAxisLabel((disp_flow / 10000).ToString(), disp_flow));
|
}
|
|
|
if (disp_flow > max_flow + coord_space_flow)
|
break;
|
|
disp_flow = disp_flow + coord_space_flow;
|
}
|
|
|
|
double coord_max_power = 500 * ((int)(max_power / 500));
|
double coord_space_power = coord_max_power / 6;
|
coord_space_power = Math.Max(1000, 1000 * (int)(coord_space_power / 1000));
|
double coord_min_power = -coord_space_power;
|
List<CustomAxisLabel> coord_powers = new List<CustomAxisLabel>();
|
double disp_power = coord_min_power;
|
for (int i = 0; i < 20; i++)
|
{
|
if (disp_power < 0)
|
{
|
coord_powers.Add(new CustomAxisLabel("", disp_power));
|
}
|
else
|
{
|
coord_powers.Add(new CustomAxisLabel(disp_power.ToString(), disp_power));
|
}
|
|
|
if (disp_power > coord_max_power + coord_space_power)
|
break;
|
|
disp_power = disp_power + coord_space_power;
|
}
|
|
|
|
if (coord_powers.Count < coord_flows.Count)
|
{
|
for (int i = 0; i < 20; i++)
|
{
|
disp_power = disp_power + coord_space_power;
|
coord_powers.Add(new CustomAxisLabel(disp_power.ToString(), disp_power));
|
if (coord_powers.Count == coord_flows.Count)
|
break;
|
|
}
|
}
|
if (coord_powers.Count > coord_flows.Count)
|
{
|
for (int i = 0; i < 20; i++)
|
{
|
disp_flow = disp_flow + coord_space_flow;
|
coord_flows.Add(new CustomAxisLabel((disp_flow / 10000).ToString(), disp_flow));
|
if (coord_powers.Count == coord_flows.Count)
|
break;
|
|
}
|
}
|
|
int start_level = 0;
|
if (min_sw < 0)
|
{
|
start_level = (int)min_sw - 1;
|
}
|
|
List<CustomAxisLabel> coord_sw = new List<CustomAxisLabel>();
|
for (int i = start_level; i < 20; i++)
|
{
|
var h = i * 1;
|
coord_sw.Add(new CustomAxisLabel(h.ToString(), h));
|
if (h > max_sw + 3)
|
break;
|
}
|
|
rang_up_firstAxis = Convert.ToDouble(
|
coord_sw[coord_sw.Count - 1].AxisValue);
|
rang_down_firstAxis = Convert.ToDouble(
|
coord_sw[coord_sw.Count - 2].AxisValue);
|
rang_down_firstAxis = rang_up_firstAxis + (rang_up_firstAxis - rang_down_firstAxis) / 3;
|
rang_min_firstAxis = Convert.ToDouble(coord_sw[0].AxisValue);
|
|
|
|
|
var axis_sw = mainDiagram.AxisY;
|
axis_sw.CustomLabels.Clear();
|
axis_sw.CustomLabels.AddRange(coord_sw.ToArray());
|
axis_sw.VisualRange.Auto = false;
|
axis_sw.WholeRange.Auto = false;
|
axis_sw.WholeRange.SideMarginsValue = 0;
|
axis_sw.VisualRange.SideMarginsValue = 0;
|
axis_sw.WholeRange.AutoSideMargins = false;
|
axis_sw.VisualRange.AutoSideMargins = false;
|
axis_sw.WholeRange.SetMinMaxValues(coord_sw.FirstOrDefault().AxisValue, coord_sw.Last().AxisValue);
|
axis_sw.VisualRange.SetMinMaxValues(coord_sw.FirstOrDefault().AxisValue, coord_sw.Last().AxisValue);
|
axis_sw.WholeRange.AlwaysShowZeroLevel = false;
|
|
|
|
var axis_flow = this.mainDiagram.SecondaryAxesY.GetAxisByName("SecondaryLL");
|
axis_flow.CustomLabels.Clear();
|
axis_flow.CustomLabels.AddRange(coord_flows.ToArray());
|
axis_flow.NumericScaleOptions.AutoGrid = false;
|
axis_flow.VisualRange.Auto = false;
|
axis_flow.WholeRange.Auto = false;
|
axis_flow.WholeRange.SideMarginsValue = 0;
|
axis_flow.VisualRange.SideMarginsValue = 0;
|
axis_flow.WholeRange.AutoSideMargins = false;
|
axis_flow.VisualRange.AutoSideMargins = false;
|
axis_flow.WholeRange.SetMinMaxValues(coord_min_flow, coord_min_flow + (coord_flows.Count - 1) * coord_space_flow);
|
axis_flow.VisualRange.SetMinMaxValues(coord_min_flow, coord_min_flow + (coord_flows.Count - 1) * coord_space_flow);
|
axis_flow.WholeRange.AlwaysShowZeroLevel = false;
|
axis_flow.Color = IStation.Settings.DispSetting.ChartColor瞬时流量;
|
axis_flow.Title.TextColor = IStation.Settings.DispSetting.ChartColor瞬时流量;
|
axis_flow.Label.TextColor = IStation.Settings.DispSetting.ChartColor瞬时流量;
|
|
|
|
|
var axis_power = mainDiagram.SecondaryAxesY.GetAxisByName("SecondaryGL");
|
axis_power.CustomLabels.Clear();
|
axis_power.CustomLabels.AddRange(coord_powers.ToArray());
|
|
axis_power.NumericScaleOptions.AutoGrid = false;
|
axis_power.VisualRange.Auto = false;
|
axis_power.WholeRange.Auto = false;
|
axis_power.WholeRange.SideMarginsValue = 0;
|
axis_power.VisualRange.SideMarginsValue = 0;
|
axis_power.WholeRange.AutoSideMargins = false;
|
axis_power.VisualRange.AutoSideMargins = false;
|
axis_power.WholeRange.SetMinMaxValues(coord_min_power, coord_min_power + (coord_powers.Count - 1) * coord_space_power);
|
axis_power.VisualRange.SetMinMaxValues(coord_min_power, coord_min_power + (coord_powers.Count - 1) * coord_space_power);
|
axis_power.WholeRange.AlwaysShowZeroLevel = false;
|
axis_power.Color = IStation.Settings.DispSetting.ChartColor瞬时功率;
|
axis_power.Title.TextColor = IStation.Settings.DispSetting.ChartColor瞬时功率;
|
axis_power.Label.TextColor = IStation.Settings.DispSetting.ChartColor瞬时功率;
|
}
|
private void ChartControl实时数据_MouseClick(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
{
|
contextMenuChart.Show(chartControl实时数据, e.Location);
|
}
|
}
|
private void ChartControl实时数据_CustomPaint(object sender, CustomPaintEventArgs e)
|
{
|
if (_current_anaPrj == null || mainDiagram == null) return;
|
Graphics g = e.Graphics;
|
//g.SetClip(CalculateDiagramBounds());
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
using (Font font水位 = new Font("Tahoma", 9, FontStyle.Regular))
|
using (Font font时间 = new Font("Tahoma", 12, FontStyle.Regular))
|
using (Font font台数 = new Font("黑体", 9, FontStyle.Italic))
|
using (SolidBrush brushText时间 = new SolidBrush(Color.Black))
|
{
|
|
foreach (var item in this._current_anaPrj.BlockTimes)
|
{
|
if (item.OpenPumpCount <= 0) continue;
|
|
var pump_count = item.OpenPumpCount;
|
Color textColor = Color.Black;
|
if (item.OpenPumpCount == 4)
|
textColor = Color.White;
|
List<string> list_draws = new List<string>();
|
list_draws.Add("00:00");
|
|
using (SolidBrush brushText台数 = new SolidBrush(textColor))
|
using (SolidBrush brush背景 = new SolidBrush(
|
PumpCountColorHelper.GetColor(pump_count)))
|
{
|
var pt1 = mainDiagram.DiagramToPoint(item.StartTime, rang_up_firstAxis);
|
var pt2 = mainDiagram.DiagramToPoint(item.EndTime, rang_up_firstAxis);
|
var height = 25;// Math.Max(15, Math.Abs(pt1.Point.Y - pt2.Point.Y));
|
|
g.FillRectangle(brush背景, pt1.Point.X, pt1.Point.Y - height,
|
Math.Abs(pt1.Point.X - pt2.Point.X), height);
|
g.DrawString(string.Format("{0}台", pump_count), font台数, brushText台数,
|
new Point(pt1.Point.X, pt1.Point.Y - 16));
|
var sss_start = item.StartTime.ToString("HH:mm");
|
if (!list_draws.Contains(sss_start))
|
{
|
list_draws.Add(sss_start);
|
g.DrawString(sss_start, font时间, brushText时间, new Point(pt1.Point.X - 20, pt1.Point.Y - height - 19));
|
|
var pt = _current_anaPrj.FindPointTime(item.StartTime);
|
if (pt != null)
|
{
|
g.DrawString(string.Format("{0}m", Math.Round(pt.WaterLevelH, 2) ), font水位, brushText时间, new Point(pt1.Point.X - 20, pt1.Point.Y + 5));
|
}
|
else
|
{
|
|
}
|
}
|
var sss_end = item.EndTime.ToString("HH:mm");
|
if (!list_draws.Contains(sss_end))
|
{
|
list_draws.Add(sss_end);
|
g.DrawString(sss_end, font时间, brushText时间, new Point(pt2.Point.X - 20, pt1.Point.Y - height - 19));
|
|
var pt = _current_anaPrj.FindPointTime(item.EndTime);
|
if (pt != null)
|
{
|
g.DrawString(string.Format("{0}m", Math.Round(pt.WaterLevelH, 2)), font水位, brushText时间, new Point(pt2.Point.X - 20, pt2.Point.Y + 5));
|
}
|
else
|
{
|
|
}
|
}
|
}
|
}
|
}
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
private void MenuItem显示曲线提示_Click(object sender, EventArgs e)
|
{
|
MenuItem显示曲线提示.Checked = !MenuItem显示曲线提示.Checked;
|
chartControl实时数据.Legend.Visibility =
|
MenuItem显示曲线提示.Checked ?
|
DevExpress.Utils.DefaultBoolean.True :
|
DevExpress.Utils.DefaultBoolean.False;
|
}
|
|
private void xtraTabControl1_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs e)
|
{
|
if (tabPage实时数据.PageVisible == false)
|
{
|
tabPage实时数据.PageVisible = true;
|
pointTimeListDispCtrl1.SetBindingData(_current_anaPrj);
|
}
|
}
|
|
public void ExportSpanGrid()
|
{
|
this.blockTimeListDispCtrl1.ExportSpanGrid();
|
}
|
|
internal void ClearContent()
|
{
|
textEdit总供水量.Text = "";
|
textEdit总电费.Text = "";
|
textEdit总用电量.Text = "";
|
textEdit千吨水能耗.Text = "";
|
_current_anaPrj = null;
|
this.Invalidate();
|
|
DevExpress.XtraCharts.Series series长江水位 = this.chartControl实时数据.Series[0];
|
DevExpress.XtraCharts.Series series前池水位 = this.chartControl实时数据.Series[1];
|
DevExpress.XtraCharts.Series series水库水位 = this.chartControl实时数据.Series[2];
|
|
DevExpress.XtraCharts.Series series流量 = this.chartControl实时数据.Series[3];
|
DevExpress.XtraCharts.Series series功率 = this.chartControl实时数据.Series[4];
|
|
series长江水位.Points.Clear();
|
series前池水位.Points.Clear();
|
series水库水位.Points.Clear();
|
series流量.Points.Clear();
|
series功率.Points.Clear();
|
|
}
|
}
|
}
|