google getValue 中的可视化日期格式
google visualization date format in getValue
显示dataTable中的数据时,在哪里设置数据格式?以下代码无效。
a.getDataTable().getValue(0, 2, {pattern: "dd-MM-yyy"})
首先,您必须格式化数据 table 值。
您可以使用 Google 的 formatters, in this case the DateFormat class.
之一
一旦数据table加载了数据,
使用格式化程序格式化数据。
// create date formatter
var formatDate = new google.visualization.DateFormat({
pattern: 'dd-MM-yyyy'
});
// format data table column index 2
formatDate.format(dataTable, 2);
然后在显示数据时从数据table,
使用 getFormattedValue
方法,显示格式化值...
dataTable.getFormattedValue(0, 2);
显示dataTable中的数据时,在哪里设置数据格式?以下代码无效。
a.getDataTable().getValue(0, 2, {pattern: "dd-MM-yyy"})
首先,您必须格式化数据 table 值。
您可以使用 Google 的 formatters, in this case the DateFormat class.
一旦数据table加载了数据,
使用格式化程序格式化数据。
// create date formatter
var formatDate = new google.visualization.DateFormat({
pattern: 'dd-MM-yyyy'
});
// format data table column index 2
formatDate.format(dataTable, 2);
然后在显示数据时从数据table,
使用 getFormattedValue
方法,显示格式化值...
dataTable.getFormattedValue(0, 2);