chart3 = {
const svg = d3.create('svg').attr('viewBox', [0, 0, width, height]);
const margin = { top: 50, right: 50, bottom: 50, left: 60 };
const xAxis = g =>
g
.call(d3.axisBottom(x).ticks(50))
.attr('transform', `translate(0, ${height - margin.bottom - 7})`);
svg.append('g').call(xAxis);
const yAxis = g =>
g.attr("transform", `translate(${margin.left},0)`).call(d3.axisLeft(y));
svg.append('g').call(yAxis);
svg
.append('g')
.attr('transform', `translate(0, ${height - margin.bottom})`)
.call(xAxis);
svg
.append('g')
.attr('transform', `translate(${margin.left}, 0)`)
.call(yAxis);
svg
.append("g")
.attr("stroke", "#000")
.attr("stroke-opacity", 0.2)
.selectAll("circle")
.data(disney)
.enter()
.append("circle")
.attr("cx", d => x(d.imdb_rating))
.attr("cy", d => y(d.imdb_votes))
.attr('fill', "purple")
.attr("r", 1.5);
svg
.append("g")
.attr("stroke", "#000")
.attr("stroke-opacity", 0.2)
.selectAll("circle")
.data(netflix)
.enter()
.append("circle")
.attr("cx", d => x(d.us_voters_rating))
.attr("cy", d => y(d.us_voters_votes))
.attr('fill', "pink")
.attr("r", 1.5);
svg
.append("text")
.attr("class", "text")
.attr("transform", `translate(500, ${height - margin.bottom + 45})`)
.style("text-anchor", "middle")
.style("font-size", "14px")
.text("Rating");
svg
.append("text")
.attr("class", "text")
.attr("transform", `translate(10, ${height / 2})rotate(-90)`)
.style("text-anchor", "middle")
.style("font-size", "14px")
.text("Vote");
svg
.append("text")
.attr("class", "text")
.attr("transform", "translate(500,50)")
.style("text-anchor", "middle")
.style("font-size", "25px")
.style("font-weight", "bold")
.text("Rating VS Vote: Disney+ & Netflix");
svg
.append("circle")
.attr("transform", "translate(600,-25)")
.attr("cx", 200)
.attr("cy", 130)
.attr("r", 6)
.style("fill", "pink");
svg
.append("circle")
.attr("transform", "translate(600,-30)")
.attr("cx", 200)
.attr("cy", 160)
.attr("r", 6)
.style("fill", "purple");
svg
.append("text")
.attr("transform", "translate(600,-25)")
.attr("x", 220)
.attr("y", 130)
.text("Netflix")
.style("font-size", "15px")
.attr("alignment-baseline", "middle");
svg
.append("text")
.attr("transform", "translate(600,-30)")
.attr("x", 220)
.attr("y", 160)
.text("Disney")
.style("font-size", "15px")
.attr("alignment-baseline", "middle");
return svg.node();
}