Skip to content

Allow scatter traces with mode: 'none' to contribute to tonext* fills  #1867

Closed
@koreyou

Description

@koreyou

Trying to create filled plots with no lines, I used fill with mode = 'none'. This caused unexpected behavior of the first fill not showing up.

var data = [
  {
    "x": [1, 2, 3],
    "y": [-2.0, -3.0, -4.0],
    'type': 'scatter',
    'mode': "none",
    'showlegend': false,
    "name": "1"
  },
  {
    "x": [1, 2, 3],
    "y": [-1.0, -2.0, -3.0],
    'type': 'scatter',
    'showlegend': false,
    'mode': "none",
    "name": "2",
    "fill": "tonexty",
    "fillcolor": "blue"
  },
  {
    "x": [1, 2, 3],
    "y": [0.0, 0.0, 1.0],
    'type': 'scatter',
    'showlegend': false,
    'mode': "none",
    "name": "3",
    "fill": "tonexty",
    "fillcolor": "green"
  }
];

Plotly.newPlot(
  "test", // the ID of the div
  data, {});

fill_with_mode_none

The minimum moving example is here

This is the expected plots:

expected

This can be achieved by passing 0 width line.

    'mode': "lines",
    'line': {'width': 0, 'color': 'green'},

I believe this is not a desired behavior?
It will be great if you can fix the problem or at least document it for fill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions