~~ I know what market cap is, ~~
think about it again, it is easy: market cap is "Price multiplied by Available supply" so it is simple math.
first of all the chart doesn't have the same vertical values one is written on the right and the other is on the left so it is not really a good comparission.
but the reason for what you saw is this:
when one of these changes faster than the other market cap grows fast and so you see a sharp move in the chart.
for example when the altcoin is pumped the price is rising super fast so price * supply goes up super fast hence the sharp move and when it is dumped back again price * supply goes down super fast hence another sharp move.