How can I set D3 tree direction to right to left?
I'm using following code in order to render the tree, but I would like to set the direction to right to left:
This is a treemap implemented by D3 and its current direction is LTR and also it is a collapsible tree.
var treeData = "";
var margin = { top: 20, right: 90, bottom: 30, left: 90 },
width = 1900 - margin.left - margin.right,
height = 900 - margin.top - margin.bottom;
var svg = d3.select("#chart").append("svg")
.attr("width", 1600)
.attr("height", 3200)
.append("g")
.attr("transform", "translate("
+ margin.left + "," + margin.top + ")");
var i = 0,
duration = 2000,
root;
var treemap = d3.tree().size([height, width]);
root = d3.hierarchy(treeData, function (d) { return d.children; });
root.x0 = height / 2;
root.y0 = 0;
root.children.forEach(collapse);
update(root);
function collapse(d) {
}
function update(source) {
}