private void AddCharts() { if (this.InvokeRequired) { var d = new SafeCallAddCharts(AddCharts); Invoke(d, new object[] { }); } else { int index = 0; foreach (I_MR_Chart chart in listOfCharts) { this.Controls.Remove(chart.chart_I); this.Controls.Remove(chart.label_LastValue); } listOfCharts.Clear(); foreach (int dimensionId in sqlDataSet.DimensionsIds) { I_MR_Chart myChart = new I_MR_Chart(index, dimensionId); this.Controls.Add(myChart.chart_I); this.Controls.Add(myChart.label_LastValue); listOfCharts.Add(myChart); index++; } } }
private void Update_I_MR_Chart(I_MR_Chart chart) { if (chart.chart_I.InvokeRequired) { var d = new SafeCallUpdateIMRChart(Update_I_MR_Chart); Invoke(d, new object[] { chart }); } else { I_MR_List yValues = sqlDataSet.Values(chart.DimensionId); decimal lastValue = Math.Round(sqlDataSet.LastValue(chart.DimensionId), 3); bool lastValueIsOk = sqlDataSet.LastValueIsOk; chart.UpdateChart(yValues, lastValue, lastValueIsOk); } }