Refactor draw_graph method in prawn_renderer to make it less complex