gpt4 book ai didi

javascript - 了解 Google DataTable 前缀

转载 作者:行者123 更新时间:2023-11-30 13:30:37 25 4
gpt4 key购买 nike

Google DataTable 将此字符串作为架构和数据值:

{ 
cols: [{id: 'task', label: 'Task', type: 'string'},
{id: 'hours', label: 'Hours per Day', type: 'number'}],
rows: [{c:[{v: 'Work'}, {v: 11}]},
{c:[{v: 'Eat'}, {v: 2}]},
{c:[{v: 'Commute'}, {v: 2}]},
{c:[{v: 'Watch TV'}, {v:2}]},
{c:[{v: 'Sleep'}, {v:7, f:'7.000'}]}
]
}

什么是 v、f、c?

最佳答案

documentation ,看起来,你从中得到了例子,链接到结构的描述:

opt_data
[Optional] Data used to initialize the table. This can either be the JSON returned by calling DataTable.toJSON() on a populated table, or a JavaScript object containing data used to initialize the table. The structure of the JavaScript literal object is described here. If this parameter is not supplied, a new, empty data table will be returned.

这导致:

rows Property

The rows property holds an array of row objects.
Each row object has one required property called c, which is an array of cells in that row. It also has an optional p property that defines a map of arbitrary custom values to assign to the whole row. If your visualization supports any row-level properties it will describe them; otherwise, this property will be ignored.

Cell Objects

Each cell in the table is described by an object with the following properties:

  • v [Optional] The cell value. The data type should match the column data type. If null, the whole object should be empty and have neither v nor f properties.
  • f [Optional] A string version of the v value, formatted for display. The values should match, so if you specify Date(2008, 0, 1) for v, you should specify "January 1, 2008" or some such string for this property. This value is not checked against the v value. The visualization will not use this value for calculation, only as a label for display. If omitted, a string version of v will be used.
  • p [Optional] An object that is a map of custom values applied to the cell. These values can be of any JavaScript type. If your visualization supports any cell-level properties, it will describe them; otherwise, this property will be ignored. Example: p:{style: 'border: 1px solid green;'}.

关于javascript - 了解 Google DataTable 前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6896418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com