1

I'm trying to figure out how to change the ranges of my y-axis in the nvd3 charts on my angular app. I'm using Krispo's Angular-NVD3 library, and looked into his forums and documentation for directives involving forceY. In this forum Krispo mentions that all I need to do is to add the following code to the chart array in my controller:

    bars: {
      forceY: [100], 
    },

I've tried adding this to my app, but it doesn't work. I've also looked into other nvd3/d3 directives that might solve my issue, for example adding a forcey="[5000]" directive to the <nvd3> tag in my markup, but this didn't work for me either. There seems to be plenty of different ways to do this, but none of them seem to be working.

Also, is it possible for me to set one of the values (max or min) to an angular expression? So something like the following: `forcey="[0,{{data.value}}]"? This is essentially what I need to do, because in my app, several of the reports charts, like the one under "Top 5 SIC by Comments", has the y-axis maximium value set to the minimum value of the data set. I need to change this so that the minimum y-axis value is 0, and the corresponding max value is an angular expression with the piece of data corresponding to the maximum data value.

Any help would be appreciated.

Edit: I've added the angular-nvd3-directives.js file to the app, and added the dependency to the app. In the examples I found online it seems that this library is also needed, however the nvd3 tag in the markup is different (it has something like nvd3-discrete-bar-chart whereas I just have nvd3. I'm not sure why its different - does this mean the library I'm using doesn't work with angular-nvd3-directives?

Nick Borisenko
  • 494
  • 3
  • 18

0 Answers0