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 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.

Reply via email to