The production of charmonium in heavy-ion collisions is investigated based on Boltzmann-type transport model for charmonium evolution and langevin equation for charm quark evolution. Charmonium suppression and regeneration in both quark-gluon plasma (QGP) and hadron phase are considered. Charm quarks are far from thermalization, and regeneration of charmonium in QGP and hadron gas is neglectable at SPS and FAIR. At peripheral collisions, charmonium suppression with hadron gas explains the experimental data well. But at central collisions, additional suppression from deconfined matter (QGP) is necessary for the data. This means there should be QGP produced at central collisions, and no QGP produced at peripheral collisions at SPS energy. Predictions are also made at FAIR $\sqrt{s_{NN}}=7.7$ GeV Au+Au collisions.