added graph generation on the fly (gets slow on 2000 values)