Ok, I see what you are saying. I suspect that the API uses the first data
row to determine the data type of each column, and for whatever reason, it
doesn't work with the object-literal syntax there. In any case, according
to the documentation, the object-literal syntax isn't officially supported,
so I would say that getting it to work at all (even limited as you have
found) should really be classified as a "bug".
On Saturday, August 18, 2012 4:50:11 AM UTC-4, Zdenek wrote:
>
> You told, that: The #arrayToDataTable method doesn't support the
> object-literal syntax (the {v: value, f: "formatted value"} notation).
>
> The formatter has to be supported in #arrayToDataTable, but it is
> supported in strange way.
>
> This is working:
> var table = [
> ['Year', 'Votes'],
> ['item 1', 387],
> ['item 2', {v: 465, f: 'test'}],
> ['item 3', {v: 610, f: 'test'}]
> ];
>
> This not:
> var table = [
> ['Year', 'Votes'],
> ['item 1', {v: 387, f: 'test'}],
> ['item 2', {v: 465, f: 'test'}],
> ['item 3', {v: 610, f: 'test'}]
> ];
>
> That is the problem... If you use the formatter in the first value,
> corechart gives you the error "Invalid value in 0,1". I mean that is not
> correct.
>
>
> Dne pátek, 17. srpna 2012 17:20:19 UTC+2 asgallant napsal(a):
>>
>> Your example works exactly as it is supposed to. The tooltip for "Item
>> 1" says "Votes: 387" while the tooltips for "Item 2" and "Item 3" both say
>> "Votes: test". What is the problem here?
>>
>> On Friday, August 17, 2012 2:12:16 AM UTC-4, Zdenek wrote:
>>>
>>> Hi, I dont think so. There is written in the example, that it is
>>> possible to use {v: value, f: 'formatted value'} (
>>> https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatable
>>> ).
>>> But try thisone table data
>>>
>>> var table = [
>>> ['Year', 'Votes'],
>>> ['item 1', 387],
>>> ['item 2', {v: 465, f: 'test'}],
>>> ['item 3', {v: 610, f: 'test'}]
>>> ];
>>>
>>> it is working and there are formatted all rows except "item 1". I don't
>>> know why, I think there is an error in the google.corechart.
>>>
>>>
--
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/-/6fLQ0L7IqJ8J.
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.