Closed
Description
For example, if you say
Plot.plot({
x: {
domain: [0, 10],
interval: {
floor: (x) => Math.floor(x),
offset: (x, offset = 1) => x + offset
}
}
})
you get
TypeError: interval.range is not a function
here
Line 521 in 6b87468
You can fix the problem like so
Plot.plot({
x: {
domain: [0, 10],
interval: <Plot.RangeInterval>{
floor: (x) => Math.floor(x),
offset: (x, offset = 1) => x + offset,
range: (x1, x2) => d3.range(x1, x2)
}
}
})
but you need the type declaration to avoid a lint error, since ScaleOptions["interval"] is also erroneously an Interval instead of a RangeInterval. Though, there are some cases like with ordinal scales where a plain Interval may be allowable?
We should decide whether a range interval is required for the ScaleOptions["interval"] option. If it’s not, then the axis mark should gracefully handle the interval not implementing interval.range. If it is, then the axis mark should throw a nicer “invalid interval” error message.
Activity