Exemplo n.º 1
0
        void AddChartPoint(DataPointCollection chartPoints, Double value)
        {
            chartPoints.AddY(value);

            if (chartPoints.Count > MAX_GRAPH_VALUES)
                chartPoints.RemoveAt(0);
        }
Exemplo n.º 2
0
        void AddChartPoint(DataPointCollection chartPoints, Double value)
        {
            chartPoints.AddY(value);

            if (chartPoints.Count > MAX_GRAPH_VALUES)
            {
                chartPoints.RemoveAt(0);
            }
        }
Exemplo n.º 3
0
        public void Add(double data)
        {
            if (this.chart.Series[0].Points == null)
            {
                return;
            }

            DataPointCollection points = this.chart.Series[0].Points;

            points.AddY(data);

            int count = points.Count;
            int num   = count - this.bufferSize;

            for (int i = 0; i < num; i++)
            {
                points.RemoveAt(0);
            }

            this.chart.Invalidate();
        }
Exemplo n.º 4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            double[] buf = sgSet.ReadL502();
            prstat("buf=" + (buf == null ? "null" : buf.Length.ToString()));
            chart1.SuspendLayout();
            chart1.Series.SuspendUpdates();
            chart1.ChartAreas.SuspendUpdates();
            Clear();
            int packets = buf.Length / 6;

            for (int p = 0; p < packets; p++)
            {
                mpI.AddY(buf[p * 6]);
                mpU.AddY(buf[p * 6 + 1]);
                mpB.AddY(buf[p * 6 + 2]);
                mpD0.AddY(buf[p * 6 + 3]);
                mpD1.AddY(buf[p * 6 + 4]);
                mpD2.AddY(buf[p * 6 + 5]);
            }
            chart1.Series.ResumeUpdates();
            chart1.ChartAreas.ResumeUpdates();
            chart1.ResumeLayout();
        }
Exemplo n.º 5
0
 /// <summary>Adds a System.Windows.Forms.DataVisualization.Charting.DataPoint object to the end of the collection, with the specified Y-value(s).</summary>
 /// <param name="dataPointCollection">The System.Windows.Forms.DataVisualization.Charting.DataPointCollection instance to add a DataPoint to.</param>
 /// <param name="yValue">A comma-separated list of Y-value(s) of the System.Windows.Forms.DataVisualization.Charting.DataPoint object added to the collection.</param>
 /// <returns>The new System.Windows.Forms.DataVisualization.Charting.DataPoint object.</returns>
 public static DataPoint AddYDataPoint(this DataPointCollection dataPointCollection, params object[] yValue)
 {
     return(dataPointCollection[dataPointCollection.AddY(yValue)]);
 }
Exemplo n.º 6
0
 /// <summary>Adds a System.Windows.Forms.DataVisualization.Charting.DataPoint object to the end of the collection, with the specified Y-value.</summary>
 /// <param name="dataPointCollection">The System.Windows.Forms.DataVisualization.Charting.DataPointCollection instance to add a DataPoint to.</param>
 /// <param name="yValue">The Y-value of the data point.</param>
 /// <returns>The new System.Windows.Forms.DataVisualization.Charting.DataPoint object.</returns>
 public static DataPoint AddYDataPoint(this DataPointCollection dataPointCollection, double yValue)
 {
     return(dataPointCollection[dataPointCollection.AddY(yValue)]);
 }
Exemplo n.º 7
0
        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);
            }
        }