change [-1] to .last
formalise data class that will be use by chartto represent its data