相关疑难解决方法(0)

Google Charts API:向时间线添加空白行?

我正在尝试创建一个今天工作的人员列表,以及他们的开始和结束时间。这对于有记录的人来说没有问题,但我不知道如何让谷歌的时间线图表打印某人的名字,然后在图表上没有条目。

这是文档,但它没有说明空白条目:

https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline#BarsOneRow

这是我的代码示例:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["timeline"]});
google.setOnLoadCallback(drawChart);

function drawChart() {
    var container = document.getElementById('timeline');
    var chart = new google.visualization.Timeline(container);
    var dataTable = new google.visualization.DataTable();

    dataTable.addColumn({ type: 'string', id: 'Employee' });
    dataTable.addColumn({ type: 'date', id: 'Start' });
    dataTable.addColumn({ type: 'date', id: 'End' });
    dataTable.addRows([
            [ 'Spiderman', new Date(2015, 04, 07, 04, 43, 49),  new Date(2015, 04, 07, 06, 45, 05), ],
            [ 'Iron Man',  new Date(2015, 04, 07, 04, 40, 53),  new Date(2015, 04, 07, …
Run Code Online (Sandbox Code Playgroud)

javascript charts google-api

5
推荐指数
1
解决办法
4102
查看次数

标签 统计

charts ×1

google-api ×1

javascript ×1