using DevExpress.XtraEditors;
|
using IStation.Untity;
|
using System.Collections.Generic;
|
using System.Drawing;
|
|
namespace IStation.WinFrmUI.Basic
|
{
|
public partial class MultiCurveDlg : XtraForm
|
{
|
public MultiCurveDlg()
|
{
|
InitializeComponent();
|
IconOptions.Icon = WinFrmUI.Properties.Resources.App;
|
multiCurveExpressChart1.CurveNameVisible = true;
|
// this.multiCurveExpressChart1.SetLegendVisible(true);
|
dataLayoutControl1.SetupLayoutControl();
|
}
|
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Model.PumpCurveExMapping model)
|
{
|
if (model == null)
|
return;
|
var curveInfo = model.CurveInfo;
|
var color = GetRandomColor(0);
|
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;
|
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
|
|
|
}
|
}
|