DRY up creation of JSON string

The former used self.data which is always undefined because the object uses
seires_data instead. layout_helper knew about this but high_chart did not?

Anyway, DRY the logic so it isn't repeated which fixes this problem.