public void FillChart(double x, double y, double z) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.chart1.InvokeRequired) { FillChartCallback d = new FillChartCallback(FillChart); this.Invoke(d, new object[] { x, y, z }); } else { FillChartIntern(x, y, z); } }
private void DrawAnalyser() { try { if (chartAnalyser.InvokeRequired) { FillChartCallback test = new FillChartCallback(DrawAnalyser); chartAnalyser.Invoke(test, new object[] { }); } else { chartAnalyser.Series["Analysis Graph"].Points.Clear(); chartAnalyser.Series["Points of Interest"].Points.Clear(); if (CombinedScannerData.Count != 0) { for (int i = 0; i < CombinedScannerData?.Count; i++) { chartAnalyser.Series["Analysis Graph"].Points.AddXY(CombinedScannerData[i].Item1, CombinedScannerData[i].Item2); } } if (ReducedPointsofInterest != null) { for (int i = 0; i < ReducedPointsofInterest?.Count; i++) { chartAnalyser.Series["Points of Interest"].Points.AddXY(ReducedPointsofInterest[i].Item1, ReducedPointsofInterest[i].Item2); } } } } catch (Exception ex) { LogFiler.Log(Category.Error, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": " + ex.Message); } }