-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug?] Strange clip-path problem #3260
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
Comments
Some more notes, that I'll edit on the fly:
|
So, it seems that setting https://developer.mozilla.org/de/docs/Web/HTML/Element/base only to the top level domain is adding the whole URL to the clip-path url. |
Hmm, how does that work? Could you share more info here?
I'm not 100% sure what you mean by online.
It would certainly be possible. |
Provide plotly.min.js locally in a local .html-file and open it. This way you don't look at HTML via HTTP but rather as a static file, thus your "protocol" is not http(s):// but rather file://
Wrong wording, I mean over http(s)
That would be awesome, any way this could be included in a mid-term release? Anyone with a CMS running with a base setting will get screwed when using plotly currently EDIT2: Actually, does it even make any sense honoring the base tag for plotly svg? |
The relevant code is here: plotly.js/src/components/drawing/index.js Lines 1003 to 1029 in 3a32ac0
I can't of a reason why Thanks for the report. |
@etpinard It even says
😭 |
For export it shouldn't. But within the page this is necessary if there's a One possibility: if we're asked to download the plot as SVG, we can temporarily clear |
@alexcjohnson Maybe it's safe leaving it out in |
Yes, that's the goal (at least when downloading as SVG, I suspect we still need it to download as PNG etc). The difficulty is the way we currently stash |
@alexcjohnson actually I have the same problem when saving as PNG. I could just trace the cause by looking at the SVG. |
@Braintelligence could you try exporting your graphs using https://19420-45646037-gh.circle-artifacts.com/0/plotly.min.js ? Thank you! |
Using that file doesn't help when testing locally. Same is true when I spin up EDIT: Just to reiterate: This issue surfaces especially when you modify a given plot such that it's drawn objects can actually clip off the plot. For example if you have bars starting at y=0 you can zoom your |
Here's a fiddle you can play around with: https://jsfiddle.net/1Lh8dm49/ See how the xaxis is not clipped at y=0 for the downloaded svg even though the range is set. You also see the base url in the clip-path and when you remove it, the xaxis is clipped as it should be. |
Thanks @Braintelligence for testing this. Turns out I made a dumb mistake. Can you confirm that https://jsfiddle.net/1Lh8dm49/1/ works for you? |
Hi everyone.
So I have this strange problem, where the clip-path in the SVG is wrong due to addition of the location to the clip-path url.
I have the exact same HTML offline, where when you generate the SVG from a
file://
location you get something like:together with:
But when you do the same online you get:
together with:
If you use
.downloadImage
on the original state of each plot, both images are identical. If you do this with a zoomed state, where you pass thex.range
andy.range
to thelayout
for.downloadImage
the resulting image isn't clipped correctly in the online version.This is an image that results of the first code (used offline with file://-URL) after zooming: svg_offline.zip
This is an image that results of the latter code (used online with https://-URL) after zooming: svg_online.zip
When you change
to
(in other words: remove the location part from the url) you get the desired image.
This was tested with the current Firefox 63 as well as Firefox 52 ESR and current Microsoft Edge.
The text was updated successfully, but these errors were encountered: