Refactor build custom tooltip to jinja
Made things less broken.
Better refactoring and added the piechart.