Plot.plot({
x: { grid: true },
y: {
grid: true,
transform: (d) => d / 1000000
},
marks: [
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", fill: "pink" }
)
),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y1", fill: "red", insetRight: 40, dx: -20 }
)
),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y2", fill: "green", insetRight: 40, dx: -10 }
)
),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y3", fill: "lightblue", insetRight: 40, dx: 0 }
)
),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y4", fill: "orange", insetRight: 40, dx: 10 }
)
),
Plot.line(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", stroke: "black" }
)
),
Plot.dot(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", stroke: "black" }
)
),
Plot.ruleY([0])
]
})