chartWrapper and dataView

382 views
Skip to first unread message

dunba...@gmail.com

unread,
Jan 18, 2016, 1:37:42 PM1/18/16
to Google Visualization API
Does chartWrapper work with dataView? 

In other words, I have

var view = new google.visualization.DataView(data);
view.setRows(view.getFilteredRows([{column: 3, value: 'some category'}]));

var chart = new google.visualization.ChartWrapper({
        chartType: 'ScatterChart',
        containerId: 'chart_div',
        dataTable: data,
view: view,
    });

chart.draw();

...but the 'view' doesn't have any effect on the data drawn in the chart - all the data is drawn. Am I doing something wrong or do I have to use chart.draw(view,options)? 

Thank you!

Daniel LaLiberte

unread,
Jan 18, 2016, 10:25:55 PM1/18/16
to Google Visualization API
Nick,

It may not be clear enough from the documentation, but the ChartWrapper's view property is not for specifying a DataView, but for a view spec that is similar to what a DataView might use.  E.g., you can specify view: { columns: [0, 2, 4] }.   For details, see the drawChart function at https://developers.google.com/chart/interactive/docs/reference#google.visualization.drawchart

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3bed9032-bfcc-44ff-a817-65ebfe76424e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Nick Dunbar

unread,
Jan 20, 2016, 11:24:03 AM1/20/16
to google-visua...@googlegroups.com
Dan, 

Thanks for this reply. What I really want to do is use the output of getFilteredRows() as the chartWrapper input. I had a further question about that. In particular, I wanted to see if it was possible to do Boolean combinations of criteria across different columns. So if I have 
getFilteredRows([{column: 3, value: 'category1'}, {column: 2, value: 'category2'}]

I interpret that in Boolean terms to mean rows where column 3 takes value category1 AND column 2 takes value category2. However, what if I want to select rows where column 3 takes value category1 OR column2 takes value category2, or perhaps rows where column3 does NOT take value category1? Is this possible within the syntax? 

All feedback gratefully appreciated.
Nick 

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/E2P98sKi_6c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

Daniel LaLiberte

unread,
Jan 20, 2016, 1:20:17 PM1/20/16
to Google Visualization API
Nick,

You can specify the row indices in the view property for a ChartWrapper.  But no logical operations other than what you can specify in a query property, if you also use a dataSourceUrl.  That might be enough for you, but I can see that it would be useful to do query operations on local data in a way that avoids code, entirely in a ChartWrapper spec.


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages