add data sample and fixed bug on xScale function