Shuxia Ning
2024-12-04 bbcdd8088ee3efb8b24e4aa422a918a4d21b5750
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
using DevExpress.Utils;
using DevExpress.Utils.Drawing;
using DevExpress.XtraCharts;
 
namespace Yw.WinFrmUI.Phart
{
    /// <summary>
    ///  泵变速视图图表
    /// </summary>
    public partial class PumpVariableSpeedViewChart : DevExpress.XtraEditors.XtraUserControl
    {
        public PumpVariableSpeedViewChart()
        {
            InitializeComponent();
            InitialChart();
            this.chartControl1.RuntimeHitTesting = true;
        }
 
        #region Private Variable 
 
        private readonly string _tag_qh = "QH", _tag_qe = "QE", _tag_qp = "QP";
 
        private XYDiagram _diagram;
        private XYDiagramDefaultPane _default_pane;
        private XYDiagramPane _bottom_pane;
        private AxisX _axis_x_flow;
        private AxisY _axis_y_head;
        private SecondaryAxisY _axis_y_eff, _axis_y_power;
 
        private PumpCoordinate _coordinate;
 
        private bool _qe_visible = true;
        private bool _qp_visible = true;
 
        private bool _run_visible = true; 
 
        private bool _initial_data = false;
 
        private PumpVariableSpeedViewViewModel _vm = null;
 
        #endregion
 
        #region Public Evnet
 
        /// <summary>
        /// 坐标变换事件
        /// </summary>
        public event Action<PumpCoordinate> CoordinateChangedEvent = null;
 
        #endregion
 
        #region Initial
 
