trading-peter / chart-elements

Chart.js as Polymer Elements
https://robdodson.github.io/chart-elements
267 stars 70 forks source link

Fix getComputedStyle null value from Chart.js in IE 11 #82

Closed danipv closed 4 years ago

danipv commented 4 years ago

Hello!

I found a bug when a chart component is used in IE11.

Since the components has been migrated to lit I get this error on chart-pie draw:

Unable to get property 'getPropertyValue' of undefined or null reference

The error is raised when the library Chart.js try to get a computed styles, this is due to the _getParentNode helper function cannot get the right parent of canvas because the parent is not an HTML element but a Javascript object.

The problem is solved wrapping the canvas element with a div, in this way Chart.js can get a parent HTML element and calculate the styles properly.

Actually in the polymer version there was a div wrapping the canvas, I guess for this reason, but in the migration to lit was lost.

trading-peter commented 4 years ago

Ah thanks. I will merge and release that next week.

danipv commented 4 years ago

Hi Peter, have you had the chance to look at this? Thanks a lot!

trading-peter commented 4 years ago

New version is published :)