Add graph legend folding support