NVD3 Scatter Chart Circle Radius

旧时模样 提交于 2019-11-28 01:36:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!