        /// <summary>
        /// 初始化图表
        /// </summary>
        private void InitialChart()
        {
            this.chartControl1.SetChartDisplay();
            this.chartControl1.Legend.Direction = DevExpress.XtraCharts.LegendDirection.TopToBottom;
 
            _diagram = (XYDiagram)this.chartControl1.Diagram;
            _default_pane = _diagram.DefaultPane;
            _bottom_pane = (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_eff.Alignment = AxisAlignment.Far;
            _axis_y_power = _diagram.SecondaryAxesY.GetAxisByName("AxisYQP");
            _axis_y_power.SetSecondaryAxisYQPDisplay();
 
            this.chartControl1.SetChartMonoColorDisplay(); 
 
            _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;
 
 
            this.chartControl1.CustomPaint += ChartControl1_CustomPaint;
        }
 
        private void ChartControl1_CustomPaint(object sender, CustomPaintEventArgs e)
        {
            if (e is not DXCustomPaintEventArgs dxArgs)
                return;
            if (_vm == null)
                return;
 
            if (_vm.Items!=null&&_vm.Items.Any()&& _run_visible)
            {
                using Pen pen = new(Color.Black, 2);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
                foreach (var vm in _vm.Items)
                {
                    var color = vm.Color;
                    var flow = vm.Q;
                    var head = vm.H;
                    var eff = vm.E;
                    var power = vm.P;
                    DrawWorkPoint(dxArgs.Cache, color, _axis_y_head, flow, head);
                    if (eff.HasValue && _qe_visible)
                        DrawWorkPoint(dxArgs.Cache, color, _axis_y_eff, flow, eff.Value);
                    if (power.HasValue && _qp_visible)
                        DrawWorkPoint(dxArgs.Cache, color, _axis_y_power, flow, power.Value);
                }
                 
            }
        }
         
 
        private void DrawWorkPoint(GraphicsCache cache, Color color, AxisYBase axis_y, double x, double y)
        {
            var dg_pt = _diagram.DiagramToPoint(x, y, _axis_x_flow, axis_y);
            cache.FillEllipse((int)(dg_pt.Point.X - 5), (int)(dg_pt.Point.Y - 5), 10, 10, color);
        }
         
        /// <summary>
        /// 初始化图表数据
        /// </summary>
        public void InitialChartData()
        {
            _initial_data = false;
            _coordinate = null;
 
            UpdateChart(false);
        }
 
        #endregion
 
        #region Set   
 
        /// <summary>
        /// 绑定数据
        /// </summary> 
        public void SetBindingData(PumpVariableSpeedViewViewModel vm)
        {
            _vm = vm;
            _initial_data = vm != null;
            UpdateChart(true);
        }
 
      
        /// <summary>
        /// 清空曲线
        /// </summary> 
        public void Clear()
        {
            _vm = null;
            _initial_data = false;
            UpdateChart(true);
        }
 
        /// <summary>
        /// 更新图表
        /// </summary>
        public void UpdateChart(bool calc_coordinate = false)
        {
            if (calc_coordinate || _coordinate == null)
            {
                //不强迫计算,就用上次更新的坐标系
                CalcCoordinate();
            }
 
            CalcSeries();
 
            CalcChartAxis();
        }
 
        #endregion
 
        #region Calc 
 
        private double _min_flow, _max_flow;
        private double _max_head = 0, _min_head = 10000;
        private double _max_eff = 0, _min_eff = 0;
        private double _max_power = 0, _min_power = 1000;
 
        /// <summary>
        /// 计算坐标
        /// </summary>
        private void CalcCoordinate()
        {
            if (_vm == null)
            {
                //设置成白板坐标
                _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;
            }
 
            _max_flow = 0; _min_flow = 10000;
            _max_head = 0; _min_head = 10000;
            _max_eff = 0; _min_eff = 0;
            _max_power = 0; _min_power = 1000;
 
            double _scaleMinH = 1, _scaleMaxH = 1;
 
            {
                var qh_pt_list = _vm.CurveQH.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());
            }
 
            if (_vm.CurveQE != null)
            {
                var qe_pt_list = _vm.CurveQE.GetPointList();
                var yyy = qe_pt_list.Select(x => x.Y);
                _min_eff = Math.Min(_min_eff, yyy.Min());
                _max_eff = Math.Max(_max_eff, yyy.Max());
            }
            if (_vm.CurveQP != null)
            {
                var yyy = _vm.CurveQP.GetPointList().Select(x => x.Y);
                _min_power = Math.Min(_min_power, yyy.Min());
                _max_power = Math.Max(_max_power, yyy.Max());
            }
 
            if (_vm.Items != null && _vm.Items.Any())
            {
 
                foreach (var vm in _vm.Items)
                {
                    {
                        var qh_pt_list = vm.CurveQH.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());
                    }
 
                    if (vm.CurveQE != null)
                    {
                        var qe_pt_list = vm.CurveQE.GetPointList();
                        var yyy = qe_pt_list.Select(x => x.Y);
                        _min_eff = Math.Min(_min_eff, yyy.Min());
                        _max_eff = Math.Max(_max_eff, yyy.Max());
                    }
                    if (vm.CurveQP != null)
                    {
                        var yyy = vm.CurveQP.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>
        private void CalcChartAxis()
        {
            _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;
 
 
            _bottom_pane.Visibility = ChartElementVisibility.Hidden;
            _bottom_pane.Visibility = _qp_visible ? ChartElementVisibility.Visible : ChartElementVisibility.Hidden;
 
            //计算刻度 Q
            var axisQLabels = new List<CustomAxisLabel>();
            var disQ = _coordinate.CoordMinQ;
            for (int i = 0; i < _coordinate.GridNumberX + 1; i++)
            {
                axisQLabels.Add(new CustomAxisLabel(disQ.ToString("N0"), disQ));
                disQ = disQ + _coordinate.CoordSpaceQ;
            }
 
            _axis_x_flow.CustomLabels.Clear();
            _axis_x_flow.CustomLabels.AddRange(axisQLabels.ToArray());
            _axis_x_flow.Visibility = DefaultBoolean.True;
            _axis_x_flow.GridLines.Visible = true;
 
 
            //计算刻度
            var axis_head_labels = new List<CustomAxisLabel>();
            var display_head = _coordinate.CoordMinH + _coordinate.CoordSpaceH * _coordinate.StartLineNoH;
            for (int i = _coordinate.StartLineNoH; i < _coordinate.EndLineNoH + 1; i++)
            {
                axis_head_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(axis_head_labels.ToArray());
            _axis_y_head.Visibility = DefaultBoolean.True;
            _axis_y_head.GridLines.Visible = true;
 
            //效率
            if (_max_eff > _min_eff && _qe_visible)
            {
                //计算刻度
                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 (_max_power > _min_power && _qp_visible)
            {
                //计算刻度
                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;
            }
 
            var min_flow = _coordinate.CoordMinQ;
            var max_flow = _coordinate.DispMaxQ();
            _axis_x_flow.SetAxisRange(min_flow, max_flow);
 
            var grid_count_head = _coordinate.EndLineNoH - _coordinate.StartLineNoH;
            var grid_count_eff = _coordinate.EndLineNoE - _coordinate.StartLineNoE;
            int grid_count_up = Math.Max(grid_count_head, grid_count_eff);
            if (_qe_visible)
            {
                grid_count_up += 2;//多两条
            }
 
            var max_axis_head = _coordinate.CoordMinH + _coordinate.EndLineNoH * _coordinate.CoordSpaceH;
            var min_axis_head = max_axis_head - grid_count_up * _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_up * _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);
        }
 
        /// <summary>
        /// 计算系列
        /// </summary>
        private void CalcSeries()
        {
            this.chartControl1.BeginInit();
            this.chartControl1.Series.Clear();
            this.chartControl1.AnnotationRepository.Clear();
            this.chartControl1.Legend.CustomItems.Clear();
 
            if (_vm != null)
            {
                _vm.Color = RandomColorHelper.Get(0);
                CreateLineSeries(_vm.Id, _vm.Color, _vm.Name, _vm.CurveQH, _vm.CurveQE, _vm.CurveQP);
                if (_vm.Items != null && _vm.Items.Any())
                {
                    for (int i = 0; i < _vm.Items.Count; i++)
                    {
                        var vm = _vm.Items[i];
                        vm.Color = RandomColorHelper.Get(i + 1);
                        CreateLineSeries(vm.Id, vm.Color, vm.CurveName, vm.CurveQH, vm.CurveQE, vm.CurveQP);
                    }
                }
 
            }
 
            this.chartControl1.EndInit(); 
        }
 
 
        /// <summary>
        /// 创建线系列
        /// </summary> 
        private void CreateLineSeries(string id, Color color, string curve_name, Yw.Geometry.CubicSpline2d qh, Yw.Geometry.CubicSpline2d qe, Yw.Geometry.CubicSpline2d qp)
        {
            var series_qh = new DevExpress.XtraCharts.Series();
            series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
            series_qh.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
            series_qh.Name = _tag_qh + id;
            series_qh.ShowInLegend = false;
            series_qh.CrosshairEnabled = DefaultBoolean.False;
            series_qh.LegendTextPattern = curve_name;
 
 
            var series_qh_view = new DevExpress.XtraCharts.SplineSeriesView();
            series_qh_view.LineStyle.Thickness = 2;
            series_qh_view.Color = color;
            series_qh_view.EnableAntialiasing = DefaultBoolean.True;
            series_qh_view.LineTensionPercent = 50;
 
            series_qh.SeriesPointsSorting = SortingMode.None;
            series_qh.SeriesPointsSortingKey = SeriesPointKey.Value_1;
            series_qh.View = series_qh_view;
            series_qh.Visible = true;
 
            var pt_qh_list = qh.GetPointList(12);
            for (int i = 0; i < pt_qh_list.Count; i++)
            {
                series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y }));
            }
 
            var point_qh = pt_qh_list[pt_qh_list.Count() - 1];
            var anchor_qh_pt = new DevExpress.XtraCharts.PaneAnchorPoint();
            anchor_qh_pt.Pane = _default_pane;
            anchor_qh_pt.AxisXCoordinate.AxisValue = point_qh.X.ToString();
            anchor_qh_pt.AxisYCoordinate.AxisValue = point_qh.Y.ToString();
 
            var position_qh = new DevExpress.XtraCharts.RelativePosition();
            position_qh.Angle = -50;
            position_qh.ConnectorLength = 10;
 
            var txt_qh = new TextAnnotation();
            txt_qh.Border.Visibility = DefaultBoolean.False;
            txt_qh.AnchorPoint = anchor_qh_pt;
            txt_qh.AutoHeight = true;
            txt_qh.AutoWidth = true;
            txt_qh.BackColor = System.Drawing.Color.Transparent;
            txt_qh.Border.Color = color;
            txt_qh.ConnectorStyle = DevExpress.XtraCharts.AnnotationConnectorStyle.Line;
            txt_qh.DXFont = PumpChartDisplay.AnnoFontQH;
            txt_qh.Name = _tag_qh + id;
            txt_qh.Padding.Bottom = 1;
            txt_qh.Padding.Left = 1;
            txt_qh.Padding.Right = 1;
            txt_qh.Padding.Top = 1;
            txt_qh.RuntimeAnchoring = false;
            txt_qh.RuntimeMoving = true;
            txt_qh.RuntimeResizing = false;
            txt_qh.RuntimeRotation = false;
            txt_qh.Text = curve_name;
            txt_qh.TextColor = color;
            txt_qh.ShapePosition = position_qh;
            txt_qh.Visible = true;
            this.chartControl1.AnnotationRepository.Add(txt_qh);
            this.chartControl1.Series.Add(series_qh);
 
            if (qe != null)
            {
                var series_qe = new DevExpress.XtraCharts.Series();
                series_qe.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
                series_qe.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
                series_qe.Name = _tag_qe + id;
                series_qe.ShowInLegend = false;
                series_qe.CrosshairEnabled = DefaultBoolean.False;
                series_qe.Tag = id;
 
                var series_qe_view = new DevExpress.XtraCharts.SplineSeriesView();
                series_qe_view.LineStyle.Thickness = 2;
                series_qe_view.Color = color;
                series_qe_view.AxisY = _axis_y_eff;
                series_qe_view.Pane = _default_pane;
                series_qe_view.EnableAntialiasing = DefaultBoolean.True;
                series_qe_view.LineTensionPercent = 50;
 
                series_qe.SeriesPointsSorting = SortingMode.None;
                series_qe.SeriesPointsSortingKey = SeriesPointKey.Value_1;
                series_qe.View = series_qe_view;
                series_qe.Visible = _qe_visible;
 
                var pt_qe_list = qe.GetPointList(12);
                for (int i = 0; i < pt_qe_list.Count; i++)
                {
                    series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y }));
                }
 
