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

In staticPlot, do not draw-zero length bars #5294

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

antoinerg
Copy link
Contributor

@antoinerg antoinerg commented Nov 20, 2020

Closes #5282

I'm not sure it's possible to know that transitions will not be used in a future API call except for when staticPlot is true. This PR ensures that when staticPlot is true, bars of zero-length are drawn with a SVG path d=M0,0Z which is rendered correctly in Chromium's PDF.

Note that there is still an issue for Chromium users "printing to PDF" webpages containing interactive plotly.js figure with bars of zero-length. This one is much more complicated to fix in my opinion.

@antoinerg antoinerg changed the title In staticPlot, do not draw zero length bars In staticPlot, do not draw-zero length bars Nov 20, 2020
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💃

@archmoj archmoj added status: reviewable bug something broken labels Nov 20, 2020
@nicolaskruchten
Copy link
Contributor

@antoinerg are you able to confirm that this resolves plotly/orca#345 ?

@antoinerg
Copy link
Contributor Author

@antoinerg are you able to confirm that this resolves plotly/orca#345 ?

Yes, I can confirm!

docker run --net=host quay.io/plotly/orca --plotlyjs=https://94388-45646037-gh.circle-artifacts.com/0/dist/plotly.min.js
curl -H "accept: application/pdf" http://localhost:9091/ -d '{"data": [{"y": ["This", "is", "a", "test", "placeholder"], "x": [12, 9, 15, 12, 0], "type": "bar", "orientation": "h"}], "layout": {"xaxis": {"type": "categorical", "showgrid": false, "zeroline": false}, "yaxis": {"title": "test", "zeroline": false}}} > test.pdf

test.pdf

@antoinerg antoinerg merged commit 6a0ecd2 into master Nov 20, 2020
@antoinerg antoinerg deleted the remove-zero-length-bar-static-plot branch November 20, 2020 15:52
@archmoj archmoj added this to the v1.58.0 milestone Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't add zero-length bars when transitions are off
4 participants