Updated, with sorting on the columns to keep them in the original order: http://jsfiddle.net/asgallant/WaUu2/
On Tuesday, July 17, 2012 2:35:24 AM UTC-4, Alex Stone wrote: > > Thanks for the workaround, asgallant. Wondering if there's a way to make > the redrawn columns retain their existing order after being > selected/deselected, instead of redrawing to the last column? > > On Thursday, June 21, 2012 8:36:58 AM UTC-7, 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/-/axx3CBwIN1YJ. 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.
