mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Merge pull request #851 from jtblin/master
Fix #507 - calculate container width and heigh without padding
This commit is contained in:
commit
a3d4bc0bfe
@ -826,14 +826,21 @@
|
||||
});
|
||||
},
|
||||
getMaximumWidth = helpers.getMaximumWidth = function(domNode){
|
||||
var container = domNode.parentNode;
|
||||
var container = domNode.parentNode,
|
||||
padding = parseInt(getStyle(container, 'padding-left')) + parseInt(getStyle(container, 'padding-right'));
|
||||
// TODO = check cross browser stuff with this.
|
||||
return container.clientWidth;
|
||||
return container.clientWidth - padding;
|
||||
},
|
||||
getMaximumHeight = helpers.getMaximumHeight = function(domNode){
|
||||
var container = domNode.parentNode;
|
||||
var container = domNode.parentNode,
|
||||
padding = parseInt(getStyle(container, 'padding-bottom')) + parseInt(getStyle(container, 'padding-top'));
|
||||
// TODO = check cross browser stuff with this.
|
||||
return container.clientHeight;
|
||||
return container.clientHeight - padding;
|
||||
},
|
||||
getStyle = helpers.getStyle = function (el, property) {
|
||||
return el.currentStyle ?
|
||||
el.currentStyle[property] :
|
||||
document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
|
||||
},
|
||||
getMaximumSize = helpers.getMaximumSize = helpers.getMaximumWidth, // legacy support
|
||||
retinaScale = helpers.retinaScale = function(chart){
|
||||
|
Loading…
Reference in New Issue
Block a user