| | |
| | | namespace Yw.WinFrmUI.Phart |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | public partial class ValveEditChart : DevExpress.XtraEditors.XtraUserControl |
| | | { |
| | |
| | | private ValveCoordinate _coordinate; |
| | | private bool _initial_data = false; |
| | | |
| | | |
| | | #endregion |
| | | #endregion Private Variable |
| | | |
| | | #region Public Evnet |
| | | |
| | |
| | | |
| | | public event Action<List<Yw.Geometry.Point2d>> OnDefinePointChanged; |
| | | |
| | | #endregion |
| | | #endregion Public Evnet |
| | | |
| | | #region Initial |
| | | |
| | |
| | | |
| | | _diagram = (XYDiagram)chartControl1.Diagram; |
| | | |
| | | |
| | | _axis_x_flow = _diagram.AxisX; |
| | | _axis_x_flow.SetAxisXQDisplay(); |
| | | _axisYQL = _diagram.AxisY; |
| | | _axisYQL.SetAxisYQLDisplay(); |
| | | |
| | | |
| | | _seriesCurveQL = this.chartControl1.GetSeriesByName("SeriesCurveQL"); |
| | | _seriesCurveQL.SetCurveQLDisplay(); |
| | | |
| | | |
| | | _seriesPointQL = this.chartControl1.GetSeriesByName("SeriesPointQL"); |
| | | _seriesPointQL.SetPointQLDisplay(); |
| | | |
| | | |
| | | _axis_x_flow.Visibility = DefaultBoolean.False; |
| | | _axis_x_flow.GridLines.Visible = false; |
| | | _axisYQL.Visibility = DefaultBoolean.False; |
| | | _axisYQL.GridLines.Visible = false; |
| | | |
| | | |
| | | _seriesPointQL.Visible = false; |
| | | |
| | | |
| | | this.chartControl1.SetChartMonoColorDisplay(); |
| | | |
| | | |
| | | 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.KeyUp += new System.Windows.Forms.KeyEventHandler(this.chartControl1_KeyUp); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 初始化图表数据 |
| | |
| | | UpdateChart(false); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Initial |
| | | |
| | | #region SetBindingData |
| | | |
| | |
| | | |
| | | List<Yw.Geometry.Point2d> pt_ql_list; |
| | | |
| | | pt_ql_list = cubic_spline_ql.GetPointList(12); |
| | | pt_ql_list = cubic_spline_ql.GetPointList(100); |
| | | |
| | | SetBindingData(pt_ql_list, pt_ql_list, coordinate_paras, calc_coordinate); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | UpdateChart(calc_coordinate); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion SetBindingData |
| | | |
| | | #region Update |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新曲线 |
| | | /// </summary> |
| | | /// <param name="curve_type"></param> |
| | | /// <param name="curve_type"></param> |
| | | /// <param name="fit_point_list"></param> |
| | | public void UpdateCurve(List<Yw.Geometry.Point2d> fit_point_list) |
| | | { |
| | |
| | | CalcSeries(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Update |
| | | |
| | | #region Calc |
| | | |
| | |
| | | _axisYQL.GridLines.Visible = true; |
| | | } |
| | | |
| | | |
| | | _axis_x_flow.SetAxisRange(_coordinate.CoordMinQ, _coordinate.CoordMinQ + _coordinate.GridNumberX * _coordinate.CoordSpaceQ); |
| | | _axisYQL.SetAxisRange(_coordinate.DispMinL(), _coordinate.DispMaxL()); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | _seriesCurveQL.Visible = false; |
| | | } |
| | | |
| | | |
| | | if (_def_pt_ql_list != null && _def_pt_ql_list.Any()) |
| | | { |
| | | _seriesPointQL.Points.Clear(); |
| | |
| | | { |
| | | _seriesPointQL.Visible = false; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Calc |
| | | |
| | | #region ChartEvent |
| | | #region ChartEvent |
| | | |
| | | private bool _mouseMode = false;//鼠标模式 |
| | | private SeriesPoint _pickPoint = null;// 选中点 |
| | | private SeriesPoint _pickPoint = null;// 选中点 |
| | | |
| | | private void chartControl1_MouseDown(object sender, MouseEventArgs e) |
| | | { |
| | | if (!_initial_data) |
| | |
| | | this.popMenuChart.ShowPopup(MousePosition); |
| | | } |
| | | } |
| | | |
| | | private void chartControl1_MouseMove(object sender, MouseEventArgs e) |
| | | { |
| | | if (!_initial_data) |
| | |
| | | return; |
| | | _pickPoint.Values[0] = axisValue.NumericalValue; |
| | | _pickPoint.NumericalArgument = diagramCoordinates.NumericalArgument; |
| | | |
| | | } |
| | | |
| | | private void chartControl1_MouseUp(object sender, MouseEventArgs e) |
| | | { |
| | | if (!_initial_data) |
| | |
| | | ChartUpdateCurve(); |
| | | } |
| | | } |
| | | |
| | | private void chartControl1_KeyUp(object sender, KeyEventArgs e) |
| | | { |
| | | if (!_initial_data) |
| | |
| | | CalcChartAxis(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion ChartEvent |
| | | |
| | | #region Right Click Menu |
| | | #region Right Click Menu |
| | | |
| | | #region Event |
| | | |
| | | #region Event |
| | | |
| | | private void barCekChartEditMode_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | CalcCoordinate(); |
| | | CalcChartAxis(); |
| | | } |
| | | |
| | | private void barCekLegendVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetLegendVisible(this.barCekLegendVisible.Checked); |
| | |
| | | SetAxisNameVisible(this.barCekSetAxisNameVisible.Checked); |
| | | } |
| | | |
| | | |
| | | |
| | | private void barBtnSetChartAxis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetChartAxis(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion Event |
| | | |
| | | /// <summary> |
| | | /// 设置图例显示 |
| | |
| | | _axisYQL.Title.Visibility = visible ? DefaultBoolean.True : DefaultBoolean.False; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置坐标轴 |
| | | /// </summary> |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | #endregion Right Click Menu |
| | | } |
| | | } |
| | | } |