The oscillator picture already works for a scalar field and the analogy is purely based on the form of the equation of motion for a free quantum field, see this question and its answers and comments for a longer discussion of the origin and merits of this idea. It does not change substantially when the free field is a vector or a tensor field, you just get a free wave equation in more components, i.e. if you really want to you can imagine as many oscillators at every point in space as the field has degrees of freedom associated with it.
Additionally, it doesn't make sense to ask how the analogy works for "the electromagnetic field" or "gravity" - the analogy is about a free field, but the electromagnetic field or whatever field you're quantizing for your gravitons are interacting fields. The analogy really is purely about free fields or building of the asymptotic free Fock space, not "real" fields.