Note, it also wise to set the 'ui.allowNone' to false. It is then not possible to select nothing. Works perfect!
See also this thread; https://groups.google.com/forum/?fromgroups#!searchin/google-visualization-api/CategoryFilter$20setState/google-visualization-api/5MSgiBF2F8Y/ciqtEYlROsIJ Regards Peter Op donderdag 21 juni 2012 18:38:12 UTC+2 schreef asgallant het volgende: > > You are welcome. > > On Thursday, June 21, 2012 12:15:24 PM UTC-4, Peetzer wrote: >> >> Wow perfect, exactly what I was looking for! >> >> Thank you!! >> >> Regards, >> >> Peter >> >> On 21 jun 2012, at 17:36, asgallant wrote: >> >> I don't know if anything like this is planned, but I wrote a hack to make >> it work: http://jsfiddle.net/asgallant/WaUu2/ >> >> On Thursday, June 21, 2012 2:02:26 AM UTC-4, Peetzer wrote: >>> >>> Thanks! I thought it would be like this. But actually this is adding a >>> new column, I solved this already in java but good to know this in >>> javascript too. >>> I gives possibilities :) >>> >>> Regards Peter >>> >>> Ps, is also support planned for filtering on column (show only column >>> 'bananas' or 'tomatos') ? Like catergory filter but not only filter on >>> values. >>> On Thu, Jun 21, 2012 at 5:24 AM, asgallant <[email protected]>wrote: >>> >>>> This is not explicitly supported, but you can hack around it using a >>>> DataView with calculated columns: >>>> >>>> var view = new google.visualization.DataView(data); >>>> view.setColumns([0, { >>>> label: 'bananas', >>>> type: 'number', >>>> calc: function (dt, row) { >>>> // if type = bananas, return this value, otherwise return null >>>> if (dt.getValue(row, 2) == 'bananas') { >>>> return dt.getValue(row, 1); >>>> } >>>> else { >>>> return null; >>>> } >>>> } >>>> }, { >>>> label: 'tomatos', >>>> type: 'number', >>>> calc: function (dt, row) { >>>> // if type = tomatos, return this value, otherwise return null >>>> if (dt.getValue(row, 2) == 'tomatos') { >>>> return dt.getValue(row, 1); >>>> } >>>> else { >>>> return null; >>>> } >>>> } >>>> >>>> }]); >>>> >>>> Draw the chart using this view. >>>> >>>> >>>> On Wednesday, June 20, 2012 9:54:28 AM UTC-4, Peetzer wrote: >>>>> >>>>> Is it possible to use column date (date), value (number) and group on >>>>> type (string) and show both types (legends) in graph ? >>>>> >>>>> Column value contains all the values which belong to different types. >>>>> >>>>> >>>>> Date value type >>>>> 20-06-2012 09:00 10 'bananas' >>>>> 20-06-2012 09:30 2 'tomatos' >>>>> 20-06-2012 10:00 5 'tomatos' >>>>> 20-06-2012 10:00 1 'bananas' >>>>> >>>>> Or is it only possible to use a column for each type? >>>>> >>>>> Date value (label 'bananas') >>>>> value2 (label 'tomatos') >>>>> 20-06-2012 09:00 10 >>>>> 20-06-2012 09:30 >>>>> 2 >>>>> 20-06-2012 10:00 >>>>> 5 >>>>> 20-06-2012 10:00 1 >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Google Visualization API" group. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msg/google-visualization-api/-/omorAfOBwCwJ. >>>> >>>> >>>> To post to this group, send email to >>>> [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/google-visualization-api?hl=en. >>>> >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-visualization-api/-/Mt-PtQvfICcJ. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> >> >> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/rIeRkD2gjPEJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
