|
|
@ -938,10 +938,19 @@ c3_chart_internal_fn.bindResize = function () { |
|
|
|
config.onresized.call($$); |
|
|
|
config.onresized.call($$); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var resizeIfElementDisplayed = function() { |
|
|
|
|
|
|
|
// if element not displayed skip it
|
|
|
|
|
|
|
|
if (!$$.api.element.offsetParent) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$$.resizeFunction(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (window.attachEvent) { |
|
|
|
if (window.attachEvent) { |
|
|
|
window.attachEvent('onresize', $$.resizeFunction); |
|
|
|
window.attachEvent('onresize', resizeIfElementDisplayed); |
|
|
|
} else if (window.addEventListener) { |
|
|
|
} else if (window.addEventListener) { |
|
|
|
window.addEventListener('resize', $$.resizeFunction, false); |
|
|
|
window.addEventListener('resize', resizeIfElementDisplayed, false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// fallback to this, if this is a very old browser
|
|
|
|
// fallback to this, if this is a very old browser
|
|
|
|
var wrapper = window.onresize; |
|
|
|
var wrapper = window.onresize; |
|
|
@ -955,7 +964,14 @@ c3_chart_internal_fn.bindResize = function () { |
|
|
|
} |
|
|
|
} |
|
|
|
// add this graph to the wrapper, we will be removed if the user calls destroy
|
|
|
|
// add this graph to the wrapper, we will be removed if the user calls destroy
|
|
|
|
wrapper.add($$.resizeFunction); |
|
|
|
wrapper.add($$.resizeFunction); |
|
|
|
window.onresize = wrapper; |
|
|
|
window.onresize = function() { |
|
|
|
|
|
|
|
// if element not displayed skip it
|
|
|
|
|
|
|
|
if (!$$.api.element.offsetParent) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wrapper(); |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|