Accepted answer

i forked your fiddle to a working solution @ the most important code snippet from there is this:

$(window).resize(function() {
    height = chart.height
    width = $("#chartrow").width() / 2
    chart.setsize(width, height, doanimation = true);

the solution bears on this so post's answer.

it seems like the best you can do to resize the chart's container (and cell) properly is to rely on your own resize trigger. note that i set the reflow to "false" in the chart's options to remove the existing trigger.


 * adjust size for hidden charts
 * @param chart highcharts
function adjustgraph(chart) {
    try {
        if (typeof (chart === 'undefined' || chart === null) && this instanceof jquery) { // if no obj chart and the context is set
            this.find('.chart-container:visible').each(function () { // for only visible charts container in the curent context
                $container = $(this); // context container
                $container.find('div[id^="chart-"]').each(function () { // for only chart
                    $chart = $(this).highcharts(); // cast from jquery to highcharts obj
                    $chart.setsize($container.width(), $chart.chartheight, doanimation = true); // adjust chart size with animation transition
        } else {
            chart.setsize($('.chart-container:visible').width(), chart.chartheight, doanimation = true); // if chart is set, adjust
    } catch (err) {
        // do nothing


$(window).resize(function () {
    if (this.resizeto) cleartimeout(this.resizeto);
    this.resizeto = settimeout(function () {
        // resizeend call function with pass context body$('body'));
    }, 500);

for bootstrap tab

$('a[data-toggle="tab"]').on('', function (e) {
    ischart = $(this).attr('data-chart');
    var target = $(this).attr('href');
    if (ischart) {
        // call functio inside context target$(target));

<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
    <li class="active">
         <a href="#anagrafica" data-toggle="tab"><h5>anagrafica</h5></a>
    <li><a href="#consumi" data-toggle="tab" data-chart="1"><h5>consumi</h5></a></li>

on chart

    new highcharts.chart({
            chart: {
                renderto: 'chart-bar',
                defaultseriestype: 'column',
                zoomtype: 'xy',
                backgroundcolor: null,
                events: {
                    load: function (event) {

html code

<div class="tab-pane" id="charts">
    <div class="row-fluid">
        <div class="span6 offset3">
            <div id="mycarousel" class="carousel slide">
                <!-- carousel items -->
                <div class="carousel-inner chart-container">
                    <div class="active item">
                        <h3>chart 1/h3>
                        <div id="bar-pod-annuale">
                           <div id="chart-bar" style="width:100%;margin: 0 auto"></div>
                    <div class="item">
                        <h3>char 2</h3>
                        /** chart **/
                    <div class="item">
                        <h3>char 3</h3>
                        /** chart **/
                <!-- carousel nav -->
                <a class="carousel-control left" href="#mycarousel" data-slide="prev">‹</a>
                <a class="carousel-control right" href="#mycarousel" data-slide="next">›</a>

see example on jsfiddle


you can avoid using javascript to perform the resize and rely on css instead. this can be accomplished by rendering the highchart into a div that has:

position: absolute;
width: 100%;

to make sure that the height of the container is appropriate, you'll have to wrap this absolutely positioned element in another element that has explicitly set height:

position: relative;
width: 100%;
height: 400px;

by rendering the highchart into a position absolute element, the chart will be responsive to width reductions in the parent.

Related Query

More Query from same tag