adding functionality to auto-adjust chart height