copy from androidplot, for source code research purpose only.