kcms/energy: Refactor the Graph code
A set of code refactoring in the Graph component.
Rearrange the code blocks to bring related parts closer, so it's easier to remove intermediate or unused properties and generally simplify the code about:
- drawing the main line of the graph
- generating the details text
- calculate the x-axis tick marks
- work with time spans directly in seconds
Also fix some remaining code style issues.
Edited by Ismael Asensio