Skip to content

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

Merged
antoinerg merged 1 commit into
masterfrom
remove-zero-length-bar-static-plot
Nov 20, 2020
Merged

In staticPlot, do not draw-zero length bars#5294
antoinerg merged 1 commit into
masterfrom
remove-zero-length-bar-static-plot

Conversation

@antoinerg

@antoinergantoinerg commented Nov 20, 2020

Copy link
Copy Markdown
Contributor

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.

@antoinergantoinerg changed the title In staticPlot, do not draw zero length barsIn staticPlot, do not draw-zero length barsNov 20, 2020

@alexcjohnsonalexcjohnson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! 💃

@nicolaskruchten

Copy link
Copy Markdown
Contributor

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

@antoinerg

Copy link
Copy Markdown
ContributorAuthor

@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 masterNov 20, 2020
@antoinerg
antoinerg deleted the remove-zero-length-bar-static-plot branch November 20, 2020 15:52
@archmojarchmoj added this to the v1.58.0 milestone Nov 22, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugsomething 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

@antoinerg@nicolaskruchten@alexcjohnson@archmoj