To include showgraphs, just use
require_once 'path_to_file'; - then you'll be able to do anything inside the file.
If, however, the showgraphs php is run at the same time as existing stats, globalize the value through $GLOBALS and use it that way.
If all else fails, just re-query it. Duplicating code isn't necessarily a bad thing.