It may be better to use the DataTable constructor, but it is not going to make much difference.
But you *can* use an array of arrays with arrayToDataTable, so that is probably simpler for you to use. The array of arrays that you pass to arrayToDataTable is like your array of rows that you passed to addRows, but with an additional first row to define the columns. On Wed, Nov 1, 2017 at 10:02 AM, rocky <[email protected]> wrote: > No problem Daniel. I am newbie and I learned something from these. You > helped me a lot. So if I understand you I need JSON something like : > > { > cols: [{id: 'task', label: 'Employee Name', type: 'string'}, > {id: 'startDate', label: 'Start Date', type: 'date'}], > rows: [{c:[{v: 'Mike'}, {v: new Date(2008, 1, 28), f:'February 28, > 2008'}]}, > {c:[{v: 'Bob'}, {v: new Date(2007, 5, 1)}]}, > {c:[{v: 'Alice'}, {v: new Date(2006, 7, 16)}]}, > {c:[{v: 'Frank'}, {v: new Date(2007, 11, 28)}]}, > {c:[{v: 'Floyd'}, {v: new Date(2005, 3, 13)}]}, > {c:[{v: 'Fritz'}, {v: new Date(2011, 6, 1)}]} > ] > } > ) > > I must create array of my own and then: > > var data = new google.visualization.DataTable(jsonData) > > > Is it better to use arraytodatetable or datatable? >> > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to google-visualization-api@ > googlegroups.com. > Visit this group at https://groups.google.com/ > group/google-visualization-api. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-visualization-api/0f0214e8-e35b-4765-a1df- > be28bf8d54f8%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/0f0214e8-e35b-4765-a1df-be28bf8d54f8%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> 5CC, Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMT-Yo18rJCKS5oZtQL%2ByUVtJnN66dT3L%3DLdoGDgoBHjw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
