timeline Dashboard/chartwrapper/controwrapper

Skip to first unread message

Thomas B

Oct 29, 2021, 4:07:33 AM10/29/21
to Google Visualization API

im trying to use a timeline with a control inside a dashboard.
But it fails to load with some sort of bugs.
below the dashboard, i put the chart alone in chart_div just to see that a timelinechart is working.
here is my code so far.
Can anyone give me a bit of help?

  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  <script type="text/javascript">
    google.charts.load('current', {'packages':['timeline', 'controls'], 'language': 'de'});
    function drawChart() {
      var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div'));
      var timeRangeSlider = new google.visualization.ControlWrapper({
          'controlType': 'ChartRangeFilter',
         'containerId': 'filter_div',
          'options': {
              'filterColumnLabel': 'Start'
      var timelineChart = new google.visualization.ChartWrapper({
          'chartType': 'timeline',
          'containerId': 'chart_div1',
      var data = google.visualization.arrayToDataTable([
      ['Role', 'Name', 'Start', 'End'],
        ['Research', 'Find sources', new Date(2021, 9, 1), new Date(2021, 9, 5)],
        ['Outline', 'Outline paper', new Date(2021, 9, 6), new Date(2021, 9, 8)]
      var container = document.getElementById('chart_div');
      var chart = new google.visualization.Timeline(container);
      var dataTable = new google.visualization.DataTable();
      dataTable.addColumn({ type: 'string', id: 'Role' });
      dataTable.addColumn({ type: 'string', id: 'Name' });
      dataTable.addColumn({ type: 'string', role: 'tooltip' });
      dataTable.addColumn({ type: 'date', id: 'Start' });
      dataTable.addColumn({ type: 'date', id: 'End' });
        ['BLAKE', 'Erster task', '',  new Date(2021, 9, 21,12,0,0), new Date(2021, 9, 23,15,0,0) ],
        ['GORDON', 'zweiter Task', 'Hier ist was zu tun',  new Date(2021, 9, 25,12,0,0), new Date(2021, 9, 30,15,0,0) ],
      var options = {
        timeline: { groupByRowLabel: false },
        backgroundColor: '#ffd'
          dashboard.bind(timeRangeSlider, timelineChart)
      chart.draw(dataTable, options);
    <div id="dashboard_div" style="border: 1px solid #ccc">
      <div id="filter_div"></div>
      <div id="chart_div1" style="height: 180px;"></div>
      <div id="chart_div" style="height: 180px;"></div>

Reply all
Reply to author
0 new messages