refactored class DrawGraph