Reimplement Chart::paint() to fix printing issues
The implementation has been taken from AbstractArea::paintIntoRectArea()
and fixes incorrect header and footer locations.
See https://phabricator.kde.org/D19541 for details on differences compared
with the previous implementation.
CCBUG:405075