                this.chartControl1.Series.Add(series_qe);
            }
 
            if (qp != null)
            {
                var series_qp = new DevExpress.XtraCharts.Series();
                series_qp.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
                series_qp.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
                series_qp.Name = _tag_qp + id;
                series_qp.ShowInLegend = false;
                series_qp.CrosshairEnabled = DefaultBoolean.False;
                series_qp.Tag = id;
 
                var series_qp_view = new DevExpress.XtraCharts.SplineSeriesView();
                series_qp_view.LineStyle.Thickness = 2;
                series_qp_view.Color = color;
                series_qp_view.AxisY = _axis_y_power;
                series_qp_view.Pane = _bottom_pane;
                series_qp_view.EnableAntialiasing = DefaultBoolean.True;
                series_qp_view.LineTensionPercent = 50;
 
                series_qp.SeriesPointsSorting = SortingMode.None;
                series_qp.SeriesPointsSortingKey = SeriesPointKey.Value_1;
                series_qp.View = series_qp_view;
                series_qp.Visible = _qp_visible;
 
                var pt_qp_list = qp.GetPointList(12);
                for (int i = 0; i < pt_qp_list.Count; i++)
                {
                    series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y }));
                }
 
                this.chartControl1.Series.Add(series_qp);
            }
 
        }
 
 
        #endregion
 
 
 
        #region Right Click Menu 
 
        #region Event
 
        private void barBtnSetChartAxis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SetChartAxis();
        }
 
        private void barCekCurveQEVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _qe_visible = this.barCekCurveQEVisible.Checked;
            UpdateChart();
        }
 
        private void barCekCurveQPVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _bottom_pane.Visibility = _bottom_pane.Visibility == ChartElementVisibility.Visible ? ChartElementVisibility.Hidden : ChartElementVisibility.Visible;
            _qp_visible = _bottom_pane.Visibility == ChartElementVisibility.Visible ? true : false;
            UpdateChart();
        }
 
        private void barCekCurveEQVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            _run_visible = this.barCekCurveEQVisible.Checked;
        }
 
        #endregion
 
 
        /// <summary>
        /// 设置坐标轴
        /// </summary>
        public void SetChartAxis()
        {
            var dlg = new PumpChartCoordinateDlg();
            dlg.SetBindingData(_coordinate);
            dlg.OnChangedCoord += (rhs) =>
            {
                _coordinate = rhs;
                CalcChartAxis();
                this.CoordinateChangedEvent?.Invoke(_coordinate);
            };
            dlg.ShowDialog();
        }
 
        #endregion
 
 
 
 
    }
 
}