Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart.js usage in LWC context null error #2

Closed
kkeerty opened this issue May 27, 2021 · 1 comment
Closed

Chart.js usage in LWC context null error #2

kkeerty opened this issue May 27, 2021 · 1 comment

Comments

@kkeerty
Copy link

kkeerty commented May 27, 2021

Describe the bug
I used the same code but hard coded the data values.
const ctx = this.template.querySelector('canvas.barChart').getContext('2d'); Failing line

The chart.js file i used is Chart.min.js from their site and added to our sandbox resources as ChartJs

chart.html (i added id also but no effect)

This gives the error message 'cannot get property getContext on null from chart.js line

if I use class="barChart" then getting another message
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.

Appreciate any help.

@kkeerty
Copy link
Author

kkeerty commented May 27, 2021

Please ignore the above. The code as you have mentioned workiing fine. I was using wrong chart.js
Thanks again.

@kkeerty kkeerty closed this as completed May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant