I see still one problem in the official documentation At https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatableit is that you told - "The column data types are determined automatically by the data submitted. This method does not support the use of Date or DateTime values, and also does not support use of the JavaScript literal cell object with f or v values: {v: 3.0, f: 'Three'}. If you need to specify custom cell values, or a formatted value, or Date/DateTime value, use DataTable.addRow()/DataTable.addRows() or DataTable.setValue()."
but here https://developers.google.com/chart/interactive/docs/datatables_dataviews#arraytodatatablethere is JSON used in the example (even in the first value): var data = google.visualization.arrayToDataTable([ ['Employee Name', 'Salary'], ['Mike', {v:22500, f:'18,500'}], ['Bob', 35000], ['Alice', 44000], ['Frank', 27000], ['Floyd', 92000], ['Fritz', 18500]], false); // 'false' means that the first column is a label column. So it is hard to say, which official documentation should be prefered :-) Dne pondělí, 20. srpna 2012 17:32:16 UTC+2 asgallant napsal(a): > > 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/-/SkA_4Aq912cJ. 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.
