You don't need to monitor the changes with an event, since you want to take readings no matter if the value has changed or not. In your particular case a simple FOR loop is sufficient because you know the number of readings in advance. One problem I see is the fact that 300 is not divisible by 40, so one of the numbers need to be tweaked. (Could ot be you actually want to measure every 40
ms for 300
s for a total of 7500 readings? This seems more reasonable!)
The simplest code would be a FOR loop containing the terminal of your knob wired to a waveform chart and a diagram constant with the desired loop rate in ms wired to a "wait next ms" node. The "loop count" should receive 8 or 7500 or whatever number of points you desire. This provides
basic functionality (see attached image).
Add some trimmings as needed: Clear the chart before entering the loop, use a WHILE loop instead of a FOR loop and add some controls to prematurely interrupt the process, etc..