-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
src/traces/pie/plot.js
Outdated
strScale(scale) + | ||
strTranslate(transform.tx, transform.ty)); | ||
} else { | ||
titleText.style('display', 'none'); |
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.
OIC, you prevent even setting the transform
attribute when we're going to hide the text. That seems reasonable. After a little investigation it seems we DON'T delete empty slice paths, so what we're seeing from Word must be an extra automatic optimization it does to remove elements with no visible impact. I wish it extended that optimization to scaled-down text 😜
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 display: none
in the if(scale)
block?
src/traces/pie/plot.js
Outdated
strTranslate(transform.tx, transform.ty)); | ||
var scale = Math.min(1, transform.scale); | ||
|
||
if(scale) { |
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?
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.
💃
@plotly/plotly_js