using Yw.WinFrmUI.Phart;
|
|
namespace HStation.WinFrmUI.PhartRelation
|
{
|
public partial class PumpWorkComparisonChartDlg : XtraForm
|
{
|
public PumpWorkComparisonChartDlg()
|
{
|
InitializeComponent();
|
this.Text = "曲线视图";
|
this.WindowState = FormWindowState.Maximized;
|
this.pumpWorkingChart.SetQeVisible(false);
|
}
|
|
private Yw.Geometry.Point2d _design_pt;
|
|
private List<Yw.WinFrmUI.Phart.PumpWorkInfoViewModel> _vm_list = null;
|
|
|
|
// <summary>
|
/// 设置
|
/// </summary>
|
public string SetBindingData( List<Yw.WinFrmUI.Phart.PumpWorkViewModel> list )
|
{
|
if (list == null || !list.Any())
|
{
|
return "数据为空!";
|
}
|
|
var vm_list = new List<Yw.WinFrmUI.Phart.PumpWorkInfoViewModel>();
|
for (int i = 0; i < list.Count; i++)
|
{
|
var x = list[i];
|
var vm = new Yw.WinFrmUI.Phart.PumpWorkInfoViewModel(x);
|
vm.Name= $"{vm.CurrentSpeed}({vm.CurrentHz}hz)";
|
vm.Color = GetRandomColor(i);
|
vm.Calc();
|
vm_list.Add(vm);
|
}
|
|
this.pumpWorkingChart.Add(vm_list);
|
return string.Empty;
|
}
|
|
#region Color
|
|
private List<Color> _color_array = 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 < _color_array.Count)
|
{
|
return _color_array[count];
|
}
|
|
var _random = new Random();
|
int r = _random.Next(1, 256);
|
int g = _random.Next(1, 256);
|
int b = _random.Next(1, 256);
|
return Color.FromArgb(r, g, b);
|
}
|
|
#endregion
|
}
|
}
|