Separated logic for determining boundarties of chart into separate function.