Fixed corner case in chart building logic.

Didn't consider case when there is only datapoint. The endpoint wouldn't be set.