Get Highcharts width

In chart object you have access to chartWidth parameter, which keeps width of chart.

http://jsfiddle.net/7xNQL/1/

//callback
    function(chart){

                console.log(chart.chartWidth);

            }

Finally I have find a solution, using the method "container":

$(chart.container).width()

This returns the current width of the chart.


You could use the xAxis extreme.max and translate it to pixels. Something like (not tested):

Chart.xaxis[0].toPixels( chart xaxis[0].getExtremes().max )

It feels like there should be an easier way, but I guess I would have used the containing div width. Maybe you could use chart options to get the containing div I'd and get the width from that.