how to set height and width of nvd3 chart

前端 未结 2 1086
别跟我提以往
别跟我提以往 2020-12-10 01:29

I\'m trying to set the width and height of a nvd3 multi bar chart programmatically using

chart.width(600);
chart.height(400);

See the examp

2条回答
  •  温柔的废话
    2020-12-10 02:09

    For the AngularJs version (angular-nvd3), I had to add the height either in chart options and as an attribute:

    chart.html

    
        
    

    chart.controller.js

    vm.chartOptions = {
        chart : {
            height : 250,
            type : "pieChart",
            donut : true,
            showLegend : false,
            //The rest of the configuration
    };
    

    As it is told in the comments, first seems to control the height of the inner svg and the second does the global chart height.

提交回复
热议问题