trinary / d3-transform Goto Github PK
View Code? Open in Web Editor NEWadd an interface for svg transform attributes in d3.js
License: MIT License
add an interface for svg transform attributes in d3.js
License: MIT License
Hi trinary, did you pull it back from bower? Couldn't find it on http://bower.io/search/?q=d3-transform .
I'm playing around with your transform approach and I really like the ability to re-use the it -- after moving stuff around, I discovered I could animate also them too by doing the following but lost the re-use:
var transform = d3.svg.transform()
.translate(function(d) { return [20, d.size * 10] })
.rotate(40)
.scale(function(d) { return d.size + 2 });
d3.select("#myComplexPath")
.data([{ size: 5 }, { size: 10 }])
.on("click", function(){ console.log("clicked!" })
.transition()
.duration(1000)
.delay(100)
.attr('transform', transform);
d3.select("#anotherComplexPath")
.data([{ size: 5 }, { size: 10 }])
.on("click", function(){ console.log("clicked!" })
.transition()
.duration(1000)
.delay(100)
.attr('transform', transform);
As you can see, I can't re-use the transition code like I can with your transform object. Have you considered mapping it to the transform too? Or creating a separate transition object?
This lib seems universally valuable to those using d3, but not quite worth including as an additional project dependency.
Did @mbostock reject this idea?
would you please consider adding tags for each version so that we can add your lib on https://cdnjs.com/ with git auto-update.
thank you very much!
cdnjs/cdnjs#5836
hi, recently we want to add your lib on https://cdnjs.com.
i saw bsd license in package.json but MIT in readme.md, I want to confirm this with you.
thank you very much!
Firstly, thanks for providing d3-transform. I am finding it quite useful and generally pleasure to use.
However, d3-transform is difficult to use with node tools like "browserify".
There are two problems:
It leads to "d3 not defined".
d3-transform.js should only attempt to assign the "transform" method to d3.svg if d3.svg exists, and should also assign the "transform" method to module.exports if module.exports exists. Perhaps even add it to the global namespace if neither d3 nor module.exports are defined.
Hi there.
I can't seem to get this to work work in my simple webpack/babel setup, no matter what I do.
I've tried importing the following ways:
import 'd3-transform';
import d3Transform from 'd3-transform';
import * as d3Transform from 'd3-transform';
// and
var d3Transform = require('d3-transform');
But in all cases I get an Uncaught TypeError: [x] is not a function
where [x]
is whichever d3-transfom function I am trying to invoke. I have tried using both d3.transform()
and d3Transform()
but without any luck.
I'm sorry if I haven't provided enough detailed information, but at this point I am not quite sure where to begin.
Thanks on beforehand :)
If you have two existing transform objects, it would be great if you could append one to another after constructing. This is required for better transform reuse.
Example (zoom with a center point):
import d3Transform from 'd3-transform';
const zoomTransform = d3Transform().scale(1.5);
// The 'x' and 'y' are calculated from the bounding box.
const originForwardTransform= d3Transform().translate([ x, y ]);
const originBackwardTransform= d3Transform().translate([ -x, -y ]);
// Notice the order.
const zoomCenteredTransform = d3Transform()
.concat(originForwardTransform)
.concat(zoomTransform)
.concat(originBackwardTransform);
Hi,
plugin works fine except when calling
.attr("transform", translate)
.attr("transform", translate)
.attr("transform", translate)
==> we've got 3 "translate" in the same "transform" attribute.
Would be nice if this got a URL comparable to
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js
There there's no need for me to copy the script to local.
I also tried to directly include
https://raw.githubusercontent.com/trinary/d3-transform/master/src/d3-transform.js
but that results in
Refused to execute script from
'https://raw.githubusercontent.com/trinary/d3-transform/master/src/d3-transform.js'
because its MIME type ('text/plain') is not executable,
and strict MIME type checking is enabled.
Thanks!
For me, d3-transform is very useful!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.