Skip to content

Area + interval creates a spurious series #1775

Closed
@Fil

Description

@Fil

as reported by @yurivish in https://observablehq.com/d/3264dbb558b44080, the following chart creates a spurious series, with a color (stroke) that is undefined. I've tweaked Yuri’s example to make the issue more visually salient, and to clarify that it is not the mix of z and fill that creates the problem. Inspecting the channels with mark.initialize reveals that the fill channel is ["A", "A"…, "B", "B", ...], but the stroke channel is full of [undefined, undefined…, "A", …, "B", …].

Capture d’écran 2023-08-01 à 11 23 28
Plot.plot({
  marks: [
    Plot.areaY(
      [
        {
          x: 0,
          y: 5,
          type: "B"
        },
        {
          x: 5,
          y: 5,
          type: "B"
        },
        {
          x: 5,
          y: 5,
          type: "A"
        },
        {
          x: 10,
          y: 5,
          type: "A"
        }
      ],
      {
        interval: 1,
        x: "x",
        y: "y",
        fill: "type",
        stroke: "type",
        strokeWidth: 2,
        strokeOpacity: 0.7
      }
    )
  ],
  color: { legend: true }
})

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