Example #1
0
        private void DrawData(DynamicStatistic.PlotPoints data, Color color, PointFunc func, bool isRect)
        {
            using (var pen = new Pen(color))
                using (var brush = new SolidBrush(color))
                {
                    for (int n = 0; n < data.Count; ++n)
                    {
                        var f = data.First();
                        var l = data.Last();

                        var d = l.Item2.Subtract(f.Item2).Ticks;

                        var prev = f;
                        foreach (var p in data)
                        {
                            var pp = func(data, p, d);
                            G.DrawLine(pen, func(data, prev, d), pp);

                            if (isRect)
                            {
                                G.FillRectangle(brush, pp.X - 6 / 2, pp.Y - 6 / 2, 6, 6);
                            }
                            else
                            {
                                G.FillEllipse(brush, pp.X - 7 / 2, pp.Y - 7 / 2, 7, 7);
                            }

                            prev = p;
                        }
                    }
                }
        }
Example #2
0
        private void DrawLabel(DynamicStatistic.PlotPoints data, Color color)
        {
            var font = new Font("Tahoma", 6.5f, FontStyle.Bold);

            G.TextRenderingHint = TextRenderingHint.AntiAlias;
            using (var brush = new SolidBrush(color))
            {
                G.DrawString(new DateTime(data.Last().Item2.Subtract(data.First().Item2).Ticks).ToString("HH:mm:ss") + " / " + Converter.DoubleToText(data.Last().Item1, "N4") + " %", font, brush, AxisOffset * 3, Height - AxisOffset - 20);
            }
        }
Example #3
0
        private void Vanish(DynamicStatistic.PlotPoints data, PointFunc func)
        {
            int vanishArea = 16;

            if (data.Count > 10)
            {
                var pointsToRemove = new List <DynamicStatistic.PlotPoint>();
                var time           = data.Last().Item2.Subtract(data.First().Item2);

                for (int i = 0; i < data.Count * 0.8; ++i)
                {
                    var d  = data.Last().Item2.Subtract(data.First().Item2).Ticks;
                    var p0 = func(data, data[i], d);
                    var p2 = func(data, data[i + 2], d);

                    if ((Math.Abs(p0.X - p2.X) < vanishArea && Math.Abs(p0.Y - p2.Y) < vanishArea))
                    {
                        pointsToRemove.Add(data[i + 1]);
                        //i += 2;
                    }
                    else
                    {
                        var p1 = func(data, data[i + 1], d);
                        if ((p0.X == p1.X && p1.X == p2.X) || (p0.Y == p1.Y && p1.Y == p2.Y))
                        {
                            pointsToRemove.Add(data[i + 1]);
                            //i += 2;
                        }
                    }
                }

                foreach (var p in pointsToRemove)
                {
                    data.Remove(p);
                }
            }
        }