Adapted survey statistics code after change in charts API.