Just use the TGraph constructors and if you really then need a histogram follow the step in this conversation