Closed
Description
This Plot previously rendered successfully in Plot 0.6.5, but now crashes with an error:
TypeError: Cannot read properties of undefined (reading 'length')
Plot.plot({
y: {
percent: true,
label: "Utilization, %"
},
grid: true,
x: {
label: "Ceph pool"
},
facet: {
x: "Ceph pools usage"
},
color: {
range: ["#16b336", "#f9cb2a", "#b40b0b"],
type: "quantile",
domain: [0.3, 0.5, 0.8]
},
marks: [
Plot.barY(percents_data, {
x: "name",
y: "value",
fill: "value",
sort: { x: "y", reverse: true }
}),
Plot.ruleY([0])
]
})
The crash is happening here dereferencing data.length
:
// Warn for the common pitfall of wanting to facet mapped data with the
// top-level facet option.
if (
data.length > 0 &&
(groups.size > 1 || (groups.size === 1 && channels.fx && channels.fy && [...groups][0][1].size > 1)) &&
arrayify(mark.data)?.length === data.length
) {
warn(
`Warning: the ${mark.ariaLabel} mark appears to use faceted data, but isn’t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`
);
}