That chart is a little bit missleading since the US was on the gold standard until 1971 which means the price of gold was controlled by the government. You'll notice that, after 1971, the price of gold has a similar slope to the stock market - though much more volatile.
Isn't that a little backwards? What I mean is: the price of gold wasn't really controlled by the government. The price of a dollar was controlled by the market price of gold.
Not really. We are using US dollars to compare gold to stocks. If gold was locked to the dollar, then you wont ever see any change (horizontal line) in the price of gold. If you invested in gold it was the same as investing in the dollar. On the other hand, stocks were free to fluctuate in price with regard to the dollar. Once the dollar was no longer pegged to the value of gold you start seeing the same fluctuation in its price with respect to the dollar.
Comparing gold to stocks only becomes useful in the past 30 years or so. At least recently, the two usually fluctuate in the opposite direction of each other. That is to say, when the economy is doing well and the stock market is at an all time high, the price of gold is relatively low. During a recession, when the stock market is crashing, the price of gold goes up quite a bit. Unfortunately, what you see people doing is selling their stocks when the price is at a low and buying gold when it is at a high due to fear and misinformation.
My opinion is that it's safe to treat gold as if it were cash. It's good to have a lot when the markets hit rock bottom so you can buy stocks when they are on sale and ride the wave back up. But in the long run, holding gold in any large quantity will probably lose you money just like holding cash would. On average, I would not have more than 1-2% of total assets in gold.