frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.9k stars 716 forks source link

Console errors reporting NaN #417

Open andrewgoz opened 9 months ago

andrewgoz commented 9 months ago

I've found in some cases window.getComputedStyle() is returning empty strings for styles.paddingLeft/Right. The following line:

https://github.com/frappe/charts/blob/8f69be05c10635d5726a1aa8843bcfed3c91a786/src/js/utils/dom.js#L85

should probably be changed to something like:

parseFloat(styles.paddingLeft || '0') + parseFloat(styles.paddingRight || '0')
yunsuklee commented 9 months ago

Hey! Should get fixed with the following PR #418. Hope its usefull.

I also added some element type checking.