(tickTexts: VegaDeckGl.types.TickText[], columnStats: ColumnStats)
| 5 | import { Spec } from 'vega-typings'; |
| 6 | |
| 7 | export function makeDateRange(tickTexts: VegaDeckGl.types.TickText[], columnStats: ColumnStats) { |
| 8 | if (tickTexts.length === 1) { |
| 9 | const d3TimeFormat = getD3TimeFormat(columnStats.min, columnStats.max); |
| 10 | tickTexts[0].text = vegaTimeFormat([[columnStats.min, columnStats.max]], d3TimeFormat)[0]; |
| 11 | } else { |
| 12 | const d3TimeFormat = getD3TimeFormat(tickTexts[0].value as number, tickTexts[1].value as number); |
| 13 | const pairs = tickTexts.map((t, i) => { |
| 14 | const min = t.value as number; |
| 15 | let max: number; |
| 16 | if (i === tickTexts.length - 1) { |
| 17 | max = columnStats.max; |
| 18 | } else { |
| 19 | max = tickTexts[i + 1].value as number; |
| 20 | } |
| 21 | return [min, max] as [number, number]; |
| 22 | }); |
| 23 | const formattedPairs = vegaTimeFormat(pairs, d3TimeFormat); |
| 24 | formattedPairs.forEach((formattedPair, i) => tickTexts[i].text = formattedPair); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | const second = 1000; |
| 29 | const minute = second * 60; |
nothing calls this directly
no test coverage detected