private void OnTimerTick(double m1Power, double m1Frequency, double m2Power, double m2Frequency) { if (m1TestingEnabled) { if (Program.settings.M1Unit == "V/m") { m1TextBoxPower.Text = m1Power.ToString("0.000 V/m"); } else { m1TextBoxPower.Text = m1Power.ToString("0.000000 mW/m²"); } m1TextBoxFrequency.Text = m1Frequency.ToString("0.0 Mhz"); if (FrequencyAnalyzer.AnalyzeFrequency(m1Frequency, out FrequencySource source, out Operator sourceOperator)) { if (sourceOperator == null) { m1TextBoxFrequencySource.Text = source.name; } else { m1TextBoxFrequencySource.Text = $"{source.name} ({sourceOperator.name})"; } } else { m1TextBoxFrequencySource.Text = ""; } }
private void AddPoint(Series serie, DataPointCollection points, string unit, string serieName, double power, double frequency, ref FrequencySource lastSource) { string legendText = serieName; FrequencySource source = null; Operator sourceOperator = null; if (power > 0.0) { if (unit != "V/m") { power = Math.Pow(power * 0.377, 0.5); } legendText += $"\nIntensité : {power.ToString("0.000 V/m")}"; if (frequency > 0.0) { legendText += $"\nFréquence : {frequency.ToString("0.0 Mhz")}"; if (FrequencyAnalyzer.AnalyzeFrequency(frequency, out source, out sourceOperator)) { legendText += $"\n{source.name}"; if (Program.settings.GraphicShowOperator && sourceOperator != null) { legendText += $" ({sourceOperator.name})"; } } } serie.LegendText = legendText; int ptIdx = points.AddY(power); if (source != null) { if (source != lastSource) { lastSource = source; if (lastLabelDistance > 5) { lastLabelDistance = 0; string label = " \n"; // fix background being too small label += source.name; if (Program.settings.GraphicShowOperator && sourceOperator != null) { label += $"\n ({ sourceOperator.name})"; } label += $"\n{frequency.ToString("0 Mhz")}"; label += "\n "; // fix background being too small points[ptIdx].Label = label; } } } else { if (lastLabelDistance > 10) { lastSource = null; } } } else { points.AddY(-10.0); } }