GithubHelp home page GithubHelp logo

d3-transform's People

Contributors

davidbkemp avatar fil avatar micahstubbs avatar seliopou avatar trinary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d3-transform's Issues

adding transition

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?

d3-transform is difficult to use with node tools, resulting in "d3 not defined" errors

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:

  • d3-transform adds itself to d3.svg but, unfortunately, d3 no longer adds itself to the global namespace if d3 has been loaded using node's "require" method.
  • package.json refers to a non-existent index.js

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.

Use with ES6 (webpack/babel)

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 :)

Append one transform chain to another (concat chains)

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);

url for this

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.