matchType in CategoryFilter?

49 views
Skip to first unread message

Ray Thomas

unread,
Jun 28, 2017, 2:06:11 PM6/28/17
to Google Visualization API
Before I start trying to write my own function, is there something similar to the matchType option in StringFilter that can be applied to CategoryFilter? Something similar to Awesome Table's csvFilter - https://support.awesome-table.com/hc/en-us/articles/115001068189-Available-filters#6

I know I can get CategoryFilter to select its own choices from what's available in the chosen column - https://jsfiddle.net/brisray/9vj7r014/ and I know I can get the dropdown to use my own values - https://jsfiddle.net/brisray/9vj7r014/1/

But is there a way to use the second of those to look for a substring in the chosen column without coding it myself?

Ray




Ray Thomas

unread,
Jun 29, 2017, 2:39:46 PM6/29/17
to Google Visualization API
It's done and was much easier than I first thought.  I wanted to keep the original datatable so needed to create a new dataview, I thought I might have to step through the datatable in a loop to create a new dataview but after re-reading the docs found I didn't have to.

I added my own select dropdown with a listener for changes in that and then used setRows and the "test" property of getFilteredRows to get the rows I wanted to put in the dataview.

setRows - https://developers.google.com/chart/interactive/docs/reference#DataView_setRows
getFilteredRows - https://developers.google.com/chart/interactive/docs/reference#DataTable_getFilteredRows (but the "test" property is not fully explained and it took a bot of experimentation to see how to use it)


Daniel LaLiberte

unread,
Jun 29, 2017, 2:51:11 PM6/29/17
to Google Visualization API
Ingenious, though I agree, there should be some way to override the default set of options for the CategoryFilter. Setting an explicit list should be a relatively easy feature to add.

--
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-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@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/d3d3edf0-535e-4bd9-afb2-23827544227e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages