explanation of d3.js transform and translate functions -


can explain transform , translate doing here:

d3.transform(d3.select(tick[0]).attr('transform')).translate[1]; 

the tick in above xaxis , value might translate(0,280).

so can see picking out second value of translate function why need wrap in d3.transform?

d3.transform helper function. since there many transformations available eg. translate, rotate, scale , of value goes inside same value field difficult extract single transformation.

<circle cx="10" cy="20" r="15" transform="translate(0,100)scale(2, 2)rotate(180)"></circle> 

but if wrap selected objects transform attribute d3.transform can access individual components d3.transform() functions methods.

eg.

var c = d3.select('circle');  var tx = d3.transform(c.attr('transform')).translate   var scale = d3.transform(c.attr('transform')).scale  var rotate = d3.transform(c.attr('transform')).rotate 

hope helpful.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -