mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-09 09:46:51 +01:00
Correctly handle decimal display size (#4009)
Fix the `readUsedSize` regular expression to correctly parse (truncate) pixel decimal values.
This commit is contained in:
@@ -33,7 +33,7 @@ module.exports = function(Chart) {
|
||||
*/
|
||||
function readUsedSize(element, property) {
|
||||
var value = helpers.getStyle(element, property);
|
||||
var matches = value && value.match(/(\d+)px/);
|
||||
var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
|
||||
return matches? Number(matches[1]) : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user