Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow filling to a specific trace, independent of visibility #3444

Closed
jacobq opened this issue Jan 17, 2019 · 1 comment
Closed

Allow filling to a specific trace, independent of visibility #3444

jacobq opened this issue Jan 17, 2019 · 1 comment
Labels
feature something new

Comments

@jacobq
Copy link

jacobq commented Jan 17, 2019

For the scatter plot type's fill option, it would be nice to be able to explicitly specify a trace to fill to instead of tonext (which seems like it really means "to previous", since it uses the trace before it).

For example, (similar to Asymmetric Error Bars with a Constant Offset) if I have trace for which I want to shade a region above using one color and a region below using another color then it seems that I need to use one of the following approaches, none of which seem ergonomic to me:

  1. "Fold the shading trace data back on itself" (as in Filled Lines) so that the points make a polygon. Aside from being arguably non-intuitive, this prevent the "on hover" behavior from working right (it can only show one y value per trace for a given x value).

  2. Insert a copy of the main trace after the first fill trace so that the next fill trace doesn't fill all the way to the other fill trace (changing its color). This is rather fragile as it doesn't have the desired behavior when trace visibility is toggled.

    CodePen here

    image
    vs.
    image

  3. Perhaps one could add another trace to "erase" the unwanted fill or attempt to choose colors such that they mix to the desired color, but that seems even worse.

Instead, I think it would be convenient to be able to specify either another trace by name or reference the equivalent data like this:

const trace1 = { /* ... */ },
const trace2 = {
  // ...
  fill: 'boundary',
  fillboundary: trace1
}

or perhaps

{
  // ...
  fill: 'boundary',
  fillboundary: {
    x: [0, 1, 2],
    y: [8, 7, 5],
  }
}

Would this be technically difficult? Cause performance issues? Is there a way to do this already that I just don't know about? (If so, sorry for posting on GH instead of community forum -- this is intended as a feature request)

See also #113 and #420

@etpinard etpinard added the feature something new label Jan 22, 2019
@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

3 participants