create graph in directive scope