calculate chart width and height relative to container width and height