MSChart update blocks worker thead
<p>I am using the Microsoft Chart library from .NET. I am attempting to plot data which is being generated every 10ms from hardware. This usually works fine except when I move the main form. Then updating the chart blocks the worker thread. Please see attached code as an example with simulated data.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;

namespace ChartTest
{
    public partial class Form1 : Form
    {
        private Worker _worker;
        double oldData;

        public Form1()
        {
            InitializeComponent();
            oldData = 0.0;
            _worker = new Worker();
            _worker.NewDataEvent += new EventHandler(_worker_NewDataEvent);
        }

        void _worker_NewDataEvent(object sender, EventArgs e)
        {
            double data = _worker.GetData();
            Add(data - oldData);
            oldData = data;
        }

        private delegate void AddDelegate(double data);

        public void Add(double data)
        {
            if (chart1.InvokeRequired)
            {
                chart1.Invoke(new AddDelegate(Add), data);
            }
            else
            {
                chart1.Series[0].Points.AddY(data);
            }
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            _worker.Start();
        }
    }

    public class Worker
    {
        private double data;
        Stopwatch st;
        bool running;

        public Worker()
        {
            data = 0.0;
            st = new Stopwatch();
            running = false;
        }

        public event EventHandler NewDataEvent;

        public void Start()
        {
            running = true;
            Thread t = new Thread(Run);
            t.Start();
        }

        private void Run()
        {
            st.Start();
            while (running)
            {
                Thread.Sleep(10);
                data = (double)st.ElapsedTicks / (double)Stopwatch.Frequency;
                NewDataEvent(this, null);
            }
        }

        public double GetData()
        {
            return data;
        }
    }
}
</code></pre>

<p>Note: I can provide designer code if necessary.</p>

<p>The Worker class runs a thread which generates some data every 10 ms. It raises an event which Form1 uses to invoke an update in the chart. This is generally fine unless something delays the UI rendering, such as dragging the Form. This is problematic if the worker's Run() function is time-critical. Is there a way to update the chart as fast as possible without blocking the thread? </p>

<p>If this means sometimes it takes the chart 20 ms to update, that is fine. I would just like it to update as fast as possible. Thanks.</p>
