Google Visualization Dashboard with filter and DataView

Viewed 1455

I have a DataTable that looks something like this:

+-------+---------+--------+
| month |  name   | income |
+-------+---------+--------+
| Jan   | Alice   | $5,000 |
| Feb   | Alice   | $3,000 |
| Mar   | Alice   | $4,500 |
| Jan   | Bob     | $2,750 |
| Feb   | Bob     | $8,000 |
| Mar   | Bob     | $1,000 |
| Jan   | Charlie | $3,500 |
| Feb   | Charlie | $4,100 |
| Mar   | Charlie | $3,900 |
  ...       ...       ...

I wish to display a Google Visualization with one ChartWrapper and one ControlWrapper.

The ChartWrapper will display a Table, but I only want this Table to show the most recent month. To do this I'm using .setView() on the ChartWrapper.

The ControlWrapper will wrap a CategoryFilter on the name column.

The issue I'm running into is that when I try to select a name, it throws an error: Invalid row index ... Should be in range [0-...]

I believe I'm getting this issue because setView accepts a static array of rows to display, but if the table is filtered then the rows to display will be different. I'm calling setView like so:

var recentRows = dataTable.getFilteredRows([
    {
        "column": 2,
        "minValue": dataTable.getColumnRange(2).max
    }
]);
chartWrapper.setView({
    "rows": recentRows
});
1 Answers
Related