Your Isolation Transformer and Charger/Inverter should be at least 3 feet from your compass - further being better.
and Iron objects, as well as electric
circuits close to the compass may cause magnetic Deviation.
As skipmac indicates magnetic fields follow an inverse-square law near the magnet, but follow an inverse cubed law further away; so that the field becomes exponentially weaker as separation increases. As Bill indicates, it’s the magnetic core
of the Transformer that causes magnetic Deviation (just like your engine
block), not the effects of rapidly reversing Alternating Current
You cannot practically (see posts 6 & 7)
shield against static magnetic fields, such as those caused by a magnetic mass (above).
RF shielding is possible to mitigate the electro-magnetic (radiation) effects generated by Direct Current wiring
. The easiest method is to simply twist the (2) DC wires, effectively cancelling the generated fields.