On line charts “if some of the x or y channel values are undefined (or null or NaN), gaps will appear between adjacent points”.
If my dataset contains such undefined values, how can I achieve that these also remain when I use group / groupX / groupY?
The below plot is created (some settings removed for brevity) using a dataset where all x values (timestamp) are set and some y values (temp) are undefined.
marks: [
Plot.frame(),
Plot.line(data, { x: "timestamp", y: "temp", stroke: "sensor_id" }),
Plot.line(data, Plot.groupX({ y: "mean" }, { x: d => new Date(d.timestamp.getTime()).setSeconds(0, 0), y: "temp", stroke: "black" }))
]

The grouping groups all measurements per minute and plots the average in black.
In the data, there is a minute that only has a single entry, and its y value (temp) is undefined.
How can I achieve that this aggregates to undefined? Is there a setting how group behaves when a single value / all values are undefined?
I managed to make it work by providing a custom aggregation function that takes care of undefined values, but I think there should be an easier way to achieve this. It seems like I am missing something.
Plot.line(data,
Plot.groupX(
// Here I check if the grouping consists of a single falsy value
{ y: data => (data.length == 1 && !data[0]) ? undefined : data.reduce((a,b) => a + b, 0) / data.length },
{ x: d => new Date(d.timestamp.getTime()).setSeconds(0, 0), y: "temp", stroke: "black"
))
