Determine the max value in LinearUnit dynamically

The range between min and max should always be divisable by the amount of
ticks, to ensure that the vertical lines are always at a full discrete value.

fixes #6769