Why the Datable/Dataview from Google Visualization API doesn't support array or maps as column type?

17 views
Skip to first unread message

Stephen111

unread,
Dec 7, 2019, 1:07:44 PM12/7/19
to Google Visualization API
Hi All,

I am new to the visualization API, I see the following column types are supported in the DataTable/DataView but I wonder why not array or map or any other nested datatype? or put it another way should I replicate the row if one my columns is an array datatype? for example

Approach #1
------------------
1, foo, [5,7,9]
2, bar, [3,6]


vs

Approach #2
-----------------
1, foo, 5
1, foo, 7
1, foo, 9
2, bar, 3
2, bar, 6


is Approach#2 easier for building charts or visualization perspective than Approach#1? is that why arrays or maps or any other nested types are not supported?


Thanks!


cols Property

cols is an array of objects describing the ID and type of each column. Each property is an object with the following properties (case-sensitive):

  • type [Required] Data type of the data in the column. Supports the following string values (examples include the v: property, described later):
    • 'boolean' - JavaScript boolean value ('true' or 'false'). Example valuev:'true'
    • 'number' - JavaScript number value. Example valuesv:7 , v:3.14v:-55
    • 'string' - JavaScript string value. Example valuev:'hello'
    • 'date' - JavaScript Date object (zero-based month), with the time truncated. Example valuev:new Date(2008, 0, 15)
    • 'datetime' - JavaScript Date object including the time. Example valuev:new Date(2008, 0, 15, 14, 30, 45)
    • 'timeofday' - Array of three numbers and an optional fourth, representing hour (0 indicates midnight), minute, second, and optional millisecond. Example valuesv:[8, 15, 0]v: [6, 12, 1, 144]
Reply all
Reply to author
Forward
0 new messages