Don't believe you can do what your trying to. There isn't any trigger event that occurs to even allow a macro to run.
As an alternative, what you've described sounds like you've got two charts per gender. Presumably the charts are the same, except for using an expression or dimension differently. Could you instead have one Bar and one Pivot chart, and use an input box / variable to allow user to choose whether to show Male or Female and then in the dimension / expression and any title's / captions use an expression to calculate the result for that gender.