Global Variable not able to be accessed in function?
The problem is that this is not an Arduino Sketch, but a processing file which is noted by the initial import statement that is Java based. Because the Arduino IDE is not very sophisticated, it didn't shout out obvious errors such as import type not defined or even ThresholdGraph not defined. 

To use this file it is necessary to use the following IDE: https://processing.org/reference/environment/