public NormalizingPlotter(NPlot.Windows.PlotSurface2D plotSurface, TimeSpan displayPeriod)
            : base(plotSurface)
        {
            this.DisplayPeriod = displayPeriod;
            HeartRate heartRate = HeartRate.Instance;

            NormalizerFilter normalizerFilter = new NormalizerFilter(TimeSpan.FromSeconds(1.5));
            LightStoneDevice.Instance.RawHeartSignalOutput.Add(normalizerFilter);

            int bufferSize = (int)(m_DisplayPeriod.Ticks / LightStoneDevice.SamplingInterval.Ticks);
            m_PointBuffer = TimeSpanBuffer<double>.Synchronized(m_DisplayPeriod, bufferSize);
            normalizerFilter.Output.Add(m_PointBuffer);

            this.PlotSurface.Clear();

            m_LinePlot = new LinePlot();
            m_LinePlot.Pen = new Pen(Color.Red, 2.0f);
            this.PlotSurface.Add(m_LinePlot);

            this.PlotSurface.XAxis1 = new DateTimeAxis(this.PlotSurface.XAxis1);
            this.PlotSurface.XAxis1.NumberFormat = "hh:mm:ss";

            this.PlotSurface.Title = "Normalized Heart Signal";
            this.PlotSurface.XAxis1.Label = "Time";
            this.PlotSurface.YAxis1.Label = "Magnitude";

            Refresh();
        }
		protected override void OnCreateControl()
		{
			if (!this.DesignMode)
			{
				InitializeFromIsolatedStorage();

				int bufferSize = (int)(this.DisplayPeriod.Ticks / m_Resolution.Ticks);
				m_ValuesBuffer = TimeSpanBuffer<double[]>.Synchronized(this.DisplayPeriod, bufferSize);
				//TempFillBuffer();

				m_DataReceiver = new DataReceiver("COM7");
				//m_DataReceiver.NewDataReceived += new EventHandler<DataReceivedEventArgs>(OnNewDataReceived);
				m_DataReceiver.LineReceived += new EventHandler<LineReceivedEventArgs>(OnLineReceived);

				m_PlotSurface2D.Clear();
				InitializeLinePlots(new Color[] {Color.Red, Color.Blue});
				//InitializeLinePlots(new Color[] { Color.Red });

				m_PlotSurface2D.XAxis1 = new DateTimeAxis(m_PlotSurface2D.XAxis1);
				m_PlotSurface2D.XAxis1.NumberFormat = "mm:ss";

				m_PlotSurface2D.Title = "Tilt Values";
				m_PlotSurface2D.XAxis1.Label = "Time";
				m_PlotSurface2D.YAxis1.Label = "Magnitude";

				RefreshGraph();

				StartTimer(100);
			}
			base.OnCreateControl();
		}
        protected override void OnCreateControl()
        {
            if (!this.DesignMode)
            {
                InitializeFromIsolatedStorage();

                int bufferSize = (int)(this.DisplayPeriod.Ticks / m_Resolution.Ticks);
                m_ValuesBuffer = TimeSpanBuffer <double[]> .Synchronized(this.DisplayPeriod, bufferSize);

                //TempFillBuffer();

                m_DataReceiver = new DataReceiver("COM7");
                //m_DataReceiver.NewDataReceived += new EventHandler<DataReceivedEventArgs>(OnNewDataReceived);
                m_DataReceiver.LineReceived += new EventHandler <LineReceivedEventArgs>(OnLineReceived);

                m_PlotSurface2D.Clear();
                InitializeLinePlots(new Color[] { Color.Red, Color.Blue });
                //InitializeLinePlots(new Color[] { Color.Red });

                m_PlotSurface2D.XAxis1 = new DateTimeAxis(m_PlotSurface2D.XAxis1);
                m_PlotSurface2D.XAxis1.NumberFormat = "mm:ss";

                m_PlotSurface2D.Title        = "Tilt Values";
                m_PlotSurface2D.XAxis1.Label = "Time";
                m_PlotSurface2D.YAxis1.Label = "Magnitude";

                RefreshGraph();

                StartTimer(100);
            }
            base.OnCreateControl();
        }
        protected override void OnCreateControl()
        {
            if (!this.DesignMode)
            {
                HeartRate heartRate = HeartRate.Instance;

                int initialBufferSize = (int)base.DisplayPeriod.TotalSeconds * 60;
                m_PointBuffer = TimeSpanBuffer<TimeSpan>.Synchronized(base.DisplayPeriod, initialBufferSize);
                HeartRate.Instance.RRIntervalOutput.Add(m_PointBuffer);

                base.PlotSurface.Clear();

                m_LinePlot = new LinePlot();
                m_LinePlot.Pen = new Pen(Color.Red, 2.0f);
                base.PlotSurface.Add(m_LinePlot);

                base.PlotSurface.XAxis1 = new DateTimeAxis(base.PlotSurface.XAxis1);
                base.PlotSurface.XAxis1.NumberFormat = "mm:ss";

                base.PlotSurface.Title = "R-R Interval Over Time";
                base.PlotSurface.XAxis1.Label = "Time";
                base.PlotSurface.YAxis1.Label = "R-R [msec]";

                RefreshGraph();

                base.StartTimer(200);
            }
            base.OnCreateControl();
        }
        protected override void OnCreateControl()
        {
            if (!this.DesignMode)
            {
                HeartRate heartRate = HeartRate.Instance;

                NormalizerFilter normalizerFilter = new NormalizerFilter(TimeSpan.FromSeconds(1.5));
                LightStoneDevice.Instance.RawHeartSignalOutput.Add(normalizerFilter);

                int bufferSize = (int)(this.DisplayPeriod.Ticks / LightStoneDevice.SamplingInterval.Ticks);
                m_PointBuffer = TimeSpanBuffer<double>.Synchronized(this.DisplayPeriod, bufferSize);
                normalizerFilter.Output.Add(m_PointBuffer);

                base.PlotSurface.Clear();

                m_LinePlot = new LinePlot();
                m_LinePlot.Pen = new Pen(Color.Red, 2.0f);
                base.PlotSurface.Add(m_LinePlot);

                base.PlotSurface.XAxis1 = new DateTimeAxis(base.PlotSurface.XAxis1);
                base.PlotSurface.XAxis1.NumberFormat = "mm:ss";

                base.PlotSurface.Title = "Normalized Heart Signal";
                base.PlotSurface.XAxis1.Label = "Time";
                base.PlotSurface.YAxis1.Label = "Magnitude";

                RefreshGraph();

                base.StartTimer(100);
            }
            base.OnCreateControl();
        }