问题
I was wondering how I can set minimum and maximum radii of the circles in an NVD3 scatter chart.
NVD3 Scatter: http://nvd3.org/ghpages/scatter.html
回答1:
Call .sizeRange([minArea, maxArea])
on your chart object. Note that "size" is proportional to area, not radius, so you need to use the square of the maximum/minimum radius (adjusted by pi/2 if you want to be precise).
回答2:
As of 1.7.1, call .pointRange([minArea,maxArea])
.
回答3:
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.sizeRange([1000, 100]) /*****Chart Circle Range******/
.showDistY(true)
.color(d3.scale.category10().range());
chart.xAxis.tickFormat(d3.format('.02f'));
chart.yAxis.tickFormat(d3.format('.02f'));
d3.select('#chart svg')
.datum(data(4,40))
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
Use this this link or apply the above code into this LINK
.sizeRange([minArea, maxArea])
example: .sizeRange([1000, 100])
来源:https://stackoverflow.com/questions/21104118/nvd3-scatter-chart-circle-radius