I want to add a control filter to a StackedColumnChart. I am using com.googlecode.gwt-charts 0.9.10 and com.google.gwt.google-apis 1,0,2. I have been using the showcase at https://gwt-charts.appspot.com/ as a reference - specifically the Category Filter example.
My goal is to enable the user to select the categories that will be displayed in the stacked bar chart, I cannot see how I can use the CategoryFilter due to the layout of the data.
I created a playground project with a small amount of test data. The datatable is created by
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "event");
dataTable.addColumn(ColumnType.NUMBER, "apples");
dataTable.addColumn(ColumnType.NUMBER, "pears");
dataTable.addColumn(ColumnType.NUMBER, "oranges");
for(int i=0;i<5;i++)
{
int row = dataTable.addRow() ;
dataTable.setValue(row, 0, "E"+i);
dataTable.setValue(row, 1, i+1);
dataTable.setValue(row, 2, i+2);
dataTable.setValue(row, 3, i+3);
}
The issue is that if a try to create a dashbord and filter for this chart I have to specify the category column.via a call to CategoryFilterOptions.setFilterColumnIndex(int).
Clearly CategoryFilter is not the correct approach - this will work fine for charts such as pie charts where you have a category selection within a datatable column BUT not for stacked column charts.
what is the best approach to enable the user to select the categories to include in a stackedcolumn chart