Prevent stacked graphs from selecting when no model is selected

Equivalent to 3240392c769ac522dbc15eae42a71393d32e434f but for stacks as well as lines.