chart = {
const width = 800,
height = 800;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var g = svg.selectAll('g').attr("id", "paths");
var c = svg.selectAll('circle')
polyline(square_test,'red','1','1','0','black')
polyline(plus_outline,'rgb(220,220,220)','.5','1','2','black')
polyline(plus_details,'rgb(220,220,220)','.5','1','.75','black')
polyline(boat,'none','.5','1','3','blue')
function polyline(data, sfill, fillO, sOpac, sW, stroke){
g.enter().append("polyline")
.data(data)
.enter()
.append('polyline')
.attr("points", function(d){return d})
.style("fill", sfill)
.style("fill-opacity", fillO)
.style('stroke-opacity',sOpac)
.style("stroke-width", sW)
.style("stroke", stroke)
}
g.enter().append("polyline")
.data(rhinoLines)
.enter()
.append('polyline')
.attr("points", function(d){return d.pts})
.style("fill", 'purple')
.style("fill-opacity", '1')
.style('stroke-opacity','1')
.style("stroke-width", '1')
.style("stroke", 'black')
.on('mouseover',rhinoText)
function rhinoText(event,d){
svg
.append("text")
.attr("x",200)
.attr("y",200)
.attr("class","pointsText")
.attr('font-weight','bold')
.attr("font-family","helvetica")
.attr("font-size","12px")
.text(d.zoning)
}
c.enter().append('circle')
.data(points)
.enter()
.append('circle')
.attr('cx',function(d){return d.xVal})
.attr('cy',function(d){return d.yVal})
.attr('r',ptRad)
.attr('fill',ptColor)
.on('mouseover',pointsHover)
.on('mouseout',pointsHoverOff)
function ptColor(d){
var color = 'red'
if(d.Type == 'clt'){color = 'blue'}
if(d.Type == 'other'){color = 'cyan'}
return color
}
function ptRad(d){
var radius = '4'
if(d.Type == 'clt'){radius = '8'}
return radius
}
function pointsHover(event,d){
svg
.append("rect")
.attr("x",d.xVal+20)
.attr("y",d.yVal+20)
.attr("width","120")
.attr("height","80")
.attr("class","hoverRect")
.attr("fill","rgb(200,200,200)")
.attr("stroke","black")
.attr("stroke-width","1")
svg
.append("text")
.attr("x",d.xVal+40)
.attr("y",d.yVal+40)
.attr("class","pointsText")
.attr('font-weight','bold')
.attr("font-family","helvetica")
.attr("font-size","12px")
.text(d.Name)
svg
.append("text")
.attr("x",d.xVal+40)
.attr("y",d.yVal+60)
.attr("class","pointsText")
.attr('font-weight','lighter')
.attr("font-family","helvetica")
.attr("font-size","12px")
.text(d.Description)
var wrap = svg.selectAll("text.pointsText")
.each(function(d, i) { wrap_text(d3.select(this), 80) });
}
function pointsHoverOff(event,d){
svg.selectAll('text.pointsText').remove()
svg.selectAll('rect.hoverRect').remove()
}
svg
.append("text")
.attr("x","100")
.attr("y","115")
.attr("class","hoverText")
.attr("font-family","helvetica")
.attr("font-size","12px")
.text("I love CASE 😀")
return svg.node();
}