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
Hide text on empty slices to avoid PDF exports in MS Word from SVG imports #6335
Changes from 2 commits
d3c1435
e225529
856353b
035d8dd
e8eef1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Hide pie text on empty slices to avoid PDF exports in MS Word from SVG imports [[#6335](https://github.com/plotly/plotly.js/pull/6335)] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,10 +239,18 @@ function plot(gd, cdModule) { | |
transform = positionTitleOutside(cd0, gs); | ||
} | ||
|
||
titleText.attr('transform', | ||
strTranslate(transform.x, transform.y) + | ||
strScale(Math.min(1, transform.scale)) + | ||
strTranslate(transform.tx, transform.ty)); | ||
var scale = Math.min(1, transform.scale); | ||
|
||
if(scale) { | ||
titleText.attr('transform', | ||
strTranslate(transform.x, transform.y) + | ||
strScale(scale) + | ||
strTranslate(transform.tx, transform.ty)); | ||
|
||
titleText.style('display', null); | ||
} else { | ||
titleText.style('display', 'none'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OIC, you prevent even setting the What happens if we later edit this pie, giving this slice nonzero size? Do we reuse the element - and if so do we need to clear the |
||
} | ||
}); | ||
|
||
// now make sure no labels overlap (at least within one pie) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could reproduce this ourselves, but some of the data we have from the Word tests suggests that there's some minimum scale that won't break things. There's certainly some size that succeeds but is already useless for practical purposes so could be deleted, somewhere between 0.1 and 0.01? Ideally we'd make this configurable but maybe we can hardcode something in that range to start?