public ClusterComponent(List <PowerFrequency>[] cpf, TimeSlot ts) { InitializeComponent(); this.VisibleGrp = new List <MetroFramework.Controls.MetroCheckBox>() { this.Visible1, this.Visible2, this.Visible3, this.Visible4, this.Visible5, this.Visible6, this.Visible7, this.Visible8 }; int startHours = 0; for (int p = 0; p < cpf.Length; p++) { ChartValues <ObservablePoint> cv = new ChartValues <ObservablePoint>(); cpf[p].ForEach((pp) => { cv.Add(new ObservablePoint(pp.wh, pp.frequency)); }); LineSeries ls = new LineSeries { Title = string.Format("Cluster {0}~{1}h Power Frequency", startHours, startHours + TimeSlotUtils.TimeSlotToHours(ts)), Values = cv }; this.ClusterChart.Series.Add(ls); this.VisibleGrp[p].Text = string.Format("{0}~{1}h", startHours, startHours += TimeSlotUtils.TimeSlotToHours(ts)); this.VisibleGrp[p].Checked = true; this.VisibleGrp[p].Click += Visible_Toggled; this.VisibleContainer.Controls.Add(this.VisibleGrp[p]); } }
public void ConfigChart(List <PowerFrequency>[] pf, double maxWh, TimeSlot ts) { this.Invoke((System.Action)(() => { int startHours = 0; for (int p = 0; p < pf.Length; p++) { ChartValues <ObservablePoint> cv = new ChartValues <ObservablePoint>(); // cv.Add(new ObservablePoint(0, 0)); pf[p].ForEach((pp) => { cv.Add(new ObservablePoint(pp.wh, pp.frequency)); }); /* * if (pf[p][pf[p].Count() - 1].wh < maxWh) * cv.Add(new ObservablePoint(maxWh, 0)); */ LineSeries ls = new LineSeries { Title = string.Format("{0}~{1}h Power Frequency", startHours, startHours + TimeSlotUtils.TimeSlotToHours(ts)), Values = cv }; this.Chart.Series.Add(ls); this.VisibleGroup[p].Checked = true; this.VisibleGroup[p].Text = string.Format("{0}~{1}h", startHours, startHours += TimeSlotUtils.TimeSlotToHours(ts)); this.CheckBoxContainer.Controls.Add(this.VisibleGroup[p]); } })); }
public DataComponent(string uid, List <PowerFrequency>[] pf, TimeSlot ts) { InitializeComponent(); this.Text = uid; int startHours = 0; for (int p = 0; p < pf.Length; p++) { ChartValues <ObservablePoint> cv = new ChartValues <ObservablePoint>(); // cv.Add(new ObservablePoint(0, 0)); pf[p].ForEach((pp) => { cv.Add(new ObservablePoint(pp.wh, pp.frequency)); }); LineSeries ls = new LineSeries { Title = string.Format(uid + " {0}~{1}h Power Frequency", startHours, startHours += TimeSlotUtils.TimeSlotToHours(ts)), Values = cv }; this.DataChart.Series.Add(ls); } }