Many of the rules about Electric and Magnetic fields can be applied to Gravitational fields as well. At least they are analogous to it.
Isaac Newton didn't discover gravity, what he realised was that the same force which meant that the apple fell on his head also caused the Earth to revolve around the Sun and the Moon to revolve around the Earth. He used Kepler's laws to derive his Law of Universal Gravitation; the force is proportional to the product of the two masses over the radius squared.
Later Henry Cavendish was able to establish the constant of proportionality for this law with a gigantic experiment, involving huge steel masses rotating relative to even bigger fixed masses. We call this constant G, the Universal Gravitational Constant.
There are just a few key differences, for example gravity is always attractive! Gravity acts upon mass, and you cannot have negative mass like you can have negative charge or opposite poles of a magnet. Infact these differences are just a few of the unexplained elements of our current best theories of everything, the Standard Model and Einstein's Theory of General Relativity. Many experiments give strong evidence for these two explanations, but we have yet to find a mechanism for gravity, and that is a major stumbling block in our search to explain the Universe around us.