using DevExpress.Utils;
|
using DevExpress.XtraCharts;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Globalization;
|
using System.Linq;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace IStation.WinFrmUI.Curve
|
{
|
public partial class ChartMultiCurveCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
private List<IStation.ViewModel.SingleCurvePointListGroupExDisp> _curvesGroups = new List<IStation.ViewModel.SingleCurvePointListGroupExDisp>();
|
//private Unit.eUnitQ _unitQ = Unit.eUnitQ.M3H;
|
private Unit.eUnitH _unitH = Unit.eUnitH.M;
|
public int CurveGrpCount
|
{
|
get
|
{
|
return _curvesGroups.Count();
|
}
|
}
|
|
#region 设置显示
|
//是否显示曲线名称
|
private bool isDispCurveName = false;
|
public bool IsDispCurveName
|
{
|
get { return isDispCurveName; }
|
set
|
{
|
isDispCurveName = value;
|
|
for (int i = 1; i < this.chartControl1.AnnotationRepository.Count; i++)
|
{
|
this.chartControl1.AnnotationRepository[i].Visible = value;
|
}
|
}
|
}
|
|
//是否显示曲线Legend
|
private bool _isDispLegend = false;
|
public bool IsDispLegend
|
{
|
get { return _isDispLegend; }
|
set
|
{
|
_isDispLegend = value;
|
this.chartControl1.Legend.Visibility = value == true ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
}
|
|
//显示流量参考线
|
private bool _isDispRefConstantLineQ = false;
|
public void SetRefConstantLineQ(double refQ)
|
{
|
_isDispRefConstantLineQ = true;
|
if (refConstantLineQ != null)
|
{
|
refConstantLineQ.Visible = true;
|
var anno = this.chartControl1.AnnotationRepository[1] as DevExpress.XtraCharts.TextAnnotation;
|
anno.Visible = true;
|
//(annoText.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint).AxisXCoordinate.AxisValueSerializable =
|
// refQ.ToString();
|
_isQueryByQ = true;
|
SetRefConstantQ(refQ);
|
}
|
}
|
|
//显示扬程参考线
|
private bool _isDispRefConstantLineH = false;
|
public void SetRefConstantLineH(double refH)
|
{
|
_isDispRefConstantLineH = true;
|
if (refConstantLineH != null)
|
{
|
refConstantLineH.Visible = true;
|
var anno = this.chartControl1.AnnotationRepository[1] as DevExpress.XtraCharts.TextAnnotation;
|
anno.Visible = true;
|
//(annoText.AnchorPoint as DevExpress.XtraCharts.PaneAnchorPoint).AxisYCoordinate.AxisValueSerializable =
|
// refH.ToString();
|
_isQueryByQ = false;
|
SetRefConstantH(refH);
|
}
|
}
|
|
private bool isDispCurveQE = true;
|
private bool isDispCurveQP = true;
|
public void SetCurveTypeDisp(Model.eFeatCurveType curveType, bool isDisp, bool isSetLegend = false)
|
{
|
if (curveType == Model.eFeatCurveType.QH)
|
{
|
int iSeriesCount = this.chartControl1.SeriesSerializable.Count();
|
for (int i = iSeriesCount - 1; i > 2; i--)
|
{
|
var s = this.chartControl1.Series[i];
|
if (s.Name.Contains("SeriesQH"))
|
{
|
s.Visible = isDisp;
|
}
|
}
|
QHAxisY.Visibility = isDisp ? DefaultBoolean.True : DefaultBoolean.False;
|
|
//if (_isDispLegend)
|
//{
|
// this.chartControl1.Legend.;
|
//}
|
}
|
else if (curveType == Model.eFeatCurveType.QE)
|
{
|
int iSeriesCount = this.chartControl1.SeriesSerializable.Count();
|
for (int i = iSeriesCount - 1; i > 2; i--)
|
{
|
var s = this.chartControl1.Series[i];
|
if (s.Name.Contains("SeriesQE"))
|
{
|
s.Visible = isDisp;
|
}
|
}
|
QEAxisY.Visibility = isDisp ? DefaultBoolean.True : DefaultBoolean.False;
|
isDispCurveQE = isDisp;
|
if (_coordinateParas != null)
|
_coordinateParas.DispPanelQE = isDisp ? 0 : -1;
|
|
}
|
else if (curveType == Model.eFeatCurveType.QP)
|
{
|
int iSeriesCount = this.chartControl1.SeriesSerializable.Count();
|
for (int i = iSeriesCount - 1; i > 2; i--)
|
{
|
var s = this.chartControl1.Series[i];
|
if (s.Name.Contains("SeriesQP"))
|
{
|
s.Visible = isDisp;
|
}
|
}
|
QPAxisY.Visibility = isDisp ? DefaultBoolean.True : DefaultBoolean.False;
|
isDispCurveQP = isDisp;
|
if (_coordinateParas != null)
|
_coordinateParas.DispPanelQP = isDisp ? 0 : -1;
|
|
}
|
}
|
#endregion
|
|
#region 曲线颜色
|
//修改曲线颜色的委托
|
//public delegate void ChangeCurveColorEventHandler(int id, Color newColor);
|
//public event ChangeCurveColorEventHandler OnChangeCurveColor = null;
|
|
private static List<Color> ColorArray = new List<Color>() { Color.Red,
|
Color.Blue, Color.Green, Color.Brown,Color.DodgerBlue,Color.Fuchsia,Color.MidnightBlue,Color.Maroon,
|
Color.Aquamarine, Color.Bisque ,Color.SeaGreen,Color.SeaGreen};
|
|
public static Color GetRandomColor(int index)
|
{
|
return index < ColorArray.Count ? ColorArray[index] : GetRandomColor();
|
}
|
public static Color GetRandomColorIngnore(List<Color> IngnoreColorArray)
|
{
|
foreach (var color in ColorArray)
|
{
|
if (!IngnoreColorArray.Contains(color))
|
return color;
|
}
|
return Color.Blue;
|
}
|
public static Color GetRandomColor()
|
{
|
Random RandomNum_First = new Random((int)DateTime.Now.Ticks);
|
int int_Red = RandomNum_First.Next(256);
|
Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks);
|
int int_Green = RandomNum_Sencond.Next(256);
|
int int_Blue = RandomNum_Sencond.Next(256);
|
return Color.FromArgb(int_Red, int_Green, int_Blue);
|
}
|
public bool SetCurveColor(string CurveID)
|
{
|
var curve = (from c in _curvesGroups where c.CurveID == CurveID select c).FirstOrDefault();
|
if (curve == null)
|
return false;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
colorDialog1.Color = curve.CurveColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
curve.CurveColor = colorDialog1.Color;
|
UpdateAllCurve(false);
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
public Color GetCurveColor(Guid ID)
|
{
|
return Color.Blue;
|
//var curve = (from c in curvesGroups where c.ID == ID select c).FirstOrDefault();
|
//if (curve == null)
|
// return Color.White;
|
//else
|
// return curve.CurveColor;
|
}
|
#endregion
|
|
#region CHART变量
|
//
|
private DevExpress.XtraCharts.XYDiagram mainChartDiagram = null;
|
|
|
//
|
AxisX AxisQ = null;
|
AxisY QHAxisY = null;
|
SecondaryAxisY QEAxisY = null;
|
SecondaryAxisY QPAxisY = null;
|
|
double maxQ = 0, minQ = 1000;
|
double maxH = 0, minH = 1000;
|
double maxE = 100, minE = 0;
|
double maxP = 0, minP = 1000;
|
|
|
|
DevExpress.XtraCharts.ConstantLine refConstantLineQ = null;
|
DevExpress.XtraCharts.ConstantLine refConstantLineH = null;
|
#endregion
|
|
#region 构造函数和加载函数
|
public ChartMultiCurveCtrl()
|
{
|
InitializeComponent();
|
|
_unitH = Unit.eUnitH.M;
|
|
InitialChart();
|
}
|
|
private void LoadWindow(object sender, EventArgs e)
|
{
|
SetChartDisplay();
|
|
this.chartControl1.Legend.Visibility = _isDispLegend ? DefaultBoolean.True : DefaultBoolean.False;
|
//Common.XtraChartHelper.SetAxisName(QHAxisY, "扬程", unitH);
|
}
|
|
private void InitialChart()
|
{
|
mainChartDiagram = (XYDiagram)chartControl1.Diagram;
|
|
refConstantLineQ = mainChartDiagram.AxisX.ConstantLines[0];
|
refConstantLineQ.Visible = false;
|
|
refConstantLineH = mainChartDiagram.AxisY.ConstantLines[0];
|
refConstantLineH.Visible = false;
|
|
//
|
AxisQ = mainChartDiagram.AxisX;
|
QHAxisY = mainChartDiagram.AxisY;
|
AxisQ.Visibility = DefaultBoolean.False;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
|
|
|
QEAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QEAxisY");
|
QPAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QPAxisY");
|
|
QEAxisY.Visibility = DefaultBoolean.False;
|
QPAxisY.Visibility = DefaultBoolean.False;
|
|
//this.chartControl1.RuntimeSelection = true;//设置此属性 表示可以选择CHART上物体
|
|
if (this.chartControl1.AnnotationRepository != null && this.chartControl1.AnnotationRepository.Count > 0)
|
{
|
var anno = this.chartControl1.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
anno.Text = "";
|
}
|
|
//anno.Visible = false;
|
//anno = this.chartControl1.AnnotationRepository[1] as DevExpress.XtraCharts.TextAnnotation;
|
//anno.Visible = false;
|
|
//添加重绘
|
this.chartControl1.CustomPaint += new DevExpress.XtraCharts.CustomPaintEventHandler(this.chartControl_CustomPaint);
|
this.chartControl1.LegendItemChecked += new DevExpress.XtraCharts.LegendItemCheckedEventHandler(this.chartControl1_LegendItemChecked);
|
this.chartControl1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseClick);
|
this.chartControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseMove);
|
this.chartControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseUp);
|
this.chartControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chartControl1_MouseDown);
|
this.chartControl1.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.chartControl1_ObjectHotTracked);
|
}
|
#endregion
|
|
#region 设置曲线
|
|
private bool _isOnlyCurveQH = true;
|
|
//添加曲线
|
public bool AddCurveGroup(string CurveID,
|
string CurveName,
|
Color CurveColor,
|
IStation.Model.FeatCurveExpressGroup pointInfo,
|
DevExpress.XtraCharts.DashStyle dash = DevExpress.XtraCharts.DashStyle.Dash,
|
DevExpress.XtraCharts.MarkerKind markerKind = MarkerKind.Square)
|
{
|
foreach (var cur in _curvesGroups)
|
{
|
if (cur.CurveID == CurveID)
|
return false;
|
}
|
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = new IStation.ViewModel.SingleCurvePointListGroupExDisp();
|
info.CurveID = CurveID;
|
info.CurveName = CurveName;
|
info.CurveColor = CurveColor;
|
info.PointQH = Model.FitCurveHelper.GetFitPoints(pointInfo.CurveQH, 16);
|
info.PointQE = Model.FitCurveHelper.GetFitPoints(pointInfo.CurveQE, 16);
|
info.PointQP = Model.FitCurveHelper.GetFitPoints(pointInfo.CurveQP, 16);
|
info.IsCurve = true;
|
info.DashStyle = dash;
|
info.MarkerKind = markerKind;
|
|
if (info.PointQE != null || info.PointQP != null)
|
_isOnlyCurveQH = false;
|
|
_curvesGroups.Add(info);
|
|
return true;
|
}
|
|
|
public int GetGroupCount()
|
{
|
if (_curvesGroups == null || _curvesGroups.Count < 1)
|
return 0;
|
return _curvesGroups.Count;
|
}
|
|
|
public bool AddCurveGroup(
|
string CurveID, string CurveName, Color CurveColor,
|
List<Model.CurvePoint> connect_pointsQH,
|
List<Model.CurvePoint> connect_pointsQE,
|
List<Model.CurvePoint> connect_pointsQP,
|
DevExpress.XtraCharts.DashStyle dash,
|
DevExpress.XtraCharts.MarkerKind markerKind)
|
{
|
foreach (var cur in _curvesGroups)
|
{
|
if (cur.CurveID == CurveID)
|
return false;
|
}
|
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = new IStation.ViewModel.SingleCurvePointListGroupExDisp();
|
info.CurveID = CurveID;
|
info.CurveName = CurveName;
|
info.CurveColor = CurveColor;
|
info.PointQH = Model.FitCurveHelper.GetFitPoints(connect_pointsQH, 16);
|
info.PointQE = Model.FitCurveHelper.GetFitPoints(connect_pointsQE, 16);
|
info.PointQP = Model.FitCurveHelper.GetFitPoints(connect_pointsQP, 16);
|
info.IsCurve = true;
|
info.MarkerKind = markerKind;
|
info.DashStyle = dash;
|
|
if (info.PointQE != null || info.PointQP != null)
|
{
|
_isOnlyCurveQH = false;
|
}
|
else
|
{
|
_isDispGridLineH = true;
|
}
|
|
_curvesGroups.Add(info);
|
|
return true;
|
}
|
|
public bool AddCurveGroup(
|
string CurveID, string CurveName, Color CurveColor,
|
Model.CurveExpress connect_pointsQH,
|
Model.CurveExpress connect_pointsQE,
|
Model.CurveExpress connect_pointsQP,
|
DevExpress.XtraCharts.DashStyle dash,
|
DevExpress.XtraCharts.MarkerKind markerKind)
|
|
{
|
foreach (var cur in _curvesGroups)
|
{
|
if (cur.CurveID == CurveID)
|
return false;
|
}
|
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = new IStation.ViewModel.SingleCurvePointListGroupExDisp();
|
info.CurveID = CurveID;
|
info.CurveName = CurveName;
|
info.CurveColor = CurveColor;
|
info.PointQH = Model.FitCurveHelper.GetFitPoints(connect_pointsQH, 16);
|
info.PointQE = Model.FitCurveHelper.GetFitPoints(connect_pointsQE, 16);
|
info.PointQP = Model.FitCurveHelper.GetFitPoints(connect_pointsQP, 16);
|
info.IsCurve = true;
|
info.DashStyle = dash;
|
info.MarkerKind = markerKind;
|
|
if (info.PointQE != null || info.PointQP != null)
|
{
|
_isOnlyCurveQH = false;
|
}
|
else
|
{
|
_isDispGridLineH = true;
|
}
|
|
_curvesGroups.Add(info);
|
|
return true;
|
}
|
|
public bool AddCurveGroup(
|
string CurveID, string CurveName, Color CurveColor,
|
List<Model.CurvePoint> connect_pointsQH
|
, DevExpress.XtraCharts.DashStyle dash,
|
DevExpress.XtraCharts.MarkerKind markerKind)
|
{
|
foreach (var cur in _curvesGroups)
|
{
|
if (cur.CurveID == CurveID)
|
return false;
|
}
|
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = new IStation.ViewModel.SingleCurvePointListGroupExDisp();
|
info.CurveID = CurveID;
|
info.CurveName = CurveName;
|
info.CurveColor = CurveColor;
|
info.PointQH = Model.FitCurveHelper.GetFitPoints(connect_pointsQH, 16);
|
info.PointQE = null;
|
info.PointQP = null;
|
info.IsCurve = true;
|
info.MarkerKind = markerKind;
|
info.DashStyle = dash;
|
if (info.PointQE != null || info.PointQP != null)
|
{
|
_isOnlyCurveQH = false;
|
}
|
else
|
{
|
_isDispGridLineH = true;
|
}
|
|
_curvesGroups.Add(info);
|
|
return true;
|
}
|
|
public bool AddPointQH(
|
string CurveID, string CurveName, Color CurveColor,
|
List<Model.CurvePoint> pointsQH)
|
{
|
foreach (var cur in _curvesGroups)
|
{
|
if (cur.CurveID == CurveID)
|
return false;
|
}
|
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = new IStation.ViewModel.SingleCurvePointListGroupExDisp();
|
info.CurveID = CurveID;
|
info.CurveName = CurveName;
|
info.CurveColor = CurveColor;
|
info.PointQH = new Model.CurvePointList(pointsQH);
|
info.PointQE = null;
|
info.PointQP = null;
|
info.IsCurve = false;
|
|
if (info.PointQE != null || info.PointQP != null)
|
{
|
_isOnlyCurveQH = false;
|
}
|
else
|
{
|
_isDispGridLineH = true;
|
}
|
|
|
_curvesGroups.Add(info);
|
|
return true;
|
}
|
|
public void SetCurveColorByCurveID(string CurveID, Color color)
|
{
|
if (this._curvesGroups != null)
|
{
|
foreach (var c in _curvesGroups)
|
{
|
if (c.CurveID == CurveID)
|
{
|
c.CurveColor = color;
|
}
|
}
|
}
|
|
|
UpdateAllCurve();
|
}
|
|
public void SetCurveNameByCurveID(string CurveID, string Name)
|
{
|
if (this._curvesGroups != null)
|
{
|
foreach (var c in _curvesGroups)
|
{
|
if (c.CurveID == CurveID)
|
{
|
c.CurveName = Name;
|
}
|
}
|
}
|
|
|
UpdateAllCurve();
|
}
|
|
public void SetCurvePointByCurveID(string CurveID, List<Model.CurvePoint> CurveQH, List<Model.CurvePoint> CurveQE, List<Model.CurvePoint> CurveQP)
|
{
|
if (this._curvesGroups != null)
|
{
|
foreach (var c in _curvesGroups)
|
{
|
if (c.CurveID == CurveID)
|
{
|
c.PointQH = Model.FitCurveHelper.GetFitPoints(CurveQH, 16);
|
c.PointQE = Model.FitCurveHelper.GetFitPoints(CurveQE, 16);
|
c.PointQP = Model.FitCurveHelper.GetFitPoints(CurveQP, 16);
|
}
|
}
|
}
|
|
|
UpdateAllCurve();
|
}
|
|
////删除
|
public void RemoveCurveByCurveID(string CurveID)
|
{
|
if (this._curvesGroups != null)
|
{
|
foreach (var c in _curvesGroups)
|
{
|
if (c.CurveID == CurveID)
|
{
|
_curvesGroups.Remove(c);
|
UpdateAllCurve();
|
return;
|
}
|
}
|
}
|
}
|
|
//替换
|
//public void ReplacePumpCurve(Guid ID, Model.CurveGroupExpress pointInfo)
|
//{
|
// var curve = (from c in curvesGroups where c.CurveID == ID select c).FirstOrDefault();
|
// if (curve != null)
|
// {
|
// curve.PointQH = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQH, 16);
|
// curve.PointQE = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQE, 16);
|
// //修改曲线0点位置的值
|
// if (curve.PointQE.First().Y > 0.5 && curve.PointQE.First().X < 2)
|
// {
|
// curve.PointQE = Model.FitCurveHelper.AmendByZeroPointY(curve.PointQE, curve.PointQE[4].X, 0);
|
// if (curve.PointQE.First().Y > 0.5)
|
// curve.PointQE = Model.FitCurveHelper.AmendByZeroPointY(curve.PointQE, curve.PointQE[4].X, 0);
|
// }
|
|
// curve.PointQP = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQP, 16);
|
// UpdateAllCurve();
|
// }
|
//}
|
//public void ReplacePumpCurve(Guid ID, Model.CurveGroupExpress pointInfo,string strCurveName)
|
//{
|
// var curve = (from c in curvesGroups where c.CurveID == ID select c).FirstOrDefault();
|
// if (curve != null)
|
// {
|
// curve.CurveName = strCurveName;
|
// curve.PointQH = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQH, 16);
|
// curve.PointQE = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQE, 16);
|
// //修改曲线0点位置的值
|
// if (curve.PointQE.First().Y > 0.5 && curve.PointQE.First().X < 2)
|
// {
|
// curve.PointQE = Model.FitCurveHelper.AmendByZeroPointY(curve.PointQE, curve.PointQE[4].X, 0);
|
// if (curve.PointQE.First().Y > 0.5)
|
// curve.PointQE = Model.FitCurveHelper.AmendByZeroPointY(curve.PointQE, curve.PointQE[4].X, 0);
|
// }
|
|
// curve.PointQP = FitCurveHelper.GetFitPoints(pointInfo.CurveExpressQP, 16);
|
// UpdateAllCurve();
|
// }
|
//}
|
//清理曲线
|
public void ClearPumpCurve()
|
{
|
_curvesGroups.Clear();
|
UpdateAllCurve();
|
}
|
#endregion
|
|
#region 坐标
|
private Model.CurveCoordinateParas _coordinateParas = null;//坐标
|
//计算最大最小值
|
private void CalcCoordLimit()
|
{
|
maxQ = 0; minQ = 1000;
|
maxH = 0; minH = 1000;
|
maxE = 0; minE = 0;
|
maxP = 0; minP = 1000;
|
|
foreach (IStation.ViewModel.SingleCurvePointListGroupExDisp info in _curvesGroups)
|
{
|
minQ = Math.Min(minQ, info.PointQH.First().X);
|
maxQ = Math.Max(maxQ, info.PointQH.Last().X);
|
|
minH = Math.Min(minH, (from x in info.PointQH select x.Y).Min());
|
maxH = Math.Max(maxH, (from x in info.PointQH select x.Y).Max());
|
|
if (info.PointQE != null)
|
{
|
//minE = Math.Min(minE, (from x in info.PointQE select x.Y).Min());
|
maxE = Math.Max(maxE, (from x in info.PointQE select x.Y).Max());
|
}
|
if (info.PointQP != null)
|
{
|
minP = Math.Min(minP, (from x in info.PointQP select x.Y).Min());
|
maxP = Math.Max(maxP, (from x in info.PointQP select x.Y).Max());
|
}
|
}
|
|
_coordinateParas = null;
|
}
|
|
//设置坐标值
|
public void CalcCoordinate()
|
{
|
|
CalcCoordLimit();
|
|
_coordinateParas = Model.CurveCoordinateParas.CalcCoordinate(minQ, maxQ, minH, maxH, minE, maxE, minP, maxP);
|
_coordinateParas.DispPanelQE = isDispCurveQE ? 0 : -1;
|
_coordinateParas.DispPanelQP = isDispCurveQP ? 0 : -1;
|
}
|
|
bool _isDispGridLineH = false;
|
//更新图表坐标
|
public bool UpdateCoordinate()
|
{
|
if (_coordinateParas == null)
|
return false;
|
|
#region 流量
|
if (minQ < maxQ)
|
{
|
var nfi = new NumberFormatInfo();
|
nfi.NumberGroupSeparator = " "; // set the group separator to a space
|
nfi.NumberDecimalSeparator = ","; // set decimal separator to comma
|
|
//坐标刻度
|
List<CustomAxisLabel> q_Label_List = new List<CustomAxisLabel>();
|
AxisQ.CustomLabels.Clear();
|
double disQ = _coordinateParas.CoordMinQ;
|
for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
|
{
|
q_Label_List.Add(new CustomAxisLabel(disQ.ToString("N0", nfi), disQ));
|
disQ = disQ + _coordinateParas.CoordSpaceQ;
|
}
|
AxisQ.CustomLabels.AddRange(q_Label_List.ToArray());
|
|
//设置显示
|
if (_isOnlyCurveQH)
|
{
|
//AxisQ.GridLines.Visible = true; nsx
|
XtraChartHelper.SetAxisRange(AxisQ, _coordinateParas.CoordMinQ, _coordinateParas.CoordMinQ + _coordinateParas.GridNumberX * _coordinateParas.CoordSpaceQ);
|
}
|
else
|
{
|
//AxisQ.GridLines.Visible = false; nsx
|
XtraChartHelper.SetAxisRange(AxisQ, _coordinateParas.CoordMinQ, _coordinateParas.CoordMinQ + _coordinateParas.GridNumberX * _coordinateParas.CoordSpaceQ);
|
}
|
|
AxisQ.Visibility = DefaultBoolean.True;
|
}
|
else
|
{
|
AxisQ.Visibility = DefaultBoolean.False;
|
}
|
#endregion
|
|
#region 扬程
|
if (minH < maxH)
|
{
|
//坐标刻度
|
QHAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> h_Label_List = new List<CustomAxisLabel>();
|
double disH = Math.Round(_coordinateParas.CoordMinH + _coordinateParas.CoordSpaceH * _coordinateParas.StartLineNoH, 2);
|
for (int i = _coordinateParas.StartLineNoH; i < _coordinateParas.EndLineNoH + 1; i++)
|
{
|
h_Label_List.Add(new CustomAxisLabel(disH.ToString(), disH));
|
disH = Math.Round(disH + _coordinateParas.CoordSpaceH, 2);
|
}
|
QHAxisY.CustomLabels.AddRange(h_Label_List.ToArray());
|
//设置显示
|
if (_coordinateParas.DispPanelQE != 0 && _coordinateParas.DispPanelQP != 0)
|
{
|
XtraChartHelper.SetAxisRange(QHAxisY,
|
_coordinateParas.CoordMinH + _coordinateParas.StartLineNoH * _coordinateParas.CoordSpaceH,
|
_coordinateParas.CoordMinH + _coordinateParas.EndLineNoH * _coordinateParas.CoordSpaceH);
|
}
|
else
|
{
|
XtraChartHelper.SetAxisRange(QHAxisY, _coordinateParas.CoordMinH,
|
_coordinateParas.CoordMinH + _coordinateParas.GridNumberY * _coordinateParas.CoordSpaceH);
|
}
|
QHAxisY.GridLines.Visible = _isDispGridLineH;
|
QHAxisY.Visibility = DefaultBoolean.True;
|
}
|
else
|
{
|
QHAxisY.GridLines.Visible = _isDispGridLineH;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
}
|
#endregion
|
|
#region 效率
|
if (minE < maxE && _coordinateParas.DispPanelQE == 0)
|
{
|
//坐标刻度
|
QEAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> E_Label_List = new List<CustomAxisLabel>();
|
double disE = _coordinateParas.CoordMinE + _coordinateParas.CoordSpaceE * _coordinateParas.StartLineNoE;
|
for (int i = _coordinateParas.StartLineNoE; i < _coordinateParas.EndLineNoE + 1; i++)
|
{
|
E_Label_List.Add(new CustomAxisLabel(disE.ToString(), disE));
|
disE = disE + _coordinateParas.CoordSpaceE;
|
}
|
QEAxisY.CustomLabels.AddRange(E_Label_List.ToArray());
|
//设置显示
|
XtraChartHelper.SetAxisRange(QEAxisY, _coordinateParas.CoordMinE,
|
_coordinateParas.CoordMinE + _coordinateParas.GridNumberY * _coordinateParas.CoordSpaceE);
|
QEAxisY.GridLines.Visible = true;
|
QEAxisY.Visibility = DefaultBoolean.True;
|
}
|
else
|
{
|
QEAxisY.GridLines.Visible = false;
|
QEAxisY.Visibility = DefaultBoolean.False;
|
}
|
#endregion
|
|
#region 功率
|
if (minP < maxP && _coordinateParas.DispPanelQP == 0)
|
{
|
//坐标刻度
|
QPAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> P_Label_List = new List<CustomAxisLabel>();
|
double disP = _coordinateParas.CoordMinP + _coordinateParas.CoordSpaceP * _coordinateParas.StartLineNoP;
|
for (int i = _coordinateParas.StartLineNoP; i < _coordinateParas.EndLineNoP + 1; i++)
|
{
|
P_Label_List.Add(new CustomAxisLabel(disP.ToString(), disP));
|
disP = disP + _coordinateParas.CoordSpaceP;
|
}
|
QPAxisY.CustomLabels.AddRange(P_Label_List.ToArray());
|
//设置显示
|
XtraChartHelper.SetAxisRange(QPAxisY, _coordinateParas.CoordMinP,
|
_coordinateParas.CoordMinP + _coordinateParas.GridNumberY * _coordinateParas.CoordSpaceP);
|
QPAxisY.GridLines.Visible = true;
|
QPAxisY.Visibility = DefaultBoolean.True;
|
}
|
else
|
{
|
QPAxisY.GridLines.Visible = false;
|
QPAxisY.Visibility = DefaultBoolean.False;
|
}
|
#endregion
|
|
return true;
|
}
|
|
#endregion
|
|
#region 更新图表
|
public void UpdateChart(bool isCalcCoord)
|
{
|
if (_coordinateParas == null || isCalcCoord)
|
CalcCoordinate();
|
|
if (!UpdateCoordinate())
|
return;
|
|
UpdateAllCurve(true);
|
|
|
if (refConstantLineH != null && refConstantLineH.AxisValue != null)
|
{//防止超出
|
double refH = Convert.ToDouble(refConstantLineH.AxisValue);
|
if (refH < minH * 1.01 || refH > maxH * 0.999)
|
refConstantLineH.AxisValue = (maxH + minH) / 2;
|
}
|
|
}
|
|
Hashtable CurveAnnoMap = new Hashtable();
|
|
//更新所有曲线
|
public void UpdateAllCurve(bool isUpateAnnoPosi = true)
|
{
|
int iSeriesCount = this.chartControl1.SeriesSerializable.Count();
|
for (int i = iSeriesCount - 1; i > 2; i--)
|
{
|
this.chartControl1.Series.RemoveAt(i);
|
}
|
if (isUpateAnnoPosi)
|
{
|
for (int i = this.chartControl1.AnnotationRepository.Count - 1; i > 0; i--)
|
{
|
this.chartControl1.AnnotationRepository.RemoveAt(i);
|
}
|
|
CurveAnnoMap.Clear();
|
}
|
if (_curvesGroups == null || _curvesGroups.Count == 0)
|
{
|
return;
|
}
|
|
|
for (int k = 0; k < _curvesGroups.Count; k++)
|
{
|
IStation.ViewModel.SingleCurvePointListGroupExDisp curvesInfo = _curvesGroups[k];
|
if (curvesInfo.IsCurve)
|
UpdateCurveSeries(k, curvesInfo, isUpateAnnoPosi);
|
else
|
CreatePointSeries(k, curvesInfo, isUpateAnnoPosi);
|
}
|
}
|
|
|
//更新其他曲线
|
public void UpdateCurveSeries(int index, IStation.ViewModel.SingleCurvePointListGroupExDisp Curve, bool isUpateAnnoPosi = true)
|
{
|
DevExpress.XtraCharts.Series seriesQH = new DevExpress.XtraCharts.Series("SeriesQH" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQH = new DevExpress.XtraCharts.SplineSeriesView();
|
DevExpress.XtraCharts.Series seriesQE = new DevExpress.XtraCharts.Series("SeriesQE" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQE = new DevExpress.XtraCharts.SplineSeriesView();
|
DevExpress.XtraCharts.Series seriesQP = new DevExpress.XtraCharts.Series("SeriesQP" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQP = new DevExpress.XtraCharts.SplineSeriesView();
|
|
/*DevExpress.XtraCharts.Series seriesQH = new DevExpress.XtraCharts.Series("SeriesQH" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQH = new DevExpress.XtraCharts.SplineSeriesView();
|
DevExpress.XtraCharts.Series seriesQE = new DevExpress.XtraCharts.Series("SeriesQE" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQE = new DevExpress.XtraCharts.SplineSeriesView();
|
DevExpress.XtraCharts.Series seriesQP = new DevExpress.XtraCharts.Series("SeriesQP" + index, ViewType.Spline);
|
DevExpress.XtraCharts.SplineSeriesView splineSeriesViewQP = new DevExpress.XtraCharts.SplineSeriesView();*/
|
|
|
seriesQH.Name = Curve.CurveName;
|
seriesQH.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQH.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQH.ShowInLegend = true;
|
|
|
|
seriesQE.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQE.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQE.ShowInLegend = false;
|
|
|
|
seriesQP.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQP.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQP.ShowInLegend = false;
|
|
|
seriesQH.CrosshairEnabled = DefaultBoolean.False;
|
seriesQP.CrosshairEnabled = DefaultBoolean.False;
|
seriesQE.CrosshairEnabled = DefaultBoolean.False;
|
this.chartControl1.Series.Add(seriesQH);
|
this.chartControl1.Series.Add(seriesQE);
|
this.chartControl1.Series.Add(seriesQP);
|
|
int i = 0;
|
for (i = 0; i < Curve.PointQH.Count(); i++)
|
{
|
seriesQH.Points.Add(new SeriesPoint(Curve.PointQH[i].X, new double[] { Curve.PointQH[i].Y }));
|
}
|
if (Curve.PointQE != null && Curve.PointQE.Count > 3)
|
{
|
|
for (i = 0; i < Curve.PointQE.Count(); i++)
|
{
|
seriesQE.Points.Add(new SeriesPoint(Curve.PointQE[i].X, new double[] { Curve.PointQE[i].Y }));
|
}
|
}
|
if (Curve.PointQP != null && Curve.PointQP.Count > 3)
|
{
|
for (i = 0; i < Curve.PointQP.Count(); i++)
|
{
|
seriesQP.Points.Add(new SeriesPoint(Curve.PointQP[i].X, new double[] { Curve.PointQP[i].Y }));
|
}
|
}
|
|
seriesQE.Visible = (_coordinateParas.DispPanelQE == 0);
|
seriesQP.Visible = (_coordinateParas.DispPanelQP == 0);
|
|
//splineSeriesViewQH.Color = Color.MintCream;
|
splineSeriesViewQH.Color = Curve.CurveColor;
|
splineSeriesViewQH.LineStyle.DashStyle = Curve.DashStyle;
|
splineSeriesViewQH.MarkerVisibility = DefaultBoolean.True;
|
splineSeriesViewQH.LineMarkerOptions.Kind = Curve.MarkerKind;
|
seriesQH.View = splineSeriesViewQH;
|
|
splineSeriesViewQE.AxisY = QEAxisY;//.AxisYName = "QEAxisY";
|
splineSeriesViewQE.Color = Curve.CurveColor;
|
splineSeriesViewQE.MarkerVisibility = DefaultBoolean.True;
|
splineSeriesViewQE.LineStyle.DashStyle = Curve.DashStyle;
|
splineSeriesViewQE.LineMarkerOptions.Kind = Curve.MarkerKind;
|
seriesQE.View = splineSeriesViewQE;
|
|
|
splineSeriesViewQP.AxisY = QPAxisY;//.AxisYName = "QPAxisY";
|
splineSeriesViewQP.Color = Curve.CurveColor;
|
splineSeriesViewQP.MarkerVisibility = DefaultBoolean.True;
|
splineSeriesViewQP.LineStyle.DashStyle = Curve.DashStyle;
|
splineSeriesViewQP.LineMarkerOptions.Kind = Curve.MarkerKind;
|
seriesQP.View = splineSeriesViewQP;
|
|
|
|
DevExpress.XtraCharts.TextAnnotation annoText = null;
|
if (isUpateAnnoPosi && !CurveAnnoMap.ContainsKey(index.ToString()))
|
{
|
annoText = new DevExpress.XtraCharts.TextAnnotation();
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = new DevExpress.XtraCharts.PaneAnchorPoint();
|
DevExpress.XtraCharts.RelativePosition relativePosition1 = new DevExpress.XtraCharts.RelativePosition();
|
paneAnchorPoint1.AxisXCoordinate.AxisValueSerializable = Curve.PointQH[Curve.PointQH.Count - 2].X.ToString();
|
paneAnchorPoint1.AxisYCoordinate.AxisValueSerializable = Curve.PointQH[Curve.PointQH.Count - 2].Y.ToString();
|
annoText.AnchorPoint = paneAnchorPoint1;
|
annoText.LabelMode = false;
|
annoText.RuntimeAnchoring = true;
|
annoText.RuntimeMoving = true;
|
annoText.RuntimeResizing = true;
|
annoText.RuntimeRotation = true;
|
annoText.Name = "Annotation" + index;
|
//annoText.tag
|
relativePosition1.ConnectorLength = 50D;
|
annoText.ShapePosition = relativePosition1;
|
|
this.chartControl1.AnnotationRepository.Add(annoText);
|
|
CurveAnnoMap[index.ToString()] = annoText;
|
}
|
else
|
{
|
annoText = CurveAnnoMap[index.ToString()] as DevExpress.XtraCharts.TextAnnotation;
|
}
|
|
annoText.Visible = isDispCurveName;
|
annoText.Text = Curve.CurveName;
|
annoText.TextColor = Curve.CurveColor;
|
annoText.Border.Color = Curve.CurveColor;
|
}
|
|
|
|
//更新其他曲线
|
public void CreatePointSeries(int index, IStation.ViewModel.SingleCurvePointListGroupExDisp Curve, bool isUpateAnnoPosi = true)
|
{
|
DevExpress.XtraCharts.Series seriesQH = new DevExpress.XtraCharts.Series();
|
DevExpress.XtraCharts.PointSeriesView splineSeriesViewQH = new DevExpress.XtraCharts.PointSeriesView();
|
DevExpress.XtraCharts.Series seriesQE = new DevExpress.XtraCharts.Series();
|
DevExpress.XtraCharts.PointSeriesView splineSeriesViewQE = new DevExpress.XtraCharts.PointSeriesView();
|
DevExpress.XtraCharts.Series seriesQP = new DevExpress.XtraCharts.Series();
|
DevExpress.XtraCharts.PointSeriesView splineSeriesViewQP = new DevExpress.XtraCharts.PointSeriesView();
|
|
seriesQH.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQH.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQH.Name = "SeriesPointQH" + index;
|
seriesQH.ShowInLegend = false;
|
|
|
|
seriesQE.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQE.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQE.Name = "SeriesPointQE" + index;
|
seriesQE.ShowInLegend = false;
|
|
|
seriesQP.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
seriesQP.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
seriesQP.Name = "SeriesPointQP" + index;
|
seriesQP.ShowInLegend = false;
|
|
|
seriesQH.CrosshairEnabled = DefaultBoolean.False;
|
seriesQP.CrosshairEnabled = DefaultBoolean.False;
|
seriesQE.CrosshairEnabled = DefaultBoolean.False;
|
this.chartControl1.Series.Add(seriesQH);
|
this.chartControl1.Series.Add(seriesQE);
|
this.chartControl1.Series.Add(seriesQP);
|
|
int i = 0;
|
for (i = 0; i < Curve.PointQH.Count(); i++)
|
{
|
seriesQH.Points.Add(new SeriesPoint(Curve.PointQH[i].X, new double[] { Curve.PointQH[i].Y }));
|
}
|
if (Curve.PointQE != null && Curve.PointQE.Count > 3)
|
{
|
for (i = 0; i < Curve.PointQE.Count(); i++)
|
{
|
seriesQE.Points.Add(new SeriesPoint(Curve.PointQE[i].X, new double[] { Curve.PointQE[i].Y }));
|
}
|
}
|
if (Curve.PointQP != null && Curve.PointQP.Count > 3)
|
{
|
for (i = 0; i < Curve.PointQP.Count(); i++)
|
{
|
seriesQP.Points.Add(new SeriesPoint(Curve.PointQP[i].X, new double[] { Curve.PointQP[i].Y }));
|
}
|
}
|
|
seriesQE.Visible = (_coordinateParas.DispPanelQE == 0);
|
seriesQP.Visible = (_coordinateParas.DispPanelQP == 0);
|
|
splineSeriesViewQH.Color = Curve.CurveColor;
|
seriesQH.View = splineSeriesViewQH;
|
|
splineSeriesViewQE.AxisY = QEAxisY;//.AxisYName = "QEAxisY";
|
splineSeriesViewQE.Color = Curve.CurveColor;
|
seriesQE.View = splineSeriesViewQE;
|
|
splineSeriesViewQP.AxisY = QPAxisY;//.AxisYName = "QPAxisY";
|
splineSeriesViewQP.Color = Curve.CurveColor;
|
seriesQP.View = splineSeriesViewQP;
|
|
|
|
DevExpress.XtraCharts.TextAnnotation annoText = null;
|
if (isUpateAnnoPosi)
|
{
|
annoText = new DevExpress.XtraCharts.TextAnnotation();
|
DevExpress.XtraCharts.PaneAnchorPoint paneAnchorPoint1 = new DevExpress.XtraCharts.PaneAnchorPoint();
|
DevExpress.XtraCharts.RelativePosition relativePosition1 = new DevExpress.XtraCharts.RelativePosition();
|
paneAnchorPoint1.AxisXCoordinate.AxisValueSerializable = Curve.PointQH[Curve.PointQH.Count - 2].X.ToString();
|
paneAnchorPoint1.AxisYCoordinate.AxisValueSerializable = Curve.PointQH[Curve.PointQH.Count - 2].Y.ToString();
|
annoText.AnchorPoint = paneAnchorPoint1;
|
annoText.LabelMode = false;
|
annoText.RuntimeAnchoring = true;
|
annoText.RuntimeMoving = true;
|
annoText.RuntimeResizing = true;
|
annoText.RuntimeRotation = true;
|
annoText.Name = "AnnotationPoint";
|
relativePosition1.ConnectorLength = 50D;
|
annoText.ShapePosition = relativePosition1;
|
|
this.chartControl1.AnnotationRepository.Add(annoText);
|
|
// CurveAnnoMap[index.ToString()] = annoText;
|
}
|
else
|
{
|
// annoText = CurveAnnoMap[index.ToString()] as DevExpress.XtraCharts.TextAnnotation;
|
}
|
|
annoText.Visible = isDispCurveName;
|
annoText.Text = Curve.CurveName;
|
annoText.TextColor = Curve.CurveColor;
|
annoText.Border.Color = Curve.CurveColor;
|
annoText.Visible = false;//暂时设为不可见
|
}
|
|
//
|
public void RefreshChart()
|
{
|
chartControl1.Refresh();
|
}
|
#endregion
|
|
#region 设置Chart显示
|
bool isMonoColor = false;
|
|
private void SetChartDisplay()
|
{
|
if (isMonoColor)
|
{
|
SetMonoColor();
|
}
|
else
|
{
|
SetSettingColor();
|
}
|
}
|
|
private void SetSettingColor()
|
{
|
//Common.XtraChartHelper.SetDisplay(AxisQ, QHAxisY, QEAxisY, QPAxisY);
|
//Common.XtraChartHelper.SetCurveDisplay(SeriesQHdefault, SeriesQEdefault, SeriesQPdefault);
|
}
|
|
private void SetMonoColor()
|
{
|
//Common.XtraChartHelper.SetMonoColor(chartControl1);
|
}
|
#endregion
|
|
#region 重绘
|
Rectangle CalculateDiagramBounds()
|
{
|
return CalculateDiagramBounds(mainChartDiagram.AxisX.VisualRange, mainChartDiagram.AxisY.VisualRange);
|
}
|
Rectangle CalculateDiagramBounds(VisualRange RangeAxisX, VisualRange RangeAxisY)
|
{
|
Point p1 = mainChartDiagram.DiagramToPoint((double)RangeAxisX.MinValue, (double)RangeAxisY.MinValue).Point;
|
Point p2 = mainChartDiagram.DiagramToPoint((double)RangeAxisX.MaxValue, (double)RangeAxisY.MaxValue).Point;
|
|
return GeomHelper.CreateRectangle(p1, p2);
|
}
|
|
void chartControl_CustomPaint(object sender, CustomPaintEventArgs e)
|
{
|
if (_coordinateParas == null)
|
return;
|
|
if (!(e is DXCustomPaintEventArgs dxArgs))
|
return;
|
if (!_isOnlyCurveQH)
|
{
|
chartControl1.DrawGridLineY(dxArgs, _coordinateParas,
|
isMonoColor ? Color.Gray : IStation.WinFrmUI.Curve.Cookie.ChartDisp.Default.GridLinesColorY, 0.2f,
|
true);
|
}
|
|
#region 绘制装配曲线
|
//if (_equipmentCurveParas != null && _equipmentCurveParas.CurveInfo != null)
|
//{
|
// if (isDispEquipmentCurve)
|
// chartControl1.DrawEquipmentCurve(g, _equipmentCurveParas.CurveInfo);
|
//}
|
#endregion
|
}
|
|
#endregion
|
|
#region 右击菜单
|
|
private void chartRightMenu_Opening(object sender, CancelEventArgs e)
|
{
|
//IStation.ViewModel.SinglePointListGroup4Disp info = (from x in curvesGroups where x.CurveID == Guid.Empty select x).FirstOrDefault();
|
//if (info == null)
|
//{
|
// 显示曲线方程MenuItem.Visible = false;
|
// 保存为曲线文件MenuItem.Visible = false;
|
//}
|
//else
|
//{
|
// 显示曲线方程MenuItem.Visible = true;
|
// 保存为曲线文件MenuItem.Visible = true;
|
//}
|
|
|
//if (OnChangeAxisTypeH == null)
|
//{
|
// 转化为压差曲线MenuItem.Visible = false;
|
//}
|
//else
|
//{//_hIsPress = false;//H表示是false扬程还是true压差
|
// if (_hIsPress)
|
// {
|
// 转化为压差曲线MenuItem.Text = "转化为扬程曲线";
|
// }
|
// else
|
// {
|
// 转化为压差曲线MenuItem.Text = "转化为压差曲线";
|
// }
|
//}
|
}
|
|
private void 显示曲线方程MenuItem_Click(object sender, EventArgs e)
|
{
|
//DispCurveExpress(Guid.Empty);
|
}
|
|
public void DispCurveExpress(string ID)
|
{
|
IStation.ViewModel.SingleCurvePointListGroupExDisp info = (from x in _curvesGroups where x.CurveID == ID select x).FirstOrDefault();
|
if (info == null)
|
return;
|
|
/* DispCurveEquationDlg theSetDlg = new DispCurveEquationDlg();
|
theSetDlg.SetCurveInfo(info.PointQH, info.PointQE, info.PointQP);
|
theSetDlg.Show();*/
|
}
|
private void 保存为曲线文件MenuItem_Click(object sender, EventArgs e)
|
{
|
SaveCurveFile(Guid.Empty);
|
}
|
public void SaveCurveFile(Guid ID)
|
{
|
//IStation.ViewModel.SinglePointListGroup4Disp info = (from x in curvesGroups where x.CurveID == ID select x).FirstOrDefault();
|
//if (info == null)
|
// return;
|
//Common.CurveFileHelper.SaveCurveFile(info);
|
}
|
//
|
private bool isDispCoodText = true;
|
private void 显示坐标文字MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispCoodText = !isDispCoodText;
|
if (isDispCoodText)
|
{
|
显示坐标文字MenuItem.Text = "不显示坐标说明";
|
}
|
else
|
{
|
显示坐标文字MenuItem.Text = "显示坐标说明";
|
}
|
|
AxisQ.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QHAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QEAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QPAxisY.Title.Visibility = isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
private void 显示对比刻度MenuItem_Click(object sender, EventArgs e)
|
{
|
_isDispRefConstantLineQ = !_isDispRefConstantLineQ;
|
if (_isDispRefConstantLineQ)
|
{
|
显示对比刻度MenuItem.Text = "不显示曲线对比";
|
|
}
|
else
|
{
|
显示对比刻度MenuItem.Text = "显示曲线对比";
|
}
|
|
if (refConstantLineQ != null)
|
{
|
refConstantLineQ.Visible = _isDispRefConstantLineQ;
|
}
|
|
for (int i = 0; i < this.chartControl1.AnnotationRepository.Count; i++)
|
{
|
if (this.chartControl1.AnnotationRepository[i].Name == "AnnotationRefInfo")
|
{
|
this.chartControl1.AnnotationRepository[i].Visible = _isDispRefConstantLineQ;
|
break;
|
}
|
}
|
}
|
|
private void 显示曲线标签MenuItem_Click(object sender, EventArgs e)
|
{
|
_isDispLegend = !_isDispLegend;
|
if (_isDispLegend)
|
{
|
显示曲线标签MenuItem.Text = "不显示曲线标签";
|
}
|
else
|
{
|
显示曲线标签MenuItem.Text = "显示曲线标签";
|
}
|
IsDispLegend = _isDispLegend;
|
}
|
|
private void 显示曲线名称MenuItem_Click(object sender, EventArgs e)
|
{//
|
isDispCurveName = !isDispCurveName;
|
if (isDispCurveName)
|
{
|
显示曲线名称MenuItem.Text = "不显示曲线名称";
|
}
|
else
|
{
|
显示曲线名称MenuItem.Text = "显示曲线名称";
|
}
|
IsDispCurveName = isDispCurveName;
|
}
|
|
private void 导出成图片MenuItem_Click(object sender, EventArgs e)
|
{
|
// chartControl1.ExportByDialog();
|
}
|
|
private void 调整坐标系MenuItem_Click(object sender, EventArgs e)
|
{
|
Curve.SetCoordinateAllDlg theSetDlg = new Curve.SetCoordinateAllDlg();
|
theSetDlg.CoordinateParas = this._coordinateParas;
|
theSetDlg.OnChangedCoord += (coord) =>
|
{
|
this._coordinateParas = coord;
|
UpdateCoordinate();
|
};
|
theSetDlg.Show();
|
}
|
|
private void 设置图形显示MenuItem_Click(object sender, EventArgs e)
|
{
|
//SetChartDisplayDlg theDlg = new SetChartDisplayDlg();
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// SetChartDisplay();
|
// chartControl1.Refresh();
|
//}
|
}
|
|
private void 设置颜色AnnoMenuItem_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
var anno = rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = anno.TextColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
anno.TextColor = colorDialog1.Color;
|
anno.Border.Color = colorDialog1.Color;
|
}
|
}
|
catch
|
{
|
return;
|
}
|
}
|
|
private void 修改Anno名称MenuItem_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
var anno = rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
if (anno.Name == "AnnotationRefInfo")
|
{
|
MessageBox.Show("无法手动修改值");
|
return;
|
}
|
if (editAnnonationIndex < 0 || editAnnonationIndex >= _curvesGroups.Count())
|
{
|
MessageBox.Show("无法手动修改值");
|
return;
|
}
|
SetCurveNameDlg theDlg = new SetCurveNameDlg();
|
theDlg.CurveName = anno.Text;
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
anno.Text = theDlg.CurveName;
|
_curvesGroups[editAnnonationIndex].CurveName = theDlg.CurveName;
|
}
|
}
|
catch
|
{
|
return;
|
}
|
}
|
|
private void 设置坐标值MenuItem_Click(object sender, EventArgs e)
|
{
|
var axis = rightClickObj as DevExpress.XtraCharts.Axis;
|
if (axis == null)
|
return;
|
|
//SetCoordinateOneDlg theSetDlg = new SetCoordinateOneDlg();
|
//theSetDlg.SetCoordinateInfo(_coordinateParas, axis);
|
//if (theSetDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// UpdateCoordinate();
|
//}
|
}
|
|
private void 设置颜色AxisMenuItem_Click(object sender, EventArgs e)
|
{
|
var axis = rightClickObj as DevExpress.XtraCharts.Axis;
|
if (axis == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
colorDialog1.Color = axis.Label.TextColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
axis.Title.TextColor = colorDialog1.Color;
|
axis.Label.TextColor = colorDialog1.Color;
|
axis.Color = colorDialog1.Color;
|
}
|
}
|
|
private void 设置颜色SeriesMenuItem_Click(object sender, EventArgs e)
|
{
|
var series = rightClickObj as DevExpress.XtraCharts.Series;
|
if (series == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = series.View.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
series.View.Color = colorDialog1.Color;
|
}
|
}
|
|
private void 设置颜色LineMenuItem_Click(object sender, EventArgs e)
|
{
|
var refLine = rightClickObj as DevExpress.XtraCharts.ConstantLine;
|
if (refLine == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = refLine.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
refLine.Color = colorDialog1.Color;
|
refLine.Title.TextColor = colorDialog1.Color;
|
}
|
}
|
|
private void 设置值LineMenuItem_Click(object sender, EventArgs e)
|
{
|
var refLine = rightClickObj as DevExpress.XtraCharts.ConstantLine;
|
if (refLine == null)
|
return;
|
if (refLine == refConstantLineQ)
|
{
|
SetRefLineValue1Dlg theDlg = new SetRefLineValue1Dlg();
|
theDlg.SetUnitName("m3/h");
|
theDlg.RefLineValue = Math.Round(Convert.ToDecimal(refConstantLineQ.AxisValue), 1);
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
SetRefConstantQ(Convert.ToDouble(theDlg.RefLineValue));
|
}
|
}
|
else if (refLine == refConstantLineH)
|
{
|
SetRefLineValue1Dlg theDlg = new SetRefLineValue1Dlg();
|
theDlg.SetUnitName("m");
|
theDlg.RefLineValue = Math.Round(Convert.ToDecimal(refConstantLineH.AxisValue), 1);
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
SetRefConstantH(Convert.ToDouble(theDlg.RefLineValue));
|
}
|
}
|
}
|
#endregion
|
|
#region chartControl事件
|
int editAnnonationIndex = 0;
|
object rightClickObj = null;
|
private void chartControl1_MouseClick(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
{
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InAnnotation)
|
{
|
rightClickObj = hitInfo.Annotation;
|
string annoName = hitInfo.Annotation.Name;
|
if (annoName == "AnnotationDefault")
|
{
|
editAnnonationIndex = 0;
|
}
|
else if (annoName == "AnnotationRefInfo")
|
{
|
editAnnonationIndex = -1;
|
}
|
else
|
{
|
editAnnonationIndex = Convert.ToInt32(annoName.Replace("Annotation", ""));
|
}
|
annoRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InSeries)
|
{
|
rightClickObj = hitInfo.Series;
|
curveRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InAxis)
|
{
|
rightClickObj = hitInfo.Axis;
|
axisRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InConstantLine)
|
{
|
rightClickObj = hitInfo.ConstantLine;
|
lineMenuStrip.Show(chartControl1, e.Location);
|
}
|
else
|
{
|
rightClickObj = null;
|
chartRightMenu.Show(chartControl1, e.Location);
|
}
|
}
|
else if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
//if (_isDispRefConstantLineQ)
|
//{
|
// DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
// double refQ = coordPt.NumericalArgument;
|
// // FeatPoint ftPoint = new FeatPoint(coordPt.NumericalArgument, coordPt.NumericalValue);
|
//}
|
|
}
|
}
|
|
private void chartControl1_LegendItemChecked(object sender, LegendItemCheckedEventArgs e)
|
{
|
if (_curvesGroups.Count == 0)
|
return;
|
|
//if (e.CheckedElement == SeriesQHdefault)
|
//{
|
// SetCurveTypeDisp(eCurveType.QHcurve,e.NewCheckState,false);
|
//}
|
//if (e.CheckedElement == SeriesQEdefault)
|
//{
|
// SetCurveTypeDisp(Model.eFeatCurveType.QE , e.NewCheckState,false);
|
//}
|
//if (e.CheckedElement == SeriesQPdefault)
|
//{
|
// SetCurveTypeDisp(Model.eFeatCurveType.QP, e.NewCheckState, false);
|
//}
|
|
UpdateCoordinate();
|
}
|
|
bool isMoveConstantLineRefQ = false;
|
bool isMoveConstantLineRefH = false;
|
private void chartControl1_MouseDown(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InConstantLine)
|
{
|
if (hitInfo.ConstantLine == refConstantLineQ)
|
isMoveConstantLineRefQ = true;
|
if (hitInfo.ConstantLine == refConstantLineH)
|
isMoveConstantLineRefH = true;
|
}
|
else
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refQ = coordPt.NumericalArgument;
|
double refH = coordPt.NumericalValue;
|
|
//if (OnDispOperateInfo != null)
|
//{
|
// OnDispOperateInfo(this, new Model.InfoEventArgs(string.Format("点击处 流量={0:N1}; 扬程={1:N1}", refQ, refH)));
|
//}
|
}
|
}
|
//if (isRectSel)
|
//{//进行框选删除点
|
// Rectangle bounds = CalculateDiagramBounds();
|
// if (bounds.Contains(e.Location))
|
// {
|
// selCornerFirstPt = selCornerLastPt = e.Location;
|
// selRectangleIng = Rectangle.Empty;
|
// }
|
//}
|
}
|
|
private void chartControl1_MouseMove(object sender, MouseEventArgs e)
|
{
|
if (isMoveConstantLineRefQ)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refQ = coordPt.NumericalArgument;
|
SetRefConstantQ(refQ);
|
}
|
if (isMoveConstantLineRefH)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refH = coordPt.NumericalValue;
|
SetRefConstantH(refH);
|
}
|
// // FeatPoint ftPoint = new FeatPoint(coordPt.NumericalArgument, coordPt.NumericalValue);
|
|
// if (selCornerFirstPt.IsEmpty)
|
// return;
|
|
// selCornerLastPt = Common.DiagramToPointHelper.GetLastSelectionCornerPosition(
|
// e.Location, CalculateDiagramBounds());
|
|
// if (!selCornerLastPt.IsEmpty && selCornerFirstPt != selCornerLastPt)
|
// {
|
// selRectangleIng = Common.DiagramToPointHelper.CreateRectangle(selCornerFirstPt, selCornerLastPt);
|
// chartControl1.Invalidate();//刷新控件
|
// }
|
}
|
|
private void chartControl1_MouseUp(object sender, MouseEventArgs e)
|
{
|
isMoveConstantLineRefQ = false;
|
isMoveConstantLineRefH = false;
|
//if (isRectSel)
|
//{
|
// isRectSel = false;
|
// #region 框选删除
|
// if (isRectSelDelPts)
|
// {//
|
// isRectSelDelPts = false;
|
|
// DiagramCoordinates firstCoordinate = theXYDiagram.PointToDiagram(selCornerFirstPt);
|
// DiagramCoordinates lastCoordinate = theXYDiagram.PointToDiagram(selCornerLastPt);
|
// if (firstCoordinate.IsEmpty || lastCoordinate.IsEmpty)
|
// return;
|
// PointF firstPoint = new PointF((float)firstCoordinate.NumericalArgument, (float)firstCoordinate.NumericalValue);
|
// PointF lastPoint = new PointF((float)lastCoordinate.NumericalArgument, (float)lastCoordinate.NumericalValue);
|
|
// //foreach (var pt in clickPointInfo)
|
// //{
|
// // if (pt.X < lastPoint.X && pt.X > firstPoint.X && pt.Y > lastPoint.Y && pt.Y < firstPoint.Y)
|
// // {
|
// // clickPointInfo.Remove(pt);
|
// // }
|
// //}
|
// for (int i = clickPointInfo.Count - 1; i >= 0; i--)
|
// {
|
// var pt = clickPointInfo[i];
|
// if (pt.X < lastPoint.X && pt.X > firstPoint.X && pt.Y > lastPoint.Y && pt.Y < firstPoint.Y)
|
// {
|
// clickPointInfo.Remove(pt);
|
// }
|
|
// }
|
|
// SeriesPoint.Points.Clear();
|
// foreach (var ftPoint in clickPointInfo)
|
// {
|
// SeriesPoint.Points.Add(new SeriesPoint(ftPoint.X, new double[] { ftPoint.Y }));
|
// }
|
// }
|
// #endregion
|
|
|
//}
|
//selCornerFirstPt = Point.Empty;
|
//selCornerLastPt = Point.Empty;
|
//selRectangleIng = Rectangle.Empty;
|
|
}
|
|
private void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e)
|
{
|
//SeriesPoint point = e.AdditionalObject as SeriesPoint;
|
|
//if (point != null)
|
//{
|
// FeatTimePointEx cInfo = point.Tag as FeatTimePointEx;
|
// if (cInfo != null)
|
// {
|
// string s = string.Format("采集时间:{0}, 流量:{1}, 扬程:{2}", cInfo.Time, cInfo.X, cInfo.Y);
|
// toolTipController.ShowHint(s);
|
// }
|
//}
|
//else
|
//{
|
// toolTipController.HideHint();
|
//}
|
}
|
|
#endregion
|
|
#region 查询
|
bool _isQueryByQ = true;
|
private void 根据流量查询MenuItem_Click(object sender, EventArgs e)
|
{
|
_isQueryByQ = !_isQueryByQ;
|
if (_isQueryByQ)
|
{
|
_isDispRefConstantLineH = false;
|
_isDispRefConstantLineQ = true;
|
refConstantLineQ.Visible = true;
|
refConstantLineH.Visible = false;
|
根据流量查询MenuItem.Text = "根据扬程查询";
|
}
|
else
|
{
|
_isDispRefConstantLineH = true;
|
_isDispRefConstantLineQ = false;
|
refConstantLineQ.Visible = false;
|
refConstantLineH.Visible = true;
|
根据流量查询MenuItem.Text = "根据流量查询";
|
|
double h = Convert.ToDouble(refConstantLineH.AxisValue);
|
refConstantLineH.Title.Text = h.ToString("N1");
|
}
|
}
|
public void SetQueryStatusQ()
|
{
|
_isQueryByQ = true;
|
_isDispRefConstantLineH = false;
|
_isDispRefConstantLineQ = true;
|
refConstantLineQ.Visible = true;
|
refConstantLineH.Visible = false;
|
根据流量查询MenuItem.Text = "根据扬程查询";
|
|
}
|
|
public void SetQueryStatusH()
|
{
|
_isQueryByQ = false;
|
_isDispRefConstantLineH = true;
|
_isDispRefConstantLineQ = false;
|
refConstantLineQ.Visible = false;
|
refConstantLineH.Visible = true;
|
根据流量查询MenuItem.Text = "根据流量查询";
|
|
double h = Convert.ToDouble(refConstantLineH.AxisValue);
|
refConstantLineH.Title.Text = h.ToString("N1");
|
|
}
|
|
private void SetRefConstantQ(double refQ)
|
{
|
if (!_isDispRefConstantLineQ)
|
return;
|
|
if (refQ < minQ * 1.01 || refQ > maxQ * 0.999)
|
return;
|
|
refConstantLineQ.AxisValue = refQ;
|
refConstantLineQ.Title.Visible = true;
|
refConstantLineQ.Visible = true;
|
refConstantLineQ.Title.Text = refQ.ToString("N1");
|
StringBuilder builder = new StringBuilder();
|
if (_hIsPress)
|
builder.Append(" 压差: ");
|
else
|
builder.Append(" 扬程: ");
|
foreach (IStation.ViewModel.SingleCurvePointListGroupExDisp info in _curvesGroups)
|
{
|
if (refQ < info.PointQH.Last().X && refQ > info.PointQH.First().X)
|
{
|
double refH = IStation.Common.FitCurveHelper.GetFitPointY(info.PointQH, refQ);
|
if (_hIsPress)
|
builder.AppendFormat(" {0} {1:N4}, ", info.CurveName, refH);
|
else
|
builder.AppendFormat(" {0} {1:N1}, ", info.CurveName, refH);
|
refConstantLineH.AxisValue = refH;
|
}
|
else
|
{
|
builder.AppendFormat(" {0} ?, ", info.CurveName);
|
}
|
}
|
builder.AppendLine("");
|
builder.Append(" 效率: ");
|
foreach (IStation.ViewModel.SingleCurvePointListGroupExDisp info in _curvesGroups)
|
{
|
if (info.PointQE != null)
|
{
|
if (refQ < info.PointQE.Last().X && refQ > info.PointQE.First().X)
|
{
|
double refE = IStation.Common.FitCurveHelper.GetFitPointY(info.PointQE, refQ);
|
builder.AppendFormat(" {0} {1:N1}, ", info.CurveName, refE);
|
}
|
else
|
{
|
builder.AppendFormat(" {0} ?, ", info.CurveName);
|
}
|
}
|
|
}
|
builder.AppendLine("");
|
builder.Append(" 功率: ");
|
foreach (IStation.ViewModel.SingleCurvePointListGroupExDisp info in _curvesGroups)
|
{
|
if (info.PointQP != null)
|
{
|
if (refQ < info.PointQP.Last().X && refQ > info.PointQP.First().X)
|
{
|
double refP = IStation.Common.FitCurveHelper.GetFitPointY(info.PointQP, refQ);
|
builder.AppendFormat(" {0} {1:N1}; ", info.CurveName, refP);
|
}
|
else
|
{
|
builder.AppendFormat(" {0} ?; ", info.CurveName);
|
}
|
}
|
}
|
var anno = this.chartControl1.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
anno.Visible = true;
|
anno.Text = builder.ToString();
|
}
|
|
private void SetRefConstantH(double refH)
|
{
|
if (!_isDispRefConstantLineH)
|
return;
|
|
if (refH < minH * 1.01 || refH > maxH * 0.999)
|
return;
|
|
refConstantLineH.AxisValue = refH;
|
refConstantLineH.Title.Visible = true;
|
refConstantLineH.Visible = true;
|
if (_hIsPress)
|
refConstantLineH.Title.Text = refH.ToString("N4");
|
else
|
refConstantLineH.Title.Text = refH.ToString("N1");
|
StringBuilder builder = new StringBuilder();
|
foreach (IStation.ViewModel.SingleCurvePointListGroupExDisp info in _curvesGroups)
|
{
|
var intrPts = Model.FitCurveHelper.GetInterPointX(info.PointQH, refH);
|
if (intrPts == null || intrPts.Count == 0)
|
{
|
builder.AppendFormat("{0} 流量:?, ", info.CurveName);
|
}
|
else
|
{
|
double refQ = intrPts.Last().X;
|
builder.AppendFormat("{0}: 流量:{1:N1}; ", info.CurveName, refQ);
|
refConstantLineQ.AxisValue = refQ;
|
|
double refP = IStation.Common.FitCurveHelper.GetFitPointY(info.PointQP, refQ);
|
builder.AppendFormat("功率: {1:N1} ", info.CurveName, refP);
|
|
// double refE = Common.FitCurve.GetFitPointY(info.PointQE, refQ);
|
// builder.AppendFormat("{0} {1:N1}, ", info.CurveName, refE);
|
}
|
builder.AppendLine("");
|
}
|
|
var anno = this.chartControl1.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
anno.Visible = true;
|
anno.Text = builder.ToString();
|
}
|
#endregion
|
|
#region 压差曲线还是扬程曲线
|
private bool _hIsPress = false;//H表示是false扬程还是true压差
|
public bool HIsPress { get { return _hIsPress; } }
|
public Unit.eUnitH GetUnitH
|
{//true压差用MPa
|
get { return _unitH; }// return _hIsPress ? Unit.eUnitH.MPa : Unit.eUnitH.M; }
|
}
|
|
|
#endregion
|
|
#region 装置曲线
|
//EquipCurveParas _equipmentCurveParas = null;
|
//bool isDispEquipmentCurve = false;
|
private void 设置装置曲线MenuItem_Click(object sender, EventArgs e)
|
{
|
//SetEquipmentCurve();
|
}
|
private void 显示装置曲线MenuItem_Click(object sender, EventArgs e)
|
{
|
//if (_equipmentCurveParas == null)
|
//{
|
// SetEquipmentCurve();
|
//}
|
//else
|
//{
|
// 显示装置曲线MenuItem.Checked = !显示装置曲线MenuItem.Checked;
|
// isDispEquipmentCurve = 显示装置曲线MenuItem.Checked;
|
// 设置装置曲线MenuItem.Visible = isDispEquipmentCurve;
|
// chartControl1.Refresh();
|
//}
|
}
|
|
public void SetEquipmentCurve()
|
{
|
//SetEquipmentCurveDlg theDlg = new SetEquipmentCurveDlg();
|
//if (_equipmentCurveParas != null)
|
//{
|
// theDlg.SetEquipmentCurve(_equipmentCurveParas);
|
//}
|
//if (theDlg.ShowDialog() == DialogResult.OK)
|
//{
|
// _equipmentCurveParas = theDlg.GetEquipmentCurve();
|
// if (!isDispEquipmentCurve)
|
// {
|
// 显示装置曲线MenuItem.Checked = true;
|
// 设置装置曲线MenuItem.Visible = true;
|
// isDispEquipmentCurve = true;
|
// }
|
// chartControl1.Refresh();
|
//}
|
}
|
|
public void ClearEquipmentCurve()
|
{
|
//_equipmentCurveParas = null;
|
//chartControl1.Refresh();
|
}
|
#endregion
|
|
private void 设置背景色ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
var anno = rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = anno.BackColor;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
anno.BackColor = colorDialog1.Color;
|
}
|
}
|
catch
|
{
|
return;
|
}
|
}
|
|
private void 设置背景透明AnnoMenuItem_Click(object sender, EventArgs e)
|
{
|
var anno = rightClickObj as DevExpress.XtraCharts.TextAnnotation;
|
if (anno == null)
|
return;
|
|
anno.BackColor = Color.Transparent;
|
}
|
|
private void 显示右上角面板MenuItem_Click(object sender, EventArgs e)
|
{
|
显示右上角面板MenuItem.Checked = !显示右上角面板MenuItem.Checked;
|
|
chartControl1.Legend.Visibility = 显示右上角面板MenuItem.Checked ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
|
}
|
}
|