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(); } /// /// 绑定数据 /// 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 ColorArray = new List() { Color.Red, Color.Blue, Color.Green, Color.DodgerBlue, Color.Fuchsia, Color.MidnightBlue, Color.Maroon, Color.Aquamarine, Color.Bisque, Color.BurlyWood }; /// /// 获取随机颜色 /// /// private Color GetRandomColor(int count) { if (count < ColorArray.Count) { return ColorArray[count]; } return ColorHelper.GetRandomColor(); } #endregion } }