Better positioning of chart titles

The title positioning algorithm is now based on position: relative
instead of margins