You can't retrieve data from the graph once it has been plotted. It is decimated for display by the graph and the original data is not kept by the graph. So, you would have to maintain the data in a variable in your program and you can write it when ever you want. The Data Logger example writes the data to the buffer each time a Data Acquired event is fired. It can be setup to keep appending the data to the file or overwrite the data with each acquired buffer.
If you don't want to write the data on every Data Acquired event, you don't have to, but you do have to keep a variable with the historic data available for logging when you want to log.
Best Regards,
Chris Matthews
National Instruments