plot = {
let plot = Plot.plot({
width: 800,
height: 300,
marginRight: 50,
marginLeft: 80,
marginTop: 10,
marginBottom: 50,
y: {grid: true, stroke: "#898989", label: null, ticks: 12},
x: {label: null },
marks: [
Plot.axisY({color: "#7171a6", tickSize: 0, ticks: 12, fontSize: 11, tickFormat: function(d) {
if(d == 0) { return ''; }
else {
return d.toLocaleString('en-US', {
style: 'currency',
currency: 'USD',
maximumSignificantDigits: Math.trunc(Math.abs(d)).toFixed().length
}); } }}),
Plot.axisX({color: "#7171a6", tickPadding: 20, tickSize: 0, fontSize: 11, tickFormat: function(d) {
return d;
} }),
Plot.areaY(result, {x: "x", y: "y", fill: "#6078ff", fillOpacity: 0.1}),
Plot.ruleX(result, Plot.pointerX({x: "x", y: "y", stroke: "#FFFFFF", strokeWidth: 3})),
Plot.dot(result, Plot.pointerX({x: "x", y: 0, py: "y", fill: "#FFF", stroke: "#E5E7EB", strokeWidth:1, r: 5, strokeOpacity: 1, fillOpacity:1, ariaDescription:"jstip" })),
Plot.dot(result, Plot.pointerX({x: "x", y: "y", fill: "#6078ff", r: 8, tip: true, title: (d) => "yes"
}) ),
Plot.lineY(result, {x: "x", y: "y", stroke: "#6078ff", strokeWidth: 5})
]
})
let dots = d3.select(plot).selectAll("g[aria-description=jstip]");
console.log(dots);
return plot;
}