D3 line chart 2

Developer
Size
2,196 Kb
Views
26,312

How do I make an d3 line chart 2?

What is a d3 line chart 2? How do you make a d3 line chart 2? This script and codes were developed by Shannon Range on 10 November 2022, Thursday.

D3 line chart 2 Previews

D3 line chart 2 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>d3 line chart 2</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src="https://d3js.org/d3.v3.min.js"></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

D3 line chart 2 - Script Codes CSS Codes

path { stroke: steelblue; stroke-width: 4; fill: none;
}
line { stroke: black;
}
path:hover { stroke:red; stroke-width:8;
}
text { font-family: Arial; font-size: 9pt;
}

D3 line chart 2 - Script Codes JS Codes

var top5 = [ 51, 50, 51, 55, 56, 58, 60, 59, 60, 63, 66, 70, 71, 71, 74, 76, 80, 86, 87, 90, 91, 92, 99, 99, 99, 97, 100, 103, 106, 107, 106, 105, 108, 110, 114, 117, 120, 122, 124, 128, 125, 122, 123, 128, 132, 133, 135, 142, 148, 154,154 ,154 ,151, 153, 152, 157, 158, 158, 154, 154, 152, 151, 151, 154],	w = 600,	h = 600,	margin = 30,	y = d3.scale.linear().domain([0, d3.max(top5)]).range([0 + margin, h - margin]),	x = d3.scale.linear().domain([0, top5.length]).range([0 + margin, w - margin])	var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h);	var g = svg.append("svg:g") .attr("transform", "translate(0, 600)");	var line = d3.svg.line() .x(function(d,i) { return x(i); }) .y(function(d) { return -1 * y(d); })	g.append("svg:path").attr("d", line(top5));	g.append("svg:line") .attr("x1", x(0)) .attr("y1", -1 * y(0)) .attr("x2", x(w)) .attr("y2", -1 * y(0))	g.append("svg:line") .attr("x1", x(0)) .attr("y1", -1 * y(0)) .attr("x2", x(0)) .attr("y2", -1 * y(d3.max(top5)))	g.selectAll(".xLabel") .data(x.ticks(7)) .enter().append("svg:text") .attr("class", "xLabel") .text(function(d,i){ return d + 1950}) .attr("x", function(d) { return x(d) }) .attr("y", 0) .attr("text-anchor", "middle")	g.selectAll(".yLabel") .data(y.ticks(8)) .enter().append("svg:text") .attr("class", "yLabel") .text(String) .attr("x", 25) .attr("y", function(d) { return -1 * y(d) }) .attr("text-anchor", "end") .attr("dy", 4)
D3 line chart 2 - Script Codes
D3 line chart 2 - Script Codes
Home Page Home
Developer Shannon Range
Username silentkrange
Uploaded November 10, 2022
Rating 3
Size 2,196 Kb
Views 26,312
Do you need developer help for D3 line chart 2?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Shannon Range (silentkrange) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!