score:8
According to the MDN docs for transform-origin, the status of transform-origin
for SVG
is Compatibility Unknown. So it may not be implemented yet in Safari.
However, if you remove the transform-origin
attributes completely, you can use the second and third arguments of the rotate()
function to define the center of rotation for your selected element. e.g.
Your image's x
, and y
values are 325 and 150 respectively, and the width and height are both 100. So the center of rotation should be the x
and y
values plus half the width and height (50) giving 375 and 200.
function rotate(val){
rotate_val = rotate_val + val;
// note the rotate function now contains second and third argument,
// which specify the center of rotation.
var transform = "translate(0, 0) scale(1, 1) rotate("+rotate_val+ ", 375, 200)";
d3.select("g").transition()
.duration(1200)
.attrTween("transform",function(interpolate) {
return d3.interpolate(transform, transform);
});
}
Source: stackoverflow.com
Related Query
- CSS transform-origin not working for svg in safari
- Title Attribute not working for an SVG Rect on Safari
- d3 transition for transform translate not working for DIV
- CSS transform rotate not working in internet explorer 11
- Positioning svg x/y coordinates with css not working with iOS devices?
- Adding image to svg container using d3 not working on FF and Safari
- Position relative is not working in Safari 11 Dagre-d3 svg
- Some CSS styles not working on SVG
- Bootstrap popovers for SVG elements not working with jQuery 3.0.0
- patternTransform in svg not working for entire pattern
- d3.js - mouseover event not working properly on svg group
- CSS padding property for svg elements
- D3 - Positioning tooltip on SVG element not working
- Javascript event listener for SVG transform
- D3: Zooming/Panning Line Graph in SVG is not working in Canvas
- Breaking D3 in separate HTML, JS and CSS files not working
- SVG clip-path works in Chrome, but not in Firefox or Safari
- Collision detection for nodes of varying sizes not working as expected
- SVG text element text-anchor="middle" not working in Firefox
- svg <a> element not working
- SVG Marker Not Working
- Rickshaw : data for multiple series not working
- SVG not working in Firefox 18
- d3.js 'mousewheel' event is NOT working on Firefox (it works only in Chrome, Safari and IE browsers)
- Svg scale() is not working on Edge(Not Edge Chronium)
- Select SVG elements using rectangle select box not working during zoom : d3.js
- Looking for a way to display labels on sunburst chart (could not find a working example)
- When loading CSS with webpack, I can write CSS for tags, but not for classes or ids
- Exit() is not working for d3 group bar chart
- Svg semantic zoom not working on SVG in HTML
More Query from same tag
- ignoring a group with the D3 nest function
- How do I add a label to a d3-generated convex hull?
- tickSubdivide not always working?
- What is the best way to combine multiple csv files data input using d3.csv in d3.json ?
- dynamic js with phantomjs in local html file
- Cant Get D3 To Even Print Text
- Uncaught TypeError: Cannot read properties of undefined (reading 'document')
- Scaling d3's histogram x domain causes "Invalid negative value for <rect> attribute" errors
- Search functionality for D3 bundle layout
- D3.js radial collapsible radial tree (1 branch per ramification)
- Iterating over all tick marks except the last one
- Updating text elements in d3.js
- D3js increase space between X axis
- How to create a grouping key in D3js that is a combination of two JSON attributes
- Using selectors to retrieve fill and stroke colors?
- D3 - Passing variable to x scale
- Bubble chart using d3.geo.mercator
- d3 drag node behaviour doesn't work
- D3 merge colors to gradients
- Simple way of making an SVG block in React have a gradient of color using D3.js
- Watching for updates nested within multiple objects passed into angular component
- How to calculate sum of arc values
- dimple js straight line y-axis over bar chart
- How to zoom with d3
- D3js canvas and line are not visible
- D3: passing object in style method is not working
- c3.js timeseries graph with percentage y axis
- How to update a data of a node in d3 force layout using react
- Get data from mysql with json and plot with D3
- How can I send a csv file to d3.js in Django?