框内未显示Google图表时间轴标签

时间:2018-07-02 11:30:28

标签: charts google-visualization timeline

标签在框外溢出。盒子里有一些标签。其他人只是在外面画画。

google.charts.load('current', {'packages':['timeline']});
      google.charts.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: 'Term' });
    dataTable.addColumn({ type: 'string', id: 'Name' });
    dataTable.addColumn({ type: 'date', id: 'Start' });
    dataTable.addColumn({ type: 'date', id: 'End' });

    dataTable.addRows([
      [ '1', 'George Washington', new Date(1789, 3, 30), new Date(1797, 2, 4) ],
      [ '2', 'John Adams', new Date(1797, 2, 4),  new Date(1801, 2, 4) ],
      [ '2', 'Johndc Adams', new Date(1790, 2, 4),  new Date(1810, 2, 4) ],
      [ '4', 'Johndc Adams', new Date(1770, 2, 4),  new Date(1810, 2, 4) ],
      [ '3', 'Thomas Jefferson',  new Date(1801, 2, 4),  new Date(1809, 2, 4) ]]);

    chart.draw(dataTable);
      }

enter image description here

0 个答案:

没有答案