Skip to content

The areaY mark’s interval option doesn’t work with y1 and y2 #1784

Closed
@mbostock

Description

@mbostock

The maybeDenseIntervalX transform used by areaY’s interval option uses the binX transform, but only outputs the y channel:

: bin({[k]: options?.reduce === undefined ? reduceFirst : options.reduce, filter: null}, options);

This means it doesn’t work if the areaY mark is using the y1 and y2 options:

untitled (49)

Plot.areaY(aapl.slice(0, 81), {
  x: "Date",
  y1: "Low",
  y2: "High",
  interval: "day",
  curve: "step"
}).plot()

It should instead be equivalent to this:

untitled (50)

Plot.areaY(
  aapl.slice(0, 81),
  Plot.binX(
    { y1: "first", y2: "first", filter: null },
    { x: "Date", y1: "Low", y2: "High", interval: "day", curve: "step" }
  )
).plot()

So somehow maybeDenseIntervalX will need to know to output y1 and y2 instead.

Ref. https://observablehq.com/d/39a059b4b6322d37

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions