using DevExpress.Utils;
|
using DevExpress.XtraCharts;
|
using DevExpress.XtraEditors;
|
using System.Text;
|
using Yw.Geometry;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public partial class PumpPerformCompareChart : DevExpress.XtraEditors.XtraUserControl
|
{
|
public PumpPerformCompareChart()
|
{
|
InitializeComponent();
|
InitialChart();
|
this.chartControl1.RuntimeHitTesting = true;
|
}
|
|
#region Private Variable
|
|
private XYDiagram _diagram;
|
private XYDiagramPane _bottom_panel;
|
private AxisX _axis_x_flow;
|
private AxisY _axis_y_head;
|
private SecondaryAxisY _axis_y_eff, _axis_y_power;
|
private ConstantLine _query_flow_line;
|
private ConstantLine _query_head_line;
|
|
private Series _series_head, _series_eff, _series_power;
|
private Series _series_head_wk, _series_eff_wk, _series_power_wk;
|
|
private Series _series_equip;
|
private List<Series> _series_equip_pt_list;
|
|
private TextAnnotation _anno_txt_query_info;
|
|
private Yw.Geometry.CubicSpline2d _qh, _qe, _qp;
|
private Yw.Geometry.CubicSpline2d _qh_wk, _qe_wk, _qp_wk;
|
|
private List<Yw.Geometry.Point2d> _qh_pt_list;
|
private List<Yw.Geometry.Point2d> _qe_pt_list;
|
private List<Yw.Geometry.Point2d> _qp_pt_list;
|
|
private PumpQueryPointViewModel _work_point = new();
|
|
|
private bool _equip_visible = true;
|
|
private PumpCoordinate _coordinate;
|
private bool _initial_data = false;
|
|
#endregion
|
|
#region Public Variable
|
|
/// <summary>
|
/// 定义点是否可见
|
/// </summary>
|
public bool DefinePointVisible
|
{
|
get => _define_pt_visible;
|
set
|
{
|
_define_pt_visible = value;
|
this.barCekDefinePointVisible.Checked = _define_pt_visible;
|
}
|
}
|
private bool _define_pt_visible = false;
|
|
/// <summary>
|
/// 工作线是否可见
|
/// </summary>
|
public bool LineVisible
|
{
|
get => _line_visible;
|
set
|
{
|
_line_visible = value;
|
this.barCekLineVisible.Checked = _line_visible;
|
this.barBtnSetAxisHValue.Enabled = _line_visible;
|
this.barBtnSetAxisQValue.Enabled = _line_visible;
|
this.barBtnPositioningMaxE.Enabled = _line_visible;
|
this.barBtnPositioningMaxQ.Enabled = _line_visible;
|
}
|
}
|
private bool _line_visible = false;
|
|
#endregion
|
|
#region Public Evnet
|
|
public event Action<PumpCoordinate> OnCurveCoordinateChanged;
|
|
|
public event Action<PumpQueryPointViewModel> OnCalcQueryPoint = null;
|
|
#endregion
|
|
#region Initial
|
|
/// <summary>
|
/// 初始化图表
|
/// </summary>
|
private void InitialChart()
|
{
|
this.chartControl1.SetChartDisplay();
|
this.chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
|
|
|
_diagram = (XYDiagram)chartControl1.Diagram;
|
_bottom_panel = (XYDiagramPane)_diagram.FindPaneByName("BottomPanel");
|
|
_axis_x_flow = _diagram.AxisX;
|
_axis_x_flow.SetAxisXQDisplay();
|
_axis_y_head = _diagram.AxisY;
|
_axis_y_head.SetAxisYQHDisplay();
|
_axis_y_eff = _diagram.SecondaryAxesY.GetAxisByName("AxisYQE");
|
_axis_y_eff.SetSecondaryAxisYQEDisplay();
|
_axis_y_power = _diagram.SecondaryAxesY.GetAxisByName("AxisYQP");
|
_axis_y_power.SetSecondaryAxisYQPDisplay();
|
|
_query_flow_line = (ConstantLine)_diagram.AxisX.ConstantLines.GetElementByName("WorkPointLine");
|
_query_flow_line.SetWorkPointLineDisplay();
|
|
_query_head_line = (ConstantLine)_diagram.AxisY.ConstantLines.GetElementByName("WorkHLine");
|
_query_head_line.SetWorkHLineDisplay();
|
|
_series_head = this.chartControl1.GetSeriesByName("SeriesCurveQH");
|
_series_head.SetCurveQHDisplay();
|
|
_series_eff = this.chartControl1.GetSeriesByName("SeriesCurveQE");
|
_series_eff.SetCurveQEDisplay();
|
|
_series_power = this.chartControl1.GetSeriesByName("SeriesCurveQP");
|
_series_power.SetCurveQPDisplay();
|
|
_series_head_wk = this.chartControl1.GetSeriesByName("SeriesCurveQHwk");
|
_series_head_wk.SetCurveQHDisplay();
|
_series_head_wk.View.Color = Color.Black;
|
|
_series_eff_wk = this.chartControl1.GetSeriesByName("SeriesCurveQEwk");
|
_series_eff_wk.SetCurveQEDisplay();
|
_series_eff_wk.View.Color = Color.Black;
|
|
_series_power_wk = this.chartControl1.GetSeriesByName("SeriesCurveQPwk");
|
_series_power_wk.SetCurveQPDisplay();
|
_series_power_wk.View.Color = Color.Black;
|
|
_series_equip = this.chartControl1.GetSeriesByName("SeriesEquipCurve");
|
|
_anno_txt_query_info = this.chartControl1.AnnotationRepository[0] as TextAnnotation;
|
_anno_txt_query_info.SetTextAnnoWorkPointDisplay();
|
|
_axis_x_flow.Visibility = DefaultBoolean.False;
|
_axis_x_flow.GridLines.Visible = false;
|
_axis_y_head.Visibility = DefaultBoolean.False;
|
_axis_y_head.GridLines.Visible = false;
|
_axis_y_eff.Visibility = DefaultBoolean.False;
|
_axis_y_eff.GridLines.Visible = false;
|
_axis_y_power.Visibility = DefaultBoolean.False;
|
_axis_y_power.GridLines.Visible = false;
|
|
|
_query_flow_line.Visible = false;
|
_query_head_line.Visible = false;
|
_anno_txt_query_info.Visible = false;
|
|
|
this.chartControl1.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.chartControl1_ObjectHotTracked);
|
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.Resize += new System.EventHandler(this.chartControl1_Resize);
|
|
}
|
|
/// <summary>
|
/// 初始化图表数据
|
/// </summary>
|
public void InitialChartData()
|
{
|
_initial_data = false;
|
_qh = null;
|
_qe = null;
|
_qp = null;
|
|
_qh_wk = null;
|
_qe_wk = null;
|
_qp_wk = null;
|
|
_qh_pt_list = null;
|
_qe_pt_list = null;
|
_qp_pt_list = null;
|
|
_coordinate = null;
|
_work_point = new PumpQueryPointViewModel();
|
|
UpdateChart(false);
|
}
|
|
#endregion
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
/// <param name="qh"></param>
|
/// <param name="qe"></param>
|
/// <param name="qp"></param>
|
/// <param name="calc_coordinate"></param>
|
public void SetBindingData(
|
Yw.Geometry.CubicSpline2d qh,
|
Yw.Geometry.CubicSpline2d qe,
|
Yw.Geometry.CubicSpline2d qp,
|
string coordinate_paras = "",
|
bool calc_coordinate = false)
|
{
|
if (qh == null)
|
{
|
InitialChartData();
|
return;
|
}
|
List<Yw.Geometry.Point2d> qh_pt_list, qe_pt_list = null, qp_pt_list = null;
|
|
qh_pt_list = qh.GetPointList(12);
|
|
if (qe != null)
|
qe_pt_list = qe.GetPointList(12);
|
|
if (qp != null)
|
qp_pt_list = qp.GetPointList(12);
|
SetBindingData(qh, qe, qp, qh_pt_list, qe_pt_list, qp_pt_list, coordinate_paras, calc_coordinate);
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
/// <param name="qh"></param>
|
/// <param name="qe"></param>
|
/// <param name="qp"></param>
|
/// <param name="calc_coordinate"></param>
|
public void SetBindingData(
|
Yw.Geometry.CubicSpline2d qh,
|
Yw.Geometry.CubicSpline2d qe,
|
Yw.Geometry.CubicSpline2d qp,
|
Yw.Geometry.CubicSpline2d qh_wk,
|
Yw.Geometry.CubicSpline2d qe_wk,
|
Yw.Geometry.CubicSpline2d qp_wk,
|
string coordinate_paras = "",
|
bool calc_coordinate = false)
|
{
|
if (qh == null)
|
{
|
InitialChartData();
|
return;
|
}
|
|
_qh_wk = qh_wk;
|
_qe_wk = qe_wk;
|
_qp_wk = qp_wk;
|
|
List<Yw.Geometry.Point2d> qh_pt_list, qe_pt_list = null, qp_pt_list = null;
|
qh_pt_list = qh.GetPointList(12);
|
if (qe != null)
|
qe_pt_list = qe.GetPointList(12);
|
if (qp != null)
|
qp_pt_list = qp.GetPointList(12);
|
|
SetBindingData(qh, qe, qp, qh_pt_list, qe_pt_list, qp_pt_list, coordinate_paras, calc_coordinate);
|
}
|
|
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
/// <param name="qh"></param>
|
/// <param name="qe"></param>
|
/// <param name="qp"></param>
|
/// <param name="qh_pt_list"></param>
|
/// <param name="qe_pt_list"></param>
|
/// <param name="qp_pt_list"></param>
|
/// <param name="coordinate_paras"></param>
|
/// <param name="calc_coordinate"></param>
|
public void SetBindingData(
|
Yw.Geometry.CubicSpline2d qh,
|
Yw.Geometry.CubicSpline2d qe,
|
Yw.Geometry.CubicSpline2d qp,
|
List<Yw.Geometry.Point2d> qh_pt_list,
|
List<Yw.Geometry.Point2d> qe_pt_list,
|
List<Yw.Geometry.Point2d> qp_pt_list,
|
string coordinate_paras = null,
|
bool calc_coordinate = false)
|
{
|
if (qh_pt_list == null || !qh_pt_list.Any())
|
{
|
InitialChartData();
|
return;
|
}
|
_initial_data = true;
|
_qh = qh;
|
_qe = qe;
|
_qp = qp;
|
|
_qh_pt_list = qh_pt_list;
|
_qe_pt_list = qe_pt_list;
|
_qp_pt_list = qp_pt_list;
|
|
_coordinate = PumpCoordinate.ToModel(coordinate_paras);
|
|
UpdateChart(calc_coordinate);
|
}
|
|
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
/// <param name="qh_wk"></param>
|
/// <param name="qe_wk"></param>
|
/// <param name="qp_wk"></param>
|
public void SetWkData(
|
Yw.Geometry.CubicSpline2d qh_wk,
|
Yw.Geometry.CubicSpline2d qe_wk,
|
Yw.Geometry.CubicSpline2d qp_wk)
|
{
|
if (qh_wk == null)
|
{
|
_qh_wk = null;
|
_qe_wk = null;
|
_qp_wk = null;
|
_series_head_wk.Visible = false;
|
_series_eff_wk.Visible = false;
|
_series_power_wk.Visible = false;
|
return;
|
}
|
|
_qh_wk = qh_wk;
|
_qe_wk = qe_wk;
|
_qp_wk = qp_wk;
|
|
|
UpdateChart(true);
|
}
|
|
|
|
/// <summary>
|
/// 更新图表
|
/// </summary>
|
/// <param name="calc_coordinate">计算坐标</param>
|
public void UpdateChart(bool calc_coordinate = false)
|
{
|
if (_qh_pt_list == null || !_qh_pt_list.Any())
|
{
|
this.barBtnPositioningMaxE.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
|
}
|
else
|
{
|
this.barBtnPositioningMaxE.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
|
}
|
|
if (_qp_pt_list == null || !_qp_pt_list.Any())
|
{
|
this.barCekSetSplitPanel.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
|
}
|
else
|
{
|
this.barCekSetSplitPanel.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
|
}
|
|
if (calc_coordinate || _coordinate == null)
|
{
|
//不强迫计算,就用上次更新的坐标系
|
CalcCoordinate();
|
}
|
|
CalcChartAxis(this.barCekSetSplitPanel.Checked);
|
|
CalcSeries();
|
|
CalcWorkPointByQ();
|
|
CalcDesignPointByQ();
|
|
CalcTextAnchorPoint();
|
}
|
|
#region Calc
|
|
/// <summary>
|
/// 计算坐标
|
/// </summary>
|
private void CalcCoordinate()
|
{
|
if (_qh_pt_list == null || _qh_pt_list.Count < 4)
|
{
|
//设置成白板坐标
|
_coordinate = new PumpCoordinate();
|
_coordinate.GridNumberX = 30;
|
_coordinate.GridNumberY = 16;
|
//显示的坐标线号
|
_coordinate.StartLineNoH = 10;
|
_coordinate.EndLineNoH = 15;
|
_coordinate.StartLineNoE = 0;
|
_coordinate.EndLineNoE = 10;
|
_coordinate.StartLineNoP = 2;
|
_coordinate.EndLineNoP = 9;
|
//坐标最小值和间隔
|
_coordinate.CoordMinQ = 0; _coordinate.CoordSpaceQ = 1000;
|
_coordinate.CoordMinH = 10; _coordinate.CoordSpaceH = 100;
|
_coordinate.CoordMinE = 0; _coordinate.CoordSpaceE = 100;
|
_coordinate.CoordMinP = 10; _coordinate.CoordSpaceP = 100;
|
return;
|
}
|
|
var qh_list = new List<CubicSpline2d>();
|
var qe_list = new List<CubicSpline2d>();
|
var qp_list = new List<CubicSpline2d>();
|
|
if (_qh != null)
|
qh_list.Add(_qh);
|
|
if (_qe != null)
|
qe_list.Add(_qe);
|
|
if (_qp != null)
|
qp_list.Add(_qp);
|
|
if (_qh_wk != null)
|
qh_list.Add(_qh_wk);
|
|
if (_qe_wk != null)
|
qe_list.Add(_qe_wk);
|
|
if (_qp_wk != null)
|
qp_list.Add(_qp_wk);
|
|
double max_flow = 0, min_flow = 10000;
|
double max_head = 0, min_head = 10000;
|
double max_eff = 0, min_eff = 0;
|
double max_power = 0, min_power = 1000;
|
|
double scaleMinH = 1, scaleMaxH = 1;
|
|
foreach (var vm in qh_list)
|
{
|
var qh_pt_list = vm.GetPointList();
|
var xxx = qh_pt_list.Select(x => x.X);
|
var yyy = qh_pt_list.Select(x => x.Y);
|
|
min_flow = Math.Min(min_flow, xxx.Min());
|
max_flow = Math.Max(max_flow, xxx.Max());
|
|
min_head = Math.Min(min_head, yyy.Min());
|
max_head = Math.Max(max_head, yyy.Max());
|
}
|
|
|
foreach (var vm in qe_list)
|
{
|
if (vm == null)
|
continue;
|
var qe_pt_list = vm.GetPointList();
|
var yyy = qe_pt_list.Select(x => x.Y);
|
max_eff = Math.Max(max_eff, yyy.Max());
|
}
|
|
foreach (var vm in qp_list)
|
{
|
if (vm == null)
|
continue;
|
var yyy = vm.GetPointList().Select(x => x.Y);
|
min_power = Math.Min(min_power, yyy.Min());
|
max_power = Math.Max(max_power, yyy.Max());
|
}
|
|
_coordinate = PumpCoordinate.CalcCoordinate(min_flow, max_flow,
|
min_head * scaleMinH,
|
max_head * scaleMaxH,
|
min_eff,
|
max_eff,
|
min_power,
|
max_power);
|
|
if (_coordinate == null)
|
return;
|
|
if (_coordinate.CoordMinQ + _coordinate.CoordSpaceQ * this._coordinate.GridNumberX < max_flow * 1.05)
|
{
|
_coordinate.GridNumberX++;
|
}
|
|
}
|
|
/// <summary>
|
/// 计算图表轴
|
/// </summary>
|
public void CalcChartAxis(bool split_panel)
|
{
|
if (_coordinate == null)
|
{
|
_axis_x_flow.Visibility = DefaultBoolean.False;
|
_axis_x_flow.GridLines.Visible = false;
|
_axis_y_head.Visibility = DefaultBoolean.False;
|
_axis_y_head.GridLines.Visible = false;
|
_axis_y_eff.Visibility = DefaultBoolean.False;
|
_axis_y_eff.GridLines.Visible = false;
|
_axis_y_power.Visibility = DefaultBoolean.False;
|
_axis_y_power.GridLines.Visible = false;
|
|
_query_flow_line.Visible = false;
|
_query_head_line.Visible = false;
|
_anno_txt_query_info.Visible = false;
|
_bottom_panel.Visibility = ChartElementVisibility.Hidden;
|
return;
|
}
|
|
_bottom_panel.Visibility = split_panel ? ChartElementVisibility.Visible : ChartElementVisibility.Hidden;
|
|
|
PointSeriesView series_equip_p_pt_view = null;
|
if (_series_equip_pt_list != null && _series_equip_pt_list.Any())
|
{
|
var series = _series_equip_pt_list.Find(x => (Yw.Pump.eCurveType)x.Tag == Yw.Pump.eCurveType.QP);
|
if (series != null)
|
{
|
series_equip_p_pt_view = (PointSeriesView)series.View;
|
}
|
}
|
|
//流量
|
if (_qh_pt_list != null)
|
{
|
//计算刻度
|
var labels = new List<CustomAxisLabel>();
|
var disQ = _coordinate.CoordMinQ;
|
for (int i = 0; i < _coordinate.GridNumberX + 1; i++)
|
{
|
labels.Add(new CustomAxisLabel(disQ.ToString("N0"), disQ));
|
disQ = disQ + _coordinate.CoordSpaceQ;
|
}
|
|
//坐标刻度
|
_axis_x_flow.CustomLabels.Clear();
|
_axis_x_flow.CustomLabels.AddRange(labels.ToArray());
|
_axis_x_flow.Visibility = DefaultBoolean.True;
|
_axis_x_flow.GridLines.Visible = true;
|
_axis_x_flow.SetAxisRange(_coordinate.CoordMinQ, _coordinate.CoordMinQ + _coordinate.GridNumberX * _coordinate.CoordSpaceQ);
|
_anno_txt_query_info.Visible = _line_visible;
|
}
|
|
//扬程
|
if (_qh_pt_list != null)
|
{
|
//计算刻度
|
var labels = new List<CustomAxisLabel>();
|
var display_head = _coordinate.CoordMinH + _coordinate.CoordSpaceH * _coordinate.StartLineNoH;
|
for (int i = _coordinate.StartLineNoH; i < _coordinate.EndLineNoH + 1; i++)
|
{
|
labels.Add(new CustomAxisLabel(display_head.ToString(), display_head));
|
display_head = display_head + _coordinate.CoordSpaceH;
|
}
|
|
_axis_y_head.CustomLabels.Clear();
|
_axis_y_head.CustomLabels.AddRange(labels.ToArray());
|
_axis_y_head.Visibility = DefaultBoolean.True;
|
_axis_y_head.GridLines.Visible = true;
|
}
|
|
//效率
|
if (_qe_pt_list != null)
|
{
|
//计算刻度
|
var labels = new List<CustomAxisLabel>();
|
var display_eff = _coordinate.CoordMinE + _coordinate.CoordSpaceE * _coordinate.StartLineNoE;
|
for (int i = _coordinate.StartLineNoE; i < _coordinate.EndLineNoE + 1; i++)
|
{
|
labels.Add(new CustomAxisLabel(display_eff.ToString(), display_eff));
|
display_eff = display_eff + _coordinate.CoordSpaceE;
|
}
|
|
_axis_y_eff.CustomLabels.Clear();
|
_axis_y_eff.CustomLabels.AddRange(labels.ToArray());
|
_axis_y_eff.Visibility = DefaultBoolean.True;
|
_axis_y_eff.GridLines.Visible = true;
|
}
|
|
//功率
|
if (_qp_pt_list != null)
|
{
|
//计算刻度
|
var labels = new List<CustomAxisLabel>();
|
double display_power = _coordinate.CoordMinP + _coordinate.CoordSpaceP * _coordinate.StartLineNoP;
|
for (int i = _coordinate.StartLineNoP; i < _coordinate.EndLineNoP + 1; i++)
|
{
|
labels.Add(new CustomAxisLabel(display_power.ToString(), display_power));
|
display_power = display_power + _coordinate.CoordSpaceP;
|
}
|
|
_axis_y_power.CustomLabels.Clear();
|
_axis_y_power.CustomLabels.AddRange(labels.ToArray());
|
_axis_y_power.Visibility = DefaultBoolean.True;
|
_axis_y_power.GridLines.Visible = true;
|
}
|
|
//是否分割面板:流量效率在上,功率在下
|
if (split_panel)
|
{
|
var grid_count_head = _coordinate.EndLineNoH - _coordinate.StartLineNoH;
|
var grid_count_eff = _coordinate.EndLineNoE - _coordinate.StartLineNoE;
|
int grid_count_add = Math.Max(grid_count_head, grid_count_eff) + 2;//多两条
|
|
var max_axis_head = _coordinate.CoordMinH + _coordinate.EndLineNoH * _coordinate.CoordSpaceH;
|
var min_axis_head = max_axis_head - grid_count_add * _coordinate.CoordSpaceH;
|
_axis_y_head.SetAxisRange(min_axis_head, max_axis_head);
|
|
var min_axis_eff = _coordinate.CoordMinE + _coordinate.StartLineNoE * _coordinate.CoordSpaceE;
|
var max_axis_eff = min_axis_eff + grid_count_add * _coordinate.CoordSpaceE;
|
_axis_y_eff.SetAxisRange(min_axis_eff, max_axis_eff);
|
|
var grid_count_power = _coordinate.EndLineNoP - _coordinate.StartLineNoP;
|
var min_axis_power = _coordinate.CoordMinP + _coordinate.StartLineNoP * _coordinate.CoordSpaceP;
|
var max_axis_power = min_axis_power + grid_count_power * _coordinate.CoordSpaceP;
|
_axis_y_power.SetAxisRange(min_axis_power, max_axis_power);
|
|
((SplineSeriesView)_series_power.View).Pane = _bottom_panel;
|
((SplineSeriesView)_series_power_wk.View).Pane = _bottom_panel;
|
if (series_equip_p_pt_view != null)
|
{
|
series_equip_p_pt_view.Pane = _bottom_panel;
|
}
|
|
}
|
else
|
{
|
_axis_x_flow.SetAxisRange(_coordinate.CoordMinQ, _coordinate.CoordMinQ + _coordinate.GridNumberX * _coordinate.CoordSpaceQ);
|
if ((_qe_pt_list == null || !_qe_pt_list.Any()) && (_qp_pt_list == null || !_qp_pt_list.Any()))
|
{
|
_axis_y_head.SetAxisRange(_coordinate.DispMinH(), _coordinate.DispMaxH());
|
}
|
else
|
{
|
_axis_y_head.SetAxisRange(_coordinate.CoordMinH, _coordinate.CoordMinH + _coordinate.GridNumberY * _coordinate.CoordSpaceH);
|
}
|
_axis_y_eff.SetAxisRange(_coordinate.CoordMinE, _coordinate.CoordMinE + _coordinate.GridNumberY * _coordinate.CoordSpaceE);
|
_axis_y_power.SetAxisRange(_coordinate.CoordMinP, _coordinate.CoordMinP + _coordinate.GridNumberY * _coordinate.CoordSpaceP);
|
|
|
((SplineSeriesView)_series_power.View).Pane = _diagram.DefaultPane;
|
((SplineSeriesView)_series_power_wk.View).Pane = _diagram.DefaultPane;
|
if (series_equip_p_pt_view != null)
|
{
|
series_equip_p_pt_view.Pane = _diagram.DefaultPane;
|
}
|
}
|
|
|
}
|
|
/// <summary>
|
/// 计算系列
|
/// </summary>
|
public void CalcSeries()
|
{
|
if (_qh_pt_list != null && _qh_pt_list.Count > 3)
|
{
|
_series_head.Visible = true;
|
_series_head.Points.Clear();
|
foreach (var pt in _qh_pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_head.Points.Add(series_pt);
|
}
|
}
|
else
|
{
|
_series_head.Points.Clear();
|
_series_head.Visible = false;
|
_query_flow_line.Visible = false;
|
_query_head_line.Visible = false;
|
_anno_txt_query_info.Visible = false;
|
|
_series_equip.Points.Clear();
|
_series_equip.Visible = false;
|
|
}
|
|
if (_qe_pt_list != null && _qe_pt_list.Count > 3)
|
{
|
_series_eff.Visible = true;
|
_series_eff.Points.Clear();
|
foreach (var pt in _qe_pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_eff.Points.Add(series_pt);
|
}
|
|
}
|
else
|
{
|
_series_eff.Points.Clear();
|
_series_eff.Visible = false;
|
}
|
|
if (_qp_pt_list != null && _qp_pt_list.Count > 3)
|
{
|
_series_power.Visible = true;
|
_series_power.Points.Clear();
|
foreach (var pt in _qp_pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_power.Points.Add(series_pt);
|
}
|
}
|
else
|
{
|
_series_power.Points.Clear();
|
_series_power.Visible = false;
|
}
|
|
if (_qh_wk != null && _qh_wk.IsValid())
|
{
|
_series_head_wk.Visible = true;
|
_series_head_wk.Points.Clear();
|
|
var pt_list = _qh_wk.GetPointList();
|
foreach (var pt in pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_head_wk.Points.Add(series_pt);
|
}
|
}
|
else
|
{
|
_series_head_wk.Points.Clear();
|
_series_head_wk.Visible = false;
|
}
|
|
if (_qe_wk != null && _qe_wk.IsValid())
|
{
|
_series_eff_wk.Visible = true;
|
_series_eff_wk.Points.Clear();
|
var pt_list = _qe_wk.GetPointList();
|
foreach (var pt in pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_eff_wk.Points.Add(series_pt);
|
}
|
}
|
else
|
{
|
_series_eff_wk.Points.Clear();
|
_series_eff_wk.Visible = false;
|
}
|
|
if (_qp_wk != null && _qp_wk.IsValid())
|
{
|
_series_power_wk.Visible = true;
|
_series_power_wk.Points.Clear();
|
var pt_list = _qp_wk.GetPointList();
|
foreach (var pt in pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_power_wk.Points.Add(series_pt);
|
}
|
}
|
else
|
{
|
_series_power_wk.Points.Clear();
|
_series_power_wk.Visible = false;
|
}
|
}
|
|
/// <summary>
|
/// 计算注释定位
|
/// </summary>
|
private void CalcTextAnchorPoint()
|
{
|
var x = this.chartControl1.Location.X + this.chartControl1.Width - (100);
|
var y = this.chartControl1.Height - (200);
|
|
(_anno_txt_query_info.AnchorPoint as ChartAnchorPoint).X = x;
|
(_anno_txt_query_info.AnchorPoint as ChartAnchorPoint).Y = y;
|
}
|
|
/// <summary>
|
/// 计算工作点
|
/// </summary>
|
/// <param name="workQ"></param>
|
public void CalcWorkPointByQ(double? workQ = null)
|
{
|
if (!_line_visible)
|
{
|
_query_flow_line.Visible = false;
|
_query_flow_line.Title.Visible = false;
|
_query_head_line.Visible = false;
|
_query_head_line.Title.Visible = false;
|
_anno_txt_query_info.Visible = false;
|
return;
|
}
|
else
|
{
|
_query_flow_line.Visible = true;
|
_query_flow_line.Title.Visible = true;
|
_query_head_line.Visible = true;
|
_query_head_line.Title.Visible = true;
|
_anno_txt_query_info.Visible = true;
|
}
|
if (_qh_pt_list == null || !_qh_pt_list.Any())
|
return;
|
|
var min_flow = _qh_pt_list.Min(x => x.X);
|
var max_flow = _qh_pt_list.Max(x => x.X);
|
if (_qh_wk != null)
|
{
|
min_flow = _qh_wk.MinX;
|
max_flow = _qh_wk.MaxX;
|
}
|
|
if (workQ == null)
|
{
|
workQ = min_flow;
|
//workQ = (min_flow + max_flow) / 2;
|
}
|
else
|
{
|
if (workQ < min_flow || workQ > max_flow)
|
return;
|
}
|
|
double flow, head, power = 0, eff = 0;
|
|
flow = workQ.Value;
|
if (_qh_wk != null)
|
{
|
head = _qh_wk.GetPointY(flow);
|
if (_qp_wk != null)
|
{
|
power = _qp_wk.GetPointY(flow);
|
}
|
if (_qe_wk != null)
|
{
|
eff = _qe_wk.GetPointY(flow);
|
}
|
}
|
else
|
{
|
head = _qh.GetPointY(flow);
|
|
if (_qp != null)
|
{
|
power = _qp.GetPointY(flow);
|
}
|
if (_qe != null)
|
{
|
eff = _qe.GetPointY(flow);
|
}
|
}
|
|
|
_work_point.Q = flow;
|
_work_point.H = head;
|
|
|
var workInfoStringBuilder = new StringBuilder();
|
workInfoStringBuilder.AppendLine($"流量:{_work_point.Q.ToString("N1")} ");
|
workInfoStringBuilder.AppendLine($"扬程:{_work_point.H.ToString("N1")} ");
|
if (_qe != null)
|
{
|
_work_point.E = eff;
|
workInfoStringBuilder.AppendLine($"效率:{_work_point.E.Value.ToString("N1")} ");
|
}
|
|
if (_qp != null)
|
{
|
_work_point.P = power;
|
workInfoStringBuilder.Append($"功率:{_work_point.P.Value.ToString("N1")} ");
|
}
|
|
|
_query_flow_line.AxisValue = _work_point.Q;
|
_query_flow_line.Title.Text = _work_point.Q.ToString("N1");
|
|
|
_query_head_line.AxisValue = _work_point.H;
|
_query_head_line.Title.Text = _work_point.H.ToString("N1");
|
|
//测试展示效果
|
_anno_txt_query_info.Text = workInfoStringBuilder.ToString();
|
_anno_txt_query_info.AutoSize = true;
|
|
if (OnCalcQueryPoint != null)
|
{
|
OnCalcQueryPoint(_work_point);
|
}
|
}
|
|
/// <summary>
|
/// 根据扬程计算工作点
|
/// </summary>
|
/// <param name="workH"></param>
|
public void CalcWorkPointByH(double workH)
|
{
|
if (!_line_visible)
|
return;
|
if (_qh == null)
|
return;
|
|
var min_head = _qh_pt_list.Min(x => x.Y);
|
var max_head = _qh_pt_list.Max(x => x.Y);
|
if (workH < min_head || workH > max_head)
|
return;
|
|
var workQ = _qh.GetPointY(workH);
|
CalcWorkPointByQ(workQ);
|
}
|
|
/// <summary>
|
/// 根据最大效率计算工作点
|
/// </summary>
|
public void CalcWorkPointByMaxE()
|
{
|
if (!_line_visible)
|
return;
|
if (_qe == null)
|
return;
|
var pt_list = _qe.GetPointList();
|
pt_list = pt_list.OrderBy(x => x.Y).ToList();
|
var workQ = pt_list.Last().X;
|
CalcWorkPointByQ(workQ);
|
}
|
|
/// <summary>
|
/// 根据最大流量计算工作点
|
/// </summary>
|
public void CalcWorkPointByMaxQ()
|
{
|
if (!_line_visible)
|
return;
|
if (_qh == null)
|
return;
|
var workQ = _qh.MaxX;
|
CalcWorkPointByQ(workQ);
|
}
|
|
/// <summary>
|
/// 设计点
|
/// </summary>
|
/// <param name="equip_pt_q"></param>
|
public void CalcDesignPointByQ(double? equip_pt_q = null, double? equip_pt_h = null)
|
{
|
_series_equip.Visible = true;
|
_series_equip.Points.Clear();
|
if (_series_equip_pt_list != null && _series_equip_pt_list.Any())
|
{
|
this.chartControl1.BeginInit();
|
foreach (var series in _series_equip_pt_list)
|
{
|
var exist_series = this.chartControl1.GetSeriesByName(series.Name);
|
if (exist_series != null)
|
{
|
this.chartControl1.Series.Remove(exist_series);
|
}
|
}
|
this.chartControl1.EndInit();
|
}
|
|
_series_equip_pt_list = new List<Series>();
|
if (_qh_pt_list == null || !_qh_pt_list.Any())
|
return;
|
if (equip_pt_q == null)
|
return;
|
|
|
var min_flow = _qh_pt_list.Min(x => x.X);
|
var max_flow = _qh_pt_list.Max(x => x.X);
|
|
if (equip_pt_q < min_flow || equip_pt_q > max_flow)
|
return;
|
|
double Q, H, E, P;
|
|
Q = equip_pt_q.Value;
|
if (equip_pt_h.HasValue)
|
{
|
H = equip_pt_h.Value;
|
}
|
else
|
{
|
H = _qh.GetPointY(Q);
|
}
|
|
_series_equip.Visible = _equip_visible;
|
var equip_pt = new Yw.Geometry.Point2d(Q, H);
|
var equip_paras = EquipCurveHelper.CalcEquipCurve(_qh, equip_pt, out Yw.Geometry.Point2d sect_pt);
|
if (equip_paras != null && equip_paras.EquipCurve != null)
|
{
|
var equip_pt_list = equip_paras.EquipCurve.GetPointList();
|
foreach (var pt in equip_pt_list)
|
{
|
var series_pt = new SeriesPoint(pt.X, pt.Y);
|
_series_equip.Points.Add(series_pt);
|
}
|
}
|
|
|
var design_qh_pt = CreatePointSeries(Pump.eCurveType.QH, sect_pt.X, sect_pt.Y);
|
_series_equip_pt_list.Add(design_qh_pt);
|
if (_qe != null)
|
{
|
E = _qe.GetPointY(Q);
|
var design_qe_pt = CreatePointSeries(Pump.eCurveType.QE, Q, E);
|
_series_equip_pt_list.Add(design_qe_pt);
|
}
|
|
if (_qp != null)
|
{
|
P = _qp.GetPointY(Q);
|
var design_qp_pt = CreatePointSeries(Pump.eCurveType.QP, Q, P);
|
_series_equip_pt_list.Add(design_qp_pt);
|
}
|
|
if (_qh_wk != null)
|
{
|
var equip_paras_wk = EquipCurveHelper.CalcEquipCurve(_qh_wk, equip_pt, out Yw.Geometry.Point2d sect_pt_wk);
|
if (sect_pt_wk != null)
|
{
|
var design_qh_wk_pt = CreatePointSeries(Pump.eCurveType.QH, sect_pt_wk.X, sect_pt_wk.Y);
|
_series_equip_pt_list.Add(design_qh_wk_pt);
|
Q = sect_pt_wk.X;
|
if (_qe_wk != null)
|
{
|
E = _qe_wk.GetPointY(Q);
|
var design_qe_pt = CreatePointSeries(Pump.eCurveType.QE, Q, E);
|
_series_equip_pt_list.Add(design_qe_pt);
|
}
|
|
if (_qp_wk != null)
|
{
|
P = _qp_wk.GetPointY(Q);
|
var design_qp_pt = CreatePointSeries(Pump.eCurveType.QP, Q, P);
|
_series_equip_pt_list.Add(design_qp_pt);
|
}
|
}
|
}
|
|
|
|
|
this.chartControl1.Series.AddRange(_series_equip_pt_list.ToArray());
|
}
|
|
/// <summary>
|
/// 创建点系列
|
/// </summary>
|
private Series CreatePointSeries(Yw.Pump.eCurveType curve_type, double x, double y)
|
{
|
string name = string.Empty;
|
Color color = Color.White;
|
AxisYBase axis_y = _axis_y_head;
|
|
switch (curve_type)
|
{
|
case Pump.eCurveType.QH:
|
{
|
name = "流量扬程设计点";
|
color = Perform2dChartDisplay.PointColorQH;
|
axis_y = _axis_y_head;
|
}
|
break;
|
case Pump.eCurveType.QE:
|
{
|
name = "流量效率设计点";
|
color = Perform2dChartDisplay.PointColorQE;
|
axis_y = _axis_y_eff;
|
|
}
|
break;
|
case Pump.eCurveType.QP:
|
{
|
name = "流量功率设计点";
|
color = Perform2dChartDisplay.PointColorQP;
|
axis_y = _axis_y_power;
|
}
|
break;
|
default:
|
break;
|
}
|
|
var series_point_view = new DevExpress.XtraCharts.PointSeriesView();
|
series_point_view.Color = color;
|
series_point_view.PointMarkerOptions.BorderColor = color;
|
series_point_view.PointMarkerOptions.Size = 12;
|
series_point_view.PointMarkerOptions.Kind = MarkerKind.Cross;
|
series_point_view.AxisY = axis_y;
|
|
x = Math.Round(x, 1);
|
y = Math.Round(y, 2);
|
var series_point = new DevExpress.XtraCharts.Series();
|
series_point.Tag = curve_type;
|
series_point.View = series_point_view;
|
series_point.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
series_point.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
series_point.Name = name;
|
series_point.ShowInLegend = false;
|
series_point.CrosshairEnabled = DefaultBoolean.False;
|
series_point.ShowInLegend = true;
|
series_point.SeriesPointsSorting = SortingMode.None;
|
series_point.SeriesPointsSortingKey = SeriesPointKey.Value_1;
|
series_point.Visible = _equip_visible;
|
series_point.Label.TextPattern = "{V:N1}";
|
series_point.CrosshairLabelVisibility = DefaultBoolean.False;
|
series_point.Points.Add(new SeriesPoint(x, new double[] { y }));
|
|
|
|
return series_point;
|
}
|
|
#endregion
|
|
#region ChartEvent
|
|
ToolTipController toolTip = new ToolTipController();
|
private void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e)
|
{
|
if (!_initial_data)
|
return;
|
if (e.AdditionalObject is SeriesPoint series_pt)
|
{
|
var tip = string.Format("X:{0:N1} Y:{1:N1}", series_pt.Argument, series_pt.Values[0]);
|
toolTip.ShowHint(tip);
|
}
|
else
|
{
|
toolTip.HideHint();
|
}
|
}
|
|
|
// 右键对象
|
private object _rightClickObj = null;
|
private bool _onMoveWorkPointLine = false;
|
private bool _onMoveWorkHLine = false;
|
private void chartControl1_MouseDown(object sender, MouseEventArgs e)
|
{
|
if (!_initial_data)
|
return;
|
var hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (e.Button == MouseButtons.Left)
|
{
|
if (hitInfo.InSeries)
|
{
|
_rightClickObj = hitInfo.Series;
|
|
}
|
else if (hitInfo.InAxis)
|
{
|
_rightClickObj = hitInfo.Axis;
|
}
|
else if (hitInfo.InConstantLine)
|
{
|
if (hitInfo.ConstantLine == _query_flow_line)
|
{
|
_onMoveWorkPointLine = true;
|
}
|
else if (hitInfo.ConstantLine == _query_head_line)
|
{
|
_onMoveWorkHLine = true;
|
}
|
}
|
else if (hitInfo.InAnnotation)
|
{
|
_rightClickObj = hitInfo.Annotation;
|
}
|
else
|
{
|
_rightClickObj = null;
|
}
|
}
|
else if (e.Button == MouseButtons.Right)
|
{
|
if (hitInfo.InConstantLine)
|
{
|
this.popMenuLine.ShowPopup(MousePosition);
|
}
|
else
|
{
|
this.popMenuChart.ShowPopup(MousePosition);
|
}
|
}
|
}
|
|
private void chartControl1_MouseMove(object sender, MouseEventArgs e)
|
{
|
if (!_initial_data)
|
return;
|
if (_onMoveWorkPointLine)
|
{
|
var diagramCoordinates = _diagram.PointToDiagram(e.Location);
|
var axisValue = diagramCoordinates.GetAxisValue(_axis_x_flow);
|
if (axisValue == null)
|
return;
|
double chartQ = axisValue.NumericalValue;
|
CalcWorkPointByQ(chartQ);
|
|
}
|
else if (_onMoveWorkHLine)
|
{
|
var diagramCoordinates = _diagram.PointToDiagram(e.Location);
|
var axisValue = diagramCoordinates.GetAxisValue(_axis_y_head);
|
if (axisValue == null)
|
return;
|
double chartH = axisValue.NumericalValue;
|
CalcWorkPointByH(chartH);
|
}
|
else
|
{
|
var hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InConstantLine)
|
{
|
this.chartControl1.Cursor = Cursors.Hand;
|
}
|
else if (hitInfo.InAnnotation)
|
{
|
this.chartControl1.Cursor = Cursors.SizeAll;
|
}
|
else
|
{
|
this.chartControl1.Cursor = Cursors.Default;
|
}
|
}
|
}
|
|
private void chartControl1_MouseUp(object sender, MouseEventArgs e)
|
{
|
if (!_initial_data)
|
return;
|
_onMoveWorkPointLine = false;
|
_onMoveWorkHLine = false;
|
}
|
|
private void chartControl1_Resize(object sender, EventArgs e)
|
{
|
CalcTextAnchorPoint();
|
}
|
|
#endregion
|
|
#region Right Click Menu
|
|
#region Event
|
private void barBtnSetAxisQValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
if (_qh_pt_list == null || !_qh_pt_list.Any())
|
return;
|
var dlg = new PumpAxisValueDlg();
|
dlg.SetBindingData();
|
dlg.VerifyValueChanged += (value) =>
|
{
|
var min = _qh_pt_list.Min(x => x.X);
|
var max = _qh_pt_list.Max(x => x.X);
|
if (value < min || value > max)
|
return false;
|
CalcWorkPointByQ(value);
|
return true;
|
};
|
dlg.ShowDialog();
|
}
|
|
private void barBtnSetAxisHValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
if (_qh_pt_list == null || !_qh_pt_list.Any())
|
return;
|
var dlg = new PumpAxisValueDlg();
|
dlg.SetBindingData();
|
dlg.Text = "扬程";
|
dlg.VerifyValueChanged += (value) =>
|
{
|
var min = _qh_pt_list.Min(x => x.Y);
|
var max = _qh_pt_list.Max(x => x.Y);
|
if (value < min || value > max)
|
return false;
|
CalcWorkPointByH(value);
|
return true;
|
};
|
dlg.ShowDialog();
|
}
|
|
private void barCekEqVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
_equip_visible = this.barCekEqVisible.Checked;
|
if (_series_equip != null)
|
{
|
_series_equip.Visible = _equip_visible;
|
}
|
if (_series_equip_pt_list != null && _series_equip_pt_list.Any())
|
{
|
foreach (var item in _series_equip_pt_list)
|
{
|
item.Visible = _equip_visible;
|
}
|
}
|
|
}
|
|
private void barBtnPositioningMaxQ_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
CalcWorkPointByMaxQ();
|
}
|
|
private void barBtnPositioningMaxE_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
CalcWorkPointByMaxE();
|
}
|
|
private void barCekDefinePointVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
//SetDefinePointVisible(this.barCekDefinePointVisible.Checked);
|
}
|
|
private void barCekLineVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
SetLineVisible(this.barCekLineVisible.Checked);
|
}
|
|
private void barCekLegendVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
SetLegendVisible(this.barCekLegendVisible.Checked);
|
}
|
|
private void barCekSetAxisNameVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
SetAxisNameVisible(this.barCekSetAxisNameVisible.Checked);
|
}
|
|
private void barCekSetSplitPanel_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
CalcChartAxis(this.barCekSetSplitPanel.Checked);
|
}
|
|
private void barCekChartDisplay_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
SetChartDisplay(this.barCekChartDisplay.Checked);
|
}
|
|
private void barBtnSetChartAxis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
SetChartAxis();
|
}
|
|
private void barBtnSetChartEquation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
XtraMessageBox.Show("待补充");
|
//SetChartEquation();
|
}
|
|
private void barBtnExportXls_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
ExportXls();
|
}
|
|
private void barBtnExportImage_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
{
|
ExportImage();
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
/// 设置工作点显示
|
/// </summary>
|
public void SetLineVisible(bool visible)
|
{
|
if (!_initial_data)
|
return;
|
LineVisible = visible;
|
CalcWorkPointByQ();
|
}
|
|
/// <summary>
|
/// 设置图例显示
|
/// </summary>
|
public void SetLegendVisible(bool visible)
|
{
|
this.chartControl1.Legend.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
/// <summary>
|
/// 设置轴名称显示
|
/// </summary>
|
public void SetAxisNameVisible(bool visible)
|
{
|
_axis_x_flow.Title.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False;
|
_axis_y_head.Title.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False;
|
_axis_y_eff.Title.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False;
|
_axis_y_power.Title.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
/// <summary>
|
/// 设置图表显示
|
/// </summary>
|
public void SetChartDisplay(bool monoColor)
|
{
|
if (monoColor)
|
{
|
this.chartControl1.SetChartMonoColorDisplay();
|
}
|
else
|
{
|
this.chartControl1.SetChartBackColor();
|
_axis_x_flow.SetAxisYQColorDisplay();
|
_axis_y_head.SetAxisYQHColorDisplay(_series_head, null, true);
|
_axis_y_eff.SetSecondaryAxisYQEColorDisplay(_series_eff, null, true);
|
_axis_y_power.SetSecondaryAxisYQPColorDisplay(_series_power, null, true);
|
}
|
}
|
|
|
/// <summary>
|
/// 设置坐标轴
|
/// </summary>
|
public void SetChartAxis()
|
{
|
var dlg = new PumpChartCoordinateDlg();
|
var onlyQH = _qe == null && _qp == null;
|
dlg.SetBindingData(_coordinate, onlyQH);
|
dlg.OnChangedCoord += (rhs) =>
|
{
|
_coordinate = rhs;
|
CalcChartAxis(this.barCekSetSplitPanel.Checked);
|
this.OnCurveCoordinateChanged?.Invoke(_coordinate);
|
};
|
dlg.ShowDialog();
|
}
|
|
///// <summary>
|
///// 曲线方程
|
///// </summary>
|
//public void SetChartEquation()
|
//{
|
// var dlg = new CurveEquationDlg();
|
// dlg.SetBindingData(_qh, _qe, _qp);
|
// dlg.ShowDialog();
|
//}
|
|
/// <summary>
|
/// 导出Excel
|
/// </summary>
|
public void ExportXls()
|
{
|
Perform2dExportHelper.ExportXLS(_qh, _qe, _qp, 12);
|
}
|
|
/// <summary>
|
/// 导出图片
|
/// </summary>
|
public void ExportImage()
|
{
|
var dlg = new SaveFileDialog();
|
dlg.Filter = "jpg 图片(*.jpg)|*.jpg";
|
if (dlg.ShowDialog() != DialogResult.OK)
|
return;
|
this.chartControl1.ExportToImage(dlg.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
|
}
|
|
|
#endregion
|
|
|
|
}
|
}
|