getD3Selector cannot return correct data-chartid

This is to fix the issue that getD3Selector() always return [data-chartid=undefined].

The fix changed "attrs" in case attrs['data-chartid'] needs to be used later.

A cleaner change would be just changing the return of this function.