The WGAutoAxes function can only be used inside the charts graph building routine. Using it outside, as you have tried, will fail.
There is group of WGReAutoAxes... routines, that take exisiting axis handles, and rescale the graph based on a new dataset. See the manual for details.