Skip to content
Discussion options

You must be logged in to vote

The Date values and x: {type: "time"} are fine. The problem is the mark-level transform contract.

In Plot’s Mark.initialize, a mark transform is destructured as {data, facets}. Your (data) => data returns the bare array, so Plot ends up with data === undefined; the later arrayLike/in error is just the downstream symptom. The docs state the same contract: a custom transform receives (data, facets, options) and must return a {data, facets} object (https://observablehq.com/plot/features/transforms#transformoptions-transform).

You do not need a transform for this example. tickX defaults its x channel to the identity accessor, so this is enough:

const data = [
  new Date("2026-01-01"),
  new Date

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mwaibel-go
Comment options

Answer selected by mwaibel-go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants