You'll have to apply the filter to the base data, re-pivot, and then redraw.

On Wednesday, February 6, 2013 6:38:49 AM UTC-5, Workaholic wrote:
>
> Thanks,
> I'm trying to defined the range filter on the third column of the table in 
> "table.jpg" (called in my code visualDataSecondChart).
> The table I want the line chart to draw is in 
> "customizePivot.jpg"(called TwoDTable in my code).
> I'm having problems in binding it all together.
> I've attached a pic of what it draws for now.
> Do you notice something I'm doing wrong?
> Here is my code for drawing the line chart:
>
>     var columnsTable = new google.visualization.DataTable();
>     columnsTable.addColumn('number', 'colIndex');
>     columnsTable.addColumn('string', 'colLabel');
>     var initState = {
>         selectedValues: []
>     };
>     // put the columns into this data table (skip column 0)
>     for (var i = 1; i < TwoDTable.getNumberOfColumns(); i++) {
>         columnsTable.addRow([i, TwoDTable.getColumnLabel(i)]);
>         initState.selectedValues.push(TwoDTable.getColumnLabel(i));
>     }
>
>     var chart = new google.visualization.ChartWrapper({
>         chartType: 'LineChart',
>         containerId: 'secondChart'
>     });
>
>     var columnFilter = new google.visualization.ControlWrapper({
>         controlType: 'CategoryFilter',
>         containerId: 'stringFilterSecondChart',
>         dataTable: columnsTable,
>         options: {
>             filterColumnLabel: 'colLabel',
>             ui: {
>                 label: '',
>                 allowTyping: false,
>                 allowMultiple: true,
>                 selectedValuesLayout: 'belowStacked'
>             }
>         },
>         state: initState
>     });
>
>     var slider = new google.visualization.ControlWrapper({
>         controlType: 'NumberRangeFilter',
>         containerId: 'rangeFilterDiv',
>         dataTable: visualDataSecondChart,
>         options: {
>             filterColumnIndex: 2
>         }
>     });
>
>     google.visualization.events.addListener(columnFilter, 'statechange', 
> function () {
>         var state = columnFilter.getState();
>         var row;
>         var columnIndices = [0];
>         for (var i = 0; i < state.selectedValues.length; i++) {
>             row = columnsTable.getFilteredRows([{
>                 column: 1,
>                 value: state.selectedValues[i]
>             }])[0];
>             columnIndices.push(columnsTable.getValue(row, 0));
>         }
>         // sort the indices into their original order
>         columnIndices.sort(function (a, b) {
>             return (a - b);
>         });
>         chart.setView({
>             columns: columnIndices
>         });
>         chart.draw();
>     });
>
>     columnFilter.draw();
>     
>     var dashboard = new 
> google.visualization.Dashboard(document.getElementById('dashboard_div'));
>     dashboard.bind([slider], [chart]);
>     dashboard.draw(TwoDTable);
>
> Thanks.
>
>
> On Friday, February 1, 2013 7:52:50 PM UTC+2, Workaholic wrote:
>>
>> Hi all,
>> I'm making a pivot chart from a given datasource added as "table.jpg".
>> I'm trying to draw a line chart like the one in "chart.jpg" and add a 
>> string filter on it.
>>
>> What I did to draw the added line chart, was making the table from my 
>> datasource look like the one in "customizePivot.jpg".
>>
>> It works! but causes lots of bugs
>> Is there any other way to do this kind of pivot line chart using 
>> ChartWrapper(without making the table in "customizePivot.jpg")?
>>
>> Thanks
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to