0👍
Found the issue on the same day posted. Sorry for replying late.
Issue was I am using charts array for canvas to iterate and create canvas. Canvas array is using canvas template variable, kind of a deadlock. So always I am getting element reference for canvas undefined. Got fixed. Let me know if any one need the other code, I can post it.
Source:stackexchange.com