Your best bet at this point is to update the graph from only one thread. You can have the thread generate data, but when it comes time to updating the data on the graph, you can post a message to the main dialog and perform the graph operation from there. Using SendMessage will ensure that the message handler fires in the same thread that created the dialog.
See this
document for how to set this up.
You can switch the graph instantiation back to singlethreaded to avoid any additional overhead, since now you will be accessing the graph from a single thread.
Unfortunately MFC does not provide any kind of thread safe queue. I'm not sure how your application is ultimately going to be setup, but if you need a TSQ, I found a good example of one
here.
This should get you up and running for now.
Sorry about the incovienience.
Bilal Durrani
NI