D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
dougdowson
Full window
Github gist
Line Chart: Brazilian Real
<!DOCTYPE HTML> <meta charset="utf-8"> <html> <head> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <script src="https://d3js.org/d3.v3.min.js"></script> <style> body, h1, h2, h3, p { margin: 0px; padding: 0px; font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5em; color: #333; } #content { margin: 5px; padding: 0px; width: 595px; text-align: left; } #container { padding: 0px 15px 15px 15px; border: 1px solid #ccc; height: 692px; clear: both; } #chart { margin: 0px; padding: 0px; } #header { margin: 0px; padding: 0px; height: 34px; background: #747474; } #block { float: left; margin: 0px; padding: 0px; height: 100%; width: 10px; background: #ff0000; } #header h1 { margin: 0px 0px 0px 10px; padding: 4px 0px 0px 7px; font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: normal; color: #fff; } #unit { padding: 13px 0px 0px 0px; } #source { margin: 0px; padding: 0px; font-size: 11px; } .right.label { font-size: 13px; fill: #333; } g.y.axis path.domain { stroke-width: 0px; } g.x.axis path.domain, g.x.axis g.tick.major line, g.x.axis g.tick line { stroke: #333; stroke-width: 1px; shape-rendering: crispEdges; } .axis path, .axis line { fill: none; stroke: #ccc; shape-rendering: crispEdges; } .axis line { stroke: #eee; } .x.axis text, .y.axis text { color: #333; font-size: 13px; } path { fill: none; stroke: #00a1ce; stroke-width: 2.5px; } #buttons { margin: 0px; padding: 0px; } .button { display: inline-block; margin: 0px 2px 0px 0px; padding: 4px 6px; line-height: 20px; background:#ff0000; min-width: 60px; border-radius: 3px; text-align: center; color: #fff; font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; text-transform: uppercase; } .button:hover { background:#e3120b; color: #fff; cursor: pointer; } #buttons #back { display: none; } .button span { margin: 0px; padding: 0px 3px; } .group .circle { stroke: #00a1ce; stroke-width: 3px; fill: #fff; opacity: 0; } .group text { font-size: 14px; color: #333; } #slides { margin: 0px; padding: 0px; display: none; } #slides h1 { margin: 0px; padding: 15px 0px 5px 0px; font-family: Arial, sans-serif; font-size: 16px; color: #000; font-weight: bold; } #slides p { margin: 0px; padding: 0px 0px 13px 0px; } .slideone, .slidetwo, .slidethree, .slidefour, .slidefive, .slidesix, .slideseven, .slideeight { opacity: 0; display: none; } </style> </head> <body> <div id="content"> <div id="header"> <div id="block"></div> <h1>A real bumpy ride</h1> </div> <div id="container"> <p id="unit"><strong>Brazilian real against the US$</strong></p> <p>inverted scale</p> <div id="chart"></div> <p id="source">Source: Federal Reserve Board</p> <div id="slides"> <div> <h1 class="slideintro">The Brazilian real's bumpy ride</h1> <p class="slideintro">Over the past 12 months the Brazilian real has fluctuated more than almost all other emerging-market currencies. Such volatility is nothing new. This “action chart” examines the currency's performance over the past seven years.</p> <h1 class="slideone">The run-up to the crisis</h1> <p class="slideone">In the years leading up to the global financial crisis Brazil enjoyed rapid growth, fuelled partly by Chinese demand for commodities. The country became an emerging-market darling, boasting healthy trade surpluses, little foreign debt and more than $200 billion in foreign-exchange reserves. As foreign capital poured in, the real appreciated rapidly.</p> <h1 class="slidetwo">The effect of the financial crisis</h1> <p class="slidetwo">The global financial crisis sent investors fleeing emerging markets to safer assets like US treasury bonds. Six months after Lehman Brothers failed in September 2008, foreign investors had pulled $23 billion out of Brazil's equity and bond markets. Currency traders scrambled to unwind “carry trades”, in which they had borrowed money cheaply in developed countries with low interest rates and invested it in emerging markets like Brazil, where rates were higher. The real plummeted.</p> <h1 class="slidethree">The “currency war”</h1> <p class="slidethree">The Brazilian economy quickly rebounded, thanks largely to China's recovery from the crisis. By 2010 Brazil was growing by 7.5% a year. Rapid growth and low interest rates around the world led to an inflow of foreign capital, which drove up the value of the real again and made the country's exports less competitive. Warning of an international “currency war”, the Brazilian authorities counterattacked by selling reais on the spot market and imposing a 6% tax on foreign bond purchases to stifle inflows.</p> <h1 class="slidefour">A 12-year high for the real</h1> <p class="slidefour">Despite these salvos, by July 2011 the currency was trading at 1.5 reais to the US dollar. According to <em>The Economist</em>'s Big Mac Index, the real was one of the most overvalued currencies in the world. Brazilian businesses and consumers used the stronger currency to buy more imports: by 2011 imports had grown to $312 billion, three times more than in 2005.</p> <h1 class="slidefive">A period of depreciation</h1> <p class="slidefive">Over the course of the next year the real depreciated again. Currency interventions and low interest rates helped to weaken the currency; so did slowing growth and a loss of confidence in the economic policies of the government of Dilma Rousseff.</p> <h1 class="slidesix">The dawn of tapering</h1> <p class="slidesix">On May 22nd 2013, Fed Chairman Ben Bernanke hinted at reducing or “tapering” America's $85 billion monthly bond-buying program. Markets interpreted this as a signal that interest rates would rise in developed countries, and pulled money out of emerging markets. The real tumbled 20% in three months.</p> <h1 class="slideseven">A different currency war</h1> <p class="slideseven">The central bank responded to the fall in the real with a $60 billion intervention programme, auctioning dollars in a series of foreign exchange swaps and repurchase agreements. The bond-purchase tax was revoked in the summer of 2013, helping to send the real higher again.</p> <h1 class="slideeight">Gyrations continue</h1> <p class="slideeight">The real's turbulent ride has continued into 2014. The Fed's gradual withdrawal of stimulus continues to weigh on emerging markets, as does the sluggishness of the Brazilian economy. Yet rising interest rates, further interventions by the central bank and the prospect of change after October's election push the other way. As a result the real keeps yo-yoing.</p> </div> <div id="buttons"> <div class="button" id="back" value="start"><span class="fa fa-caret-left"></span>Back</div> <div class="button" id="next" value="start">Start<span class="fa fa-caret-right"></span></div> </div> </div> </div> </div> <script type="text/javascript" src="chart.js"></script> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js