I think binding update problems with XY Chart have been fixed in 8.1.22.
See the changelog.
4429: XY Chart Expression Tag History binding with dynamic path causes Component Error
Fixed an issue with the XY Chart where the chart would not load when using a dynamic expression tag history bindings and switching views.
This had been a big puzzle for me and as a workaround I was refreshing the page on load. The upgrade fixed it.
Well that script is not complete and might run into a runtime error: it returns dictionnaries which is declared in an if statement. If the if is not entered, dictionnaries will not exist and can't be returned.