Source
27 chart lines · 1 file · 852 BBenchmark harness excluded · shared/mount.ts
Apple daily stock prices1,260 records · CSV · 92.4 kB
@charts-poc/demo-data/aaplSelection: Complete published snapshot
- Date
- Date
- Open
- number
- High
- number
- Low
- number
- Close
- number
- Adj Close
- number
- Volume
- number
Yahoo! Finance@observablehq/sample-datasets@1.0.1 · revision 732c0148de74 · aapl.csv · ISC distribution; upstream source credited · SHA-256 18dc8bf6542dPinned snapshot
cases/01-line-gaps/tanstack.ts27 lines · entry
cases/01-line-gaps/tanstack.ts
import { aapl } from '@charts-poc/demo-data/aapl'
import { defineChart, lineY } from '@tanstack/charts'
import { scaleLinear, scaleUtc } from 'd3-scale'
import type { ConformanceInput, ConformanceMount } from '../../types'
import { tanstackMount } from '../../shared/mount'
const definition = (input: ConformanceInput) => {
const rows = aapl.slice(Math.abs(input.revision) % 2)
return defineChart({
marks: [
lineY(rows, {
x: 'Date',
y: (row) => (row.Date.getUTCMonth() < 3 ? null : row.Close),
stroke: '#2563eb',
strokeWidth: 2.25,
}),
],
x: { scale: scaleUtc, axis: { label: 'Week' } },
y: { scale: scaleLinear, grid: true, axis: { label: 'Close (USD)' } },
})
}
export const mount: ConformanceMount = tanstackMount(
definition,
'Apple closing price with first-quarter gaps',
)