D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
dougdowson
Full window
Github gist
Line Chart: Recent College Graduates
<!DOCTYPE HTML> <meta charset="utf-8"> <html> <head> <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: #4a4a4a; } #content { margin: 5px; padding: 0px 0px 150px 0px; width: 595px; text-align: left; } #container { padding: 15px; border: 1px solid #ccc; height: 510px; clear: both; } #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; } p { margin: 5px 0px 0px 0px; } 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: 2px; shape-rendering: crispEdges; } .axis path, .axis line { fill: none; shape-rendering: crispEdges; border-width: 2px; } .axis line { stroke: #eee; stroke-width: 1; shape-rendering: crispEdges; } .x.axis text, .y.axis text, #unit { color: #4a4a4a; font-size: 12px; } #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: 1px solid #E60000; border-width: 1px; border-radius: 3px; text-align: center; color: #fff; font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; text-transform: uppercase; } .button:hover, .selected { background:#CC0000; color: #fff; cursor: pointer; border: 1px solid #B30000; } .line { fill: none; stroke: #00a1ce; stroke-width: 3px; } .circle { stroke: #00a1ce; stroke-width: 3px; fill: #fff; } #header { margin: 0px; padding: 0px; height: 34px; background: #747474; } #block { float: left; margin: 0px; padding: 0px; height: 100%; width: 10px; background: #ff0000; } .right.label { font-size: 13px; fill: #333; } #source { margin: 0px 0px 20px 0px; padding: 0px; font-size: 11px; } p.tooltip { position: relative; margin: 0px; padding: 0px 10px; width: 40px; height: 30px; line-height: 30px; color: #fff; text-align: center; background: #CC0000; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; border: 1px solid #B30000; -moz-box-shadow: 3px 3px 10px 0px rgba(0, 0, 0, 0.25); -webkit-box-shadow: 3px 3px 10px 0px rgba(0, 0, 0, 0.25); box-shadow: 3px 3px 10px 0px rgba(0, 0, 0, 0.25); opacity: 0; display: none; } p.tooltip:before { content: ' '; position: absolute; width: 0; height: 0; left: 16px; top: 30px; border: 6px solid; border-color: #B30000 transparent transparent #B30000; } p.tooltip:after { content: ' '; position: absolute; width: 0; height: 0; left: 17px; top: 30px; border: 5px solid; border-color: #CC0000 transparent transparent #CC0000; } </style> </head> <body> <div id="content"> <div id="header"> <div id="block"></div> <h1>Recent college graduates entering labour force at lowest rate in 20 years</h1> </div> <div id="container"> <div id="buttons"> <div class="button selected" id="lfpr_rate">Labor Force Participation Rate</div> <div class="button" id="emp_pop_ratio">Emp-Pop Ratio</div> <div class="button" id="unemp_rate">Unemployment Rate</div> </div> <div id="chart"></div> <p id="source">Source: October Supplement to the Current Population Survey, US Bureau of Labour Statistics</p> </div> </div> <p class="tooltip"></p> <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