Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add y axis label to NVD3 Multi-Bar Chart

I'm trying to add axis labels to a NVD3 Multi-Bar Chart, but it only seems to work for the x axis. Is there any way around this?

I have set up an example here: http://jsfiddle.net/msts1jha/2/

var chart = nv.models.multiBarChart();

chart.xAxis
    .tickFormat(d3.format(',f'));

chart.yAxis
    .tickFormat(d3.format(',.1f'));

chart.xAxis.axisLabel("x axis");
chart.yAxis.axisLabel("y axis");
like image 480
user3170702 Avatar asked Oct 12 '14 14:10

user3170702


1 Answers

Your yAxis is hidden, set the left margin on your chart, and it will work.

Try this :

var chart = nv.models.multiBarChart().margin({left: 100});

More info regarding margins have a look here

Hope it helps

like image 157
shabeer90 Avatar answered Oct 23 '22 02:10

shabeer90