Shuxia Ning
2025-02-13 2f1cbec203dcff25df7a5c2b51b13ec558f2c3db
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
using DevExpress.XtraEditors;
using IStation.Untity;
using System.Collections.Generic;
using System.Drawing;
using System.Xml.Linq;
 
namespace IStation.WinFrmUI.Basic
{
    public partial class MultiCurveDlg : XtraForm
    {
        public MultiCurveDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = WinFrmUI.Properties.Resources.App;
            this.multiCurveExpressChart1.CurveNameVisible = true;
            //  this.multiCurveExpressChart1.SetLegendVisible(true);
            this.dataLayoutControl1.SetupLayoutControl();
        }
 
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Model.PumpCurveExMapping model)
        {
            if (model == null)
                return;
            var curveInfo = model.CurveInfo;
            var color = GetRandomColor(0);
            this.multiCurveExpressChart1.AddCurve(model.ID, model.OtherName, curveInfo.CurveQH,
                curveInfo.CurveQE, curveInfo.CurveQP, color);
 
 
            var speedCurves = new BLL.PumpSpeedCurve().GetByPumpCurveID(model.ID);
            if (speedCurves == null || speedCurves.Count < 1)
                return;
            for (int i = 0; i < speedCurves.Count; i++)
            {
                var count = i + 1;
                var speedCurveColor = GetRandomColor(count);
                var speedCurve = speedCurves[i];
                var speedCurveInfo = speedCurve.CurveInfo;
                this.multiCurveExpressChart1.AddCurve(speedCurve.ID, speedCurve.HZ + "hz", speedCurveInfo.CurveQH,
         speedCurveInfo.CurveQE, speedCurveInfo.CurveQP, speedCurveColor);
            }
        }
 
 
 
 
        #region Color
 
        private List<Color> ColorArray = new List<Color>()
        { Color.Red, Color.Blue, Color.Green, Color.DodgerBlue,
            Color.Fuchsia, Color.MidnightBlue, Color.Maroon,
            Color.Aquamarine, Color.Bisque, Color.BurlyWood
        };
 
        /// <summary>
        /// 获取随机颜色
        /// </summary>
        /// <returns></returns>
        private Color GetRandomColor(int count)
        {
            if (count < ColorArray.Count)
            {
                return ColorArray[count];
            }
 
            return ColorHelper.GetRandomColor();
        }
        #endregion
 
 
    }
}