예제 #1
0
        public void DrawOneSide(Samples samples, Graphics gr, Rectangle bounds, bool normalize = false)
        {
            var kx = bounds.Width / samples.Values.Length;
            var ky = bounds.Height;
            var cy = bounds.Bottom;
            var cx = bounds.Left;

            var values = samples.Values;
            if (normalize)
            {
                var s = samples.Clone();
                s.Normalize();
                values = s.Values;
            }

            using (var pen = new Pen(ForeColor))
            for (int i = 0; i < values.Length; i++)
            {
                var x = i * kx;
                var y = values[i];
                if (y > 1) y = 1;
                if (y < -1) continue;
                y = y * ky;
                gr.DrawLine(pen, cx + x, cy, cx + x, cy - y);
            }
        }