How to add a gap between the nvd3 legend and the chart

怎甘沉沦 提交于 2019-12-08 03:27:48

问题


I'm aware that this question might have be asked before, and as i tried looking to get the answer for this issue, i haven't really found one. Similar to the fiddle here: http://jsfiddle.net/rdesai/vfe2B/51/, im trying to add gap between legend and chart by doing:

  graph.select(".nv-wrap.nv-legendWrap nv-legend nv-series").attr("transform", "translate(100,75)").style('padding','200px');
  graph.select(".nv-wrap.nv-lineChart").attr("transform", "translate(100,75)");

With this approach im able to move the position of the chart, however when i click on one of the legend( turn on/off circle), the chart goes back to its original position. i also tried:

chart = nv.models.lineChart().options({
                width: 1050
            }).margin({top: 0, right:30, left:80, bottom: 150});

but no luck.. any ideas on how this one can be solved?? Thanks!


回答1:


You should try like below:

chart = nv.models.lineChart()
chart.legend.margin({top: 0, right:30, left:80, bottom: 150});

Updated your fiddle

Hope it helps:)



来源:https://stackoverflow.com/questions/27553142/how-to-add-a-gap-between-the-nvd3-legend-and-the-chart

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