Plot.plot({
y: {
tickFormat: "$.2",
label: "Revenue"
},
color: {
domain: [-1, 1],
scheme: "RdBu"
},
marks: [
Plot.ruleY([0]),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{
x: (d) => new Date(d.created * 1000),
y: (d) => d.net / 100,
fill: (d) => Math.sign(d.net),
thresholds: d3.utcWeek
}
)
)
]
})