Set the width and height of legend based on the current graph dimensions
Set the width and height of legend based on the current graph dimensions