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

Switching to a SVG presentation attribute to assist Microsoft browsers #1723

Merged
merged 1 commit into from
May 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/traces/sankey/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function salientEnough(d) {
}

function linksTransform(d) {
return d.horizontal ? 'matrix(1,0,0,1,0,0)' : 'matrix(0,1,1,0,0,0)';
return d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)';
}

function textGuidePath(d) {
Expand Down Expand Up @@ -444,11 +444,11 @@ module.exports = function(svg, styledData, layout, callbacks) {
.append('g')
.classed('sankeyLinks', true)
.style('fill', 'none')
.style('transform', linksTransform);
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch.

Would anyone be interested in making @alexcjohnson 's strict-d3 wrapper throw an error on selection.style('transform', <>)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I'm working on it now in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to check if the styled element is an SVG element or not. (I'm planning to just check the first element in the selection with sel.node() as selecting both HTML and SVG elements in the same selection is not commonly done.) A linting problem arises:

/Users/robert/repos/plotly/plotly.js/test/image/strict-d3.js
  42:38  error  'SVGElement' is not defined  no-undef

Interestingly the linter doesn't balk on a similar usage.

Have we got an established workaround, or should I just lint-define the SVGElement locally?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we have an established workaround, either lint defining it or var SVGElement = window.SVGElement would be fine by me.

Copy link
Contributor

Choose a reason for hiding this comment

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

var SVGElement = window.SVGElement

Yep, that's the way to go here 👍

.attr('transform', linksTransform);

sankeyLinks.transition()
.ease(c.ease).duration(c.duration)
.style('transform', linksTransform);
.attr('transform', linksTransform);

var sankeyLink = sankeyLinks.selectAll('.sankeyLink')
.data(function(d) {
Expand Down