Hi everybody!
I need to limit width of bars in column chart. For example, if I want to limit bar width to 60px, that means that however I resize the column chart bars should never grow larger in width then 60px.
I could not find direct support for this in Highcharts, so I followed some of the advice I found on stack overflow: http://stackoverflow.com/questions/5968 ... umn-charts . Idea is to check width of bars and then put their width to maximum width if they are over it. That works ok if chart renders just once, however if I resize the chart multiple times (for example user changes the size of window few times) those bars that whose width I set manually to maxWidth will not auto-adjust their width any more, but will keep maxWidth.
I resolved that using the following method: When I think bars maybe do not have ok width (which is after any redraw or load) I set bar width to 0 and redraw chart, so they will auto adjust their width (in case some of them are stuck on maxWidth). Then I put those that have to large width to maxWidth and redraw chart again. This works well and resolves the problem from before, however it kills loading animation of chart.
Is there some simpler, cleaner way to do this?
Check fiddle that I implemented, it uses method I described: http://jsfiddle.net/Martinsos/83M3T/ .
Try resizing frame with chart and you will notice how columns never grow larger then 30px, which is great. However, if you run fiddle with large frame (when bars should initially be larger then 30px) there will be no loading animation, which is bad. And the whole method is pretty hackish
Thank you!