Search code examples
angularjsd3.jschartsnvd3.jsangular-nvd3

Using NvD3 charts, how to get x axis and Y axis label for multichart?


I am using multiChart of nvd3 for dual Y axes purpose. All series are Line series in my chart.

I want to show X-axis label and Y axis label.

The documentation http://nvd3-community.github.io/nvd3/examples/documentation.html#multiChart for this chart does not have a label property.

Can anyone guide me for showing the x and y1, y2 axes labels?


Solution

  • If I understood the question correctly, you'll need to set the axis labels as follows:

        chart.xAxis
            .axisLabel('X AXIS');        
    
        chart.yAxis1
            .axisLabel('Y AXIS 1');
    
        chart.yAxis2
            .axisLabel('Y AXIS 2');
    

    Complete example at https://jsfiddle.net/ovvn/f0Lautw0/1/