2

I am using angular-nvd3 horizontal bar charts. I need the size of the chart to be dynamically adjusted, so that the bars are of the same size always.

The current functionality is such that, on click of a bar in one bar chart another bar chart is created. The data passed to the bar second bar chart is dynamic, so the height cannot be set as a constant using the height property. If i give the height as a constant value, and the data passed is large, the bars become very thin to accommodate all the values.

Can you please suggest a method where the height can be set dynamically so that the bars are of equal height.enter image description here

This is what i hope to achieve.

Shabbir
  • 86
  • 3

1 Answers1

0

You can try using $watch. I guess the data from the second bar chart is stored in a list or something. By watching over list length you can (maybe) set the new height of the bar chart. This is what you want, right? I don't say is the best way, but in this moment, this is what I think you can try. Is not that easy but is a stable way to do that dinamically.

dpaul1994
  • 332
  • 3
  • 16