Does anyone know how to reposition the legend in a NVD3 chart relative to the graph itself?
It is on top by default, and I would like it to go on the side (better use of space within my app)
An example of what I would like to do:
As of this writing (2 jul 2015) nvd3 supports putting the legend to the right of the pie chart.
When you initialize the graph, set legendPosition
to right
.
Example:
nv.addGraph(function() {
var chart = nv.models.pieChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.legendPosition("right");
svg.datum(piedata).call(chart);
return chart;
});
See http://nvd3-community.github.io/nvd3/examples/documentation.html#pieChart