|
1 | | -import {blur2, contours, geoPath, max, min, nice, range, ticks, thresholdSturges, scaleUtc} from "d3"; |
| 1 | +import {blur2, contours, geoPath, max, min, nice, range, ticks, thresholdSturges, utcTickInterval} from "d3"; |
2 | 2 | import {createChannels} from "../channel.js"; |
3 | 3 | import {create} from "../context.js"; |
4 | | -import {labelof, identity, arrayify, map, isTemporal} from "../options.js"; |
| 4 | +import {labelof, identity, arrayify, map, isTemporal, coerceNumbers} from "../options.js"; |
5 | 5 | import {applyPosition} from "../projection.js"; |
6 | 6 | import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, styles} from "../style.js"; |
7 | 7 | import {initializer} from "../transforms/basic.js"; |
@@ -116,7 +116,7 @@ function contourGeometry({thresholds, interval, ...options}) { |
116 | 116 | const kx = w / dx; |
117 | 117 | const ky = h / dy; |
118 | 118 | const temporal = isTemporal(channels.value.value); |
119 | | - const V = temporal && this.blur > 0 ? Float64Array.from(channels.value.value) : channels.value.value; |
| 119 | + const V = this.blur > 0 ? coerceNumbers(channels.value.value) : channels.value.value; |
120 | 120 | const VV = []; // V per facet |
121 | 121 |
|
122 | 122 | // Interpolate the raster grid, as needed. |
@@ -192,7 +192,10 @@ function maybeTicks(thresholds, V, min, max, temporal) { |
192 | 192 | if (typeof thresholds?.range === "function") return thresholds.range(thresholds.floor(min), max); |
193 | 193 | if (typeof thresholds === "function") thresholds = thresholds(V, min, max); |
194 | 194 | if (typeof thresholds !== "number") return arrayify(thresholds); |
195 | | - if (temporal) return scaleUtc().domain([min, max]).nice(thresholds).ticks(thresholds); |
| 195 | + if (temporal) { |
| 196 | + thresholds = utcTickInterval(min, max, thresholds); |
| 197 | + return thresholds.range(thresholds.floor(min), max); |
| 198 | + } |
196 | 199 | const tz = ticks(...nice(min, max, thresholds), thresholds); |
197 | 200 | while (tz[tz.length - 1] >= max) tz.pop(); |
198 | 201 | while (tz[1] < min) tz.shift(); |
|
0 commit comments