Convert chartOffset from function to static variable