google / google-visualization-issues

288 stars 35 forks source link

GeoChart : addListener :ERROR Error: Invalid column index null. Should be an integer in the range [0-1] #2653

Open manurag02 opened 6 years ago

manurag02 commented 6 years ago

I am facing two issues One mentioned above and one is cannot read getselection of Null property. Please find the stackblitz below :

I am trying to get country name of the clicked country from Google GeoChart but I am getting the mentioned error by using addListner.

stack Blitz link: https://stackblitz.com/edit/angular-advanced?embed=1&file=src/app/home/home.component.ts&hideExplorer=1&hideNavigation=1

dlaliberte commented 6 years ago

You are also facing the new issue that you need to get your own mapsApiKey in order to use the geocoding service. That might explain some of your other issues as well.

The problem with the invalid column index appears to originate in angular2-google-chart.directive.ts, in the drawGraph method. The caller of getValue in this line in the 'select' listener looks suspicious:

selectedRowValues.push(wrapper.getDataTable().getValue(selectedItem.row, selectedItem.column));

The selectedItem.column is null. This looks like a bug since it is not always true (for all chart types) that the selected item has a row and a column.

I would suspect that the getSelection problem also probably stems from the same issue.

manurag02 commented 6 years ago

I tried the same using angular-google-chart and get the same error : https://stackblitz.com/edit/angular-advanced?embed=1&file=src/app/single-country/single-country.component.ts&hideExplorer=1&hideNavigation=1