d3.js - Having issue with translate function -


i have coordinatesx , coordinatesy arrays. example if want draw arc between coordinatesx[1] , coordinatesy[4], part of code goes :

svg.append("path")

    .attr("d", arc)     .attr("fill", "red")     .attr("transform", "translate(coordinatesx[1],coordinatesy[4])"); 

i having problem translate function. says :

error: invalid value attribute transform="translate(coordinatesx[1],coordinatesy[4])"

how can overcome problem?

thanks in advance.

it has single string. salvador pointed out in comments, in example using coordinatesx[1] etc literally. but, if concatenate, javascript creates single string (if add number string, result string). in case:

.attr("transform", "translate(" + coordinatesx[1] + "," + coordinatesy[4]) + ")"); 

Comments

Popular posts from this blog

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -

php - Prepared Statement Inner Join Cannot Pass Parameter by Reference -

c# - Value cannot be null or empty.\r\nParameter name: name -