Overall, that should get you going if the application is not too demanding. In general, it is considered bad form to grow and shrink arrays in a loop, especially as in your case where it would grow forever without user intervention. This can lead to performance issues.
Some suggestions:
(1) Use a chart insted of a graph and set the history length to an appropriate value.
(2) Initialize with a fixed size array, e.g. filled with zeroes or "NaN" as appropriate. Then use "replace array subset" to add new data, replacing the old while keeping track of the insertion point. Since the array size is constant, performance will be much better.