Better responsive sizing

This commit is contained in:
Tanner Linsley 2015-06-16 13:06:34 -06:00
parent 088b4fcc55
commit 63530ba66d
5 changed files with 12 additions and 8 deletions

8
Chart.js vendored
View File

@ -71,6 +71,7 @@
Chart.defaults = {
global: {
responsive: true,
responsiveAnimationDuration: 0,
maintainAspectRatio: true,
events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"],
hover: {
@ -83,6 +84,7 @@
// Element defaults defined in element extensions
elements: {}
},
};
@ -1092,7 +1094,7 @@
dropFrames: 0,
addAnimation: function(chartInstance, animationObject, duration) {
if (!duration) {
if (typeof duration !== 'number' || duration === 0) {
chartInstance.animating = true;
}
@ -1633,10 +1635,10 @@
// Cascade the resize event down to the chart.
if (instance.options.responsive) {
instance.resize();
instance.update();
instance.update(Chart.defaults.global.responsiveAnimationDuration);
}
});
}, 50);
}, 16);
};
})());

4
Chart.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@
dropFrames: 0,
addAnimation: function(chartInstance, animationObject, duration) {
if (!duration) {
if (typeof duration !== 'number' || duration === 0) {
chartInstance.animating = true;
}

View File

@ -71,6 +71,7 @@
Chart.defaults = {
global: {
responsive: true,
responsiveAnimationDuration: 0,
maintainAspectRatio: true,
events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"],
hover: {
@ -83,6 +84,7 @@
// Element defaults defined in element extensions
elements: {}
},
};

View File

@ -20,10 +20,10 @@
// Cascade the resize event down to the chart.
if (instance.options.responsive) {
instance.resize();
instance.update();
instance.update(Chart.defaults.global.responsiveAnimationDuration);
}
});
}, 50);
}, 16);
};
})());