Optical frequency combs, which emit pulses of light at discrete, equally spaced frequencies, are cornerstones of modern-day frequency metrology, precision spectroscopy, astronomical observations, ultrafast optics and quantum information1,2,3,4,5,6,7. Chip-scale frequency combs, based on the Kerr and Raman nonlinearities in monolithic microresonators with ultrahigh quality factors8,9,10, have recently led to progress in optical clockwork and observations of temporal cavity solitons11,12,13,14. But the chromatic dispersion within a laser cavity, which determines the comb formation15,16, is usually difficult to tune with an electric field, whether in microcavities or fibre cavities. Such electrically dynamic control could bridge optical frequency combs and optoelectronics, enabling diverse comb outputs in one resonator with fast and convenient tunability. Arising from its exceptional Fermi–Dirac tunability and ultrafast carrier mobility17,18,19, graphene has a complex optical dispersion determined by its optical conductivity, which can be tuned through a gate voltage20,21. This has brought about optoelectronic advances such as modulators22,23, photodetectors24 and controllable plasmonics25,26. Here we demonstrate the gated intracavity tunability of graphene-based optical frequency combs, by coupling the gate-tunable optical conductivity to a silicon nitride photonic microresonator, thus modulating its second- and higher-order chromatic dispersions by altering the Fermi level. Preserving cavity quality factors up to 106 in the graphene-based comb, we implement a dual-layer ion-gel-gated transistor to tune the Fermi level of graphene across the range 0.45–0.65 electronvolts, under single-volt-level control. We use this to produce charge-tunable primary comb lines from 2.3 terahertz to 7.2 terahertz, coherent Kerr frequency combs, controllable Cherenkov radiation and controllable soliton states, all in a single microcavity. We further demonstrate voltage-tunable transitions from periodic soliton crystals to crystals with defects, mapped by our ultrafast second-harmonic optical autocorrelation. This heterogeneous graphene microcavity, which combines single-atomic-layer nanoscience and ultrafast optoelectronics, will help to improve our understanding of dynamical frequency combs and ultrafast optics.