| | |
| | | private TextAnnotation _const_txt_annotation; |
| | | |
| | | private PumpCoordinate _coordinate = null; |
| | | |
| | | private PumpCurveViewModel _vm = null; |
| | | |
| | | private bool _default_visible = false; |
| | |
| | | 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(); |
| | | } |
| | | //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 void ChartControl1_CustomPaint(object sender, CustomPaintEventArgs e) |
| | | { |
| | | if (!_initial_data) |
| | | return; |
| | | if (_vm == null) |
| | | return; |
| | | if (e is not DXCustomPaintEventArgs dx_args) |
| | | return; |
| | | var cache = dx_args.Cache; |
| | | cache.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; |
| | | |
| | | if (_vm.EqualEffList != null && _vm.EqualEffList.Any()) |
| | | { |
| | | using Pen pen = new(Color.Green, 2); |
| | | foreach (var eq_eff in _vm.EqualEffList) |
| | | { |
| | | var eq_eff_pt_list = eq_eff.CurveEqualEff; |
| | | if (!eq_eff.IsValid()) |
| | | continue; |
| | | var pic_eq_eff_pt_list = eq_eff_pt_list.Select(x => |
| | | { |
| | | var pt = _diagram.DiagramToPoint(x.X, x.Y, _axis_x_flow, _axis_y_head).Point; |
| | | return pt; |
| | | }).ToList(); |
| | | var pt_count = pic_eq_eff_pt_list.Count; |
| | | |
| | | // ç»å¶ |
| | | if (pt_count > 2) |
| | | { |
| | | if (eq_eff.IsClosed) |
| | | { |
| | | var path = cache.CreatePath(); |
| | | path.AddClosedCurve(pic_eq_eff_pt_list.ToArray(), (float)eq_eff.Tension); |
| | | cache.DrawPath(pen, path); |
| | | } |
| | | else |
| | | { |
| | | var path = cache.CreatePath(); |
| | | path.AddCurve(pic_eq_eff_pt_list.ToArray(), (float)eq_eff.Tension); |
| | | cache.DrawPath(pen, path); |
| | | } |
| | | } |
| | | else if (pt_count == 2) |
| | | { |
| | | cache.DrawLine(pen, pic_eq_eff_pt_list[0], pic_eq_eff_pt_list[1]); |
| | | } |
| | | else if (pt_count == 1) |
| | | { |
| | | Rectangle rc = new Rectangle(pic_eq_eff_pt_list[0].X - 2, pic_eq_eff_pt_list[0].Y - 2, 4, 4); |
| | | using (Brush b = new SolidBrush(pen.Color)) |
| | | cache.FillEllipse(b, rc); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | XYDiagramPaneBase bottom_pane = _split_panel ? _bottom_pane : _default_pane; |
| | | |
| | | AddLineSeries(id, color_qh, _axis_x_flow, _axis_y_head, _default_pane, qh, DashStyle.Dash); |
| | | AddLineSeries(id, color_qh, _axis_x_flow, _axis_y_head, _default_pane, qh, DevExpress.XtraCharts.DashStyle.Dash); |
| | | if (!string.IsNullOrEmpty(caption_qh)) |
| | | AddAnnotation(id, caption_qh, color_qh, _axis_y_head, _default_pane, qh.Last()); |
| | | |
| | | if (qe != null && qe.Any() && _eff_visible) |
| | | { |
| | | AddLineSeries(id, color_qe, _axis_x_flow, _axis_y_eff, _default_pane, qe, DashStyle.Dash); |
| | | AddLineSeries(id, color_qe, _axis_x_flow, _axis_y_eff, _default_pane, qe, DevExpress.XtraCharts.DashStyle.Dash); |
| | | } |
| | | |
| | | if (qp != null && qp.Any() && _power_visible) |
| | | { |
| | | AddLineSeries(id, color_qp, _axis_x_flow, _axis_y_power, bottom_pane, qp, DashStyle.Dash); |
| | | AddLineSeries(id, color_qp, _axis_x_flow, _axis_y_power, bottom_pane, qp, DevExpress.XtraCharts.DashStyle.Dash); |
| | | if (!string.IsNullOrEmpty(caption_qp)) |
| | | { |
| | | AddAnnotation(id, caption_qp, color_qp, _axis_y_power, bottom_pane, qp.Last()); |
| | |
| | | var equip = vm.CurveEquip; |
| | | var equip_pt = new Yw.Geometry.Point2d(vm.PipeQ, vm.PipeH); |
| | | |
| | | AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equip, DashStyle.DashDotDot); |
| | | AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equip, DevExpress.XtraCharts.DashStyle.DashDotDot); |
| | | AddPointSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, new List<Geometry.Point2d>() { equip_pt }); |
| | | if (!string.IsNullOrEmpty(caption)) |
| | | AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equip.Last()); |
| | |
| | | var color = vm.Color ?? Color.Green; |
| | | |
| | | var equif_eff = vm.CurveEqualEff; |
| | | if (equif_eff.Count < 2) |
| | | { |
| | | AddPointSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equif_eff); |
| | | } |
| | | else |
| | | { |
| | | AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equif_eff, DashStyle.Dash); |
| | | } |
| | | if (!string.IsNullOrEmpty(caption)) |
| | | { |
| | | if (equif_eff.Count > 2) |
| | | { |
| | | AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equif_eff.First(), 60); |
| | | } |
| | | AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equif_eff.Last(), 60); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private void AddEqualPowerList(List<PumpCurveEqualPowerViewModel> vm_list) |
| | |
| | | view.EmptyPointOptions.Color = Color.Transparent; |
| | | view.Pane = pane; |
| | | |
| | | |
| | | var series_pt_list = pt_list.Select(x => x.ToSeriesPoint()).ToArray(); |
| | | var series = new DevExpress.XtraCharts.Series(); |
| | | series.Tag = id; |
| | |
| | | this.chartControl1.Series.Add(series); |
| | | } |
| | | |
| | | private void AddLineSeries(string id, Color color, AxisXBase axis_x, AxisYBase axis_y, XYDiagramPaneBase pane, List<Yw.Geometry.Point2d> pt_list, DashStyle dash = DashStyle.Solid) |
| | | private void AddLineSeries(string id, Color color, AxisXBase axis_x, AxisYBase axis_y, XYDiagramPaneBase pane, List<Yw.Geometry.Point2d> pt_list, DevExpress.XtraCharts.DashStyle dash = DevExpress.XtraCharts.DashStyle.Solid) |
| | | { |
| | | if (pt_list == null || !pt_list.Any()) |
| | | return; |
| | |
| | | } |
| | | |
| | | _bottom_pane.Visibility = ChartElementVisibility.Hidden; |
| | | |
| | | } |
| | | |
| | | } |