Skip to content

ability to extend lines for thresholds and axes #2948

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

Open
RichardNeill opened this issue Aug 28, 2018 · 5 comments
Open

ability to extend lines for thresholds and axes #2948

RichardNeill opened this issue Aug 28, 2018 · 5 comments
Labels
feature something new P3 backlog

Comments

@RichardNeill
Copy link

In plotly, sometimes the lines don't go far enough, and it would be helpful to extend them.

Case 1: Multiple axes are not joined together. The x-axis line should connect all axes, not just the first 2. In the example image, I have drawn a red line where I think the x-axis should continue.

Case 2. I sometimes want to draw a target line on a chart; in this case, below the line would be "bad", resulting in a red bar, while above the line, would be good. To implement these, I have used a dedicated series, with a constant value. However, a target line should really a special case of a "grid" line, rather than a special case of a "data series", and it ought to extend right the way to the (appropriate) axis. I've drawn this in yellow on the chart below. (Even better, a target should be defined by a single value, rather than an array of repeated values).

newplot

Thanks very much :-)

@alexcjohnson
Copy link
Collaborator

I think you can do both of these already using layout.shapes.

Case 1: turn off xaxis.showline and replace it with a shape:

{
  type: 'line',
  x0: 0, // or whatever the leftmost axis `position` is
  x1: 1,
  y0: 0, y1: 1,
  xref: 'paper',
  yref: 'paper'
}

Case 2:

{
  type: 'line',
  x0: 0.1, x1: 1, // or matching `xaxis.domain`
  y0: 5, y1: 15, // your data value
  xref: 'paper',
  yref: 'y2',
  line: {dash: 'dash'}
}

@RichardNeill
Copy link
Author

Thanks. That's a helpful workaround, but not quite what I meant.

Case 1: I would suggest that this is how xaxis.showline should work anyway, if there are more than 2 axes.

Case 2: if I draw my threshold line as "just a line shape", then I'll lose the ability to see the tooltips, it won't appear in the Legend, and it won't get switched on and off along with the dataset by legendgroup.

@alexcjohnson
Copy link
Collaborator

Case 1: I would suggest that this is how xaxis.showline should work anyway, if there are more than 2 axes.

I could imagine making that an option, but not the default - A quick image search "graph many y axes" shows a whole lot of examples that all match our current behavior. Not to say that popularity makes it the correct behavior, but I've always understood the axis line to either indicate "here's the range of positions encoded by this axis," or closely related, to outline the plot area - and plotly.js toggles between these two behaviors as appropriate, but the difference is minor. Unless and until we make an option specifically for the behavior you're describing, I think a shape is still your best bet.

Case 2: if I draw my threshold line as "just a line shape", then I'll lose the ability to see the tooltips, it won't appear in the Legend, and it won't get switched on and off along with the dataset by legendgroup.

I see - if you want it in the legend, with tooltips, then I think you do want this to be data. For now I would suggest just moving the first data point over a bit ('2018-08-26 12:00' would be the left edge).

Just to link these ideas together: there are some features we've talked about but haven't yet implemented that could be useful to you - allowing individual traces to specify that they don't contribute to autorange for example (which I thought had been discussed in #1876 but I don't see it) and hover on lines #1960.

@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

@RichardNeill
Copy link
Author

Hello. Yes, this issue is still relevant. Please re-open.

@gvwilson gvwilson self-assigned this Jun 17, 2024
@gvwilson gvwilson reopened this Jun 17, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson changed the title Wish: ability to extend lines for thresholds and axes. ability to extend lines for thresholds and axes Aug 8, 2024
@gvwilson gvwilson added feature something new P3 backlog labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

3 participants