visual = {
const svgWidth = 500;
const svgHeight = 300;
const margin = { top: 60, right: 20, bottom: 20, left: 200 };
const barHeight = (svgHeight - margin.top - margin.bottom) / plotWeights.length;
const svg = d3csv.create("svg")
.attr("width", svgWidth)
.attr("height", svgHeight);
const xScale = d3csv.scaleLog()
.domain([d3csv.min(plotWeights, d => d.weight)/10, d3csv.max(plotWeights, d => d.weight)])
.range([margin.left, svgWidth - margin.right]);
svg.selectAll(".bar")
.data(plotWeights)
.enter().append("rect")
.attr("class", "bar")
.attr("x", margin.left)
.attr("y", (d, i) => margin.top + i * barHeight)
.attr("width", d => xScale(d.weight) - margin.left)
.attr("height", barHeight - 2);
svg.selectAll(".bar text")
.data(plotWeights)
.enter().append("text")
.attr("class", "bar text")
.attr("x", d => margin.left-10)
.attr("y", (d, i) => margin.top + i * barHeight + barHeight / 2)
.attr("dy", "0.35em")
.text(d => d.patient)
.attr("text-anchor", "end");
svg.append("defs")
.append("marker")
.attr("id", "arrow")
.attr("viewBox", "0 0 10 10")
.attr("refX", "5")
.attr("refY", "5")
.attr("markerWidth", "6")
.attr("markerHeight", "6")
.attr("orient", "auto-start-reverse")
.append("path")
.attr("d", "M 0 0 L 10 5 L 0 10 z");
svg.append("line")
.attr("x1", margin.left)
.attr("y1", margin.top-10)
.attr("x2", svgWidth - margin.right)
.attr("y2", margin.top-10)
.attr("stroke", "black")
.attr("stroke-width", 1)
.attr("marker-start","url(#arrow)")
.attr("marker-end","url(#arrow)");
svg.append("text")
.attr("class", "text")
.attr("x", margin.left)
.attr("y", margin.top - 20)
.text("None")
.attr("text-anchor", "middle");
svg.append("text")
.attr("class", "text")
.attr("x", svgWidth - margin.right)
.attr("y", margin.top - 20)
.text("Most")
.attr("text-anchor", "middle");
svg.append("text")
.attr("class", "text")
.attr("x", margin.left + (svgWidth-margin.right-margin.left) / 2)
.attr("y", margin.top - 20)
.text("Moral Value")
.attr("text-anchor", "middle");
return svg.node();
}