Plot.plot({
width: Math.min(800, width),
height: 400,
caption: "Uitgifte: 2020-07-06 17:20:00",
marginTop: 40,
style: {
fontSize: 12
},
x: {
insetLeft: 16,
type: 'time',
grid: true,
domain: [ new Date("2020-07-04T17:10Z"), new Date("2020-07-07T17:10Z")],
nice: false,
ticks: 5,
tickFormat: timeFormat,
},
y: {
grid: true,
label: "↑Windsnelheid (m/s)",
domain: [0, 25],
},
marks: [
Plot.rect(beaufort, {insetRight: Math.min(800, width) - 16 - 60 , y1: "l", y2: "u", fill: "c", clip: true }),
Plot.rect([...upperLimits,...lowerLimits], {insetLeft: 0,insetRight: Math.min(800, width) - 60 -16 , y1: "u", y2: "l", fill: "c", clip: true }),
Plot.ruleY([...upperLimits,...lowerLimits], {insetLeft: 16, y: (d) => d.condition === "crossingUpwards"? d.l : d.u, stroke: "c", strokeWidth: 2, strokeDasharray: "4, 2" } ),
Plot.text(upperLimits, {
y: "l",
dx: - ( Math.min(800, width) - 60) / 2 + 16,
text: d => `${d.label}`,
dy: -8,
clip: true,
fill: "c" ,
textAnchor:"start",
}),
Plot.text(lowerLimits, {
y: "u",
dx: - ( Math.min(800, width) - 60) / 2 + 16,
text: d => `${d.label}`,
dy: 8,
clip: true,
fill: "c" ,
textAnchor:"start",
}),
Plot.text(beaufort, { y: "m", dx: - ( Math.min(800, width) - 60) / 2 + 8, clip: true, fontSize: 11 }),
Plot.line(timeseries, {x: "time", y: "forecast", stroke: "rgb(185, 1, 1)", strokeDasharray: "2, 2" } ),
Plot.line(timeseries, {x: "time", y: "speed", stroke: "rgb(1, 120, 202)"}),
Plot.line(timeseries, {x: "time", y: "squall", stroke: "rgb(82, 184, 254)"}),
Plot.ruleX([ new Date("2020-07-06T15:20:00Z")], { stroke: 'purple' }),
]
})