react-google-charts icon indicating copy to clipboard operation
react-google-charts copied to clipboard

SetSelection function not working as expected

Open sjstebbins opened this issue 9 years ago • 7 comments

I added a ref to the chart component and am calling: this.refs.userVisitPieChart.wrapper.getChart().setSelection([{row: 1, column: null}] It looks like this.refs.userVisitPieChart.wrapper.getChart().setSelection is exposed correctly by the chart wrapper, but the setSelection function with an argument does not augment the Pie Chart as intended.

sjstebbins avatar Jan 26 '16 18:01 sjstebbins

Hey,

Could you provide some code I can run, to help debug this issue ?

rakannimer avatar Mar 23 '16 10:03 rakannimer

Bump

rakannimer avatar May 25 '16 11:05 rakannimer

I'll create a new issue if this one isn't monitored anymore. I'd also like to see setSeleciton work, which is not defined anywhere in types.d.ts that I can find.

https://developers.google.com/chart/interactive/docs/events

The chart should expose the method setSelection(selection) to change the selection in the underlying table and select the corresponding data in the chart.

I'm trying to set the selection to show all the tooltips on chart load. Thanks for the awesome library by the way.

EricKit avatar Sep 07 '19 17:09 EricKit

Hey @EricKit,

Could you provide some minimal code I can run, to help debug and fix this issue ?

rakannimer avatar Sep 07 '19 17:09 rakannimer

I very well may be missing something. I would expect the setSelection method to be available on a chart.

const chartEvents: [ReactGoogleChartEvent] = [
  {
    eventName: 'ready',
    callback({ chartWrapper }) {
      const table: GoogleDataTable | null = chartWrapper.getDataTable();
      if (table) {
        const selectedRows = [];
        for (var i = 0; i < table.getNumberOfRows(); i++) {
          selectedRows.push({ row: i, column: null });
        }
        chartWrapper.getChart().setSelection(selectedRows); // This does not exist
      }
    },
  },
];

EricKit avatar Sep 07 '19 17:09 EricKit

any update on this?

vieirin avatar May 02 '20 05:05 vieirin

There is no setSelection in the types.d.ts either. Any updates?

apik-procomp avatar Oct 25 '22 08:10 apik-procomp