I have data in my google sheets that looks like this:
<https://lh3.googleusercontent.com/-Ah6rMEboPkA/W1ycQdjmL9I/AAAAAAAAANw/6mKgfl08RzweFc_7OpqtZslnRe9gCFrrwCLcBGAs/s1600/Screenshot_2018-07-28%2B12.39.04.png>

I want to insert a timeline chart given in documentation (see below)


But I am getting this error if I create new chart using Google sheets and 
select Timeline with data A1:B99:


<https://lh3.googleusercontent.com/-7bdMQxRj7ig/W1yc91eqobI/AAAAAAAAAN4/vY6PiXINwOU_BBUHDiQpKpYvAF-ay_uYwCLcBGAs/s1600/Screenshot_2018-07-28%2B12.42.13.png>
--------------------------
Controlling the colors

By default, Google Charts chooses colors optimized for aesthetics and 
readability (including users with visual disabilities). You can tailor the 
default behavior with the colorByRowLabel, singleColor, backgroundColor and 
colors options.

The colorByRowLabel option colors all bars on the same row the same. This 
can be a good choice when there are gaps between your bars.

colorByRowLabel defaults to false, so here we override that and set it to 
true.

<script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>

<script type="text/javascript">
  google.charts.load("current", {packages:["timeline"]});
  google.charts.setOnLoadCallback(drawChart);
  function drawChart() {

    var container = document.getElementById('example5.1');
    var chart = new google.visualization.Timeline(container);
    var dataTable = new google.visualization.DataTable();
    dataTable.addColumn({ type: 'string', id: 'Room' });
    dataTable.addColumn({ type: 'string', id: 'Name' });
    dataTable.addColumn({ type: 'date', id: 'Start' });
    dataTable.addColumn({ type: 'date', id: 'End' });
    dataTable.addRows([
      [ 'Magnolia Room', 'Beginning JavaScript',       new Date(0,0,0,12,0,0),  
new Date(0,0,0,13,30,0) ],
      [ 'Magnolia Room', 'Intermediate JavaScript',    new Date(0,0,0,14,0,0),  
new Date(0,0,0,15,30,0) ],
      [ 'Magnolia Room', 'Advanced JavaScript',        new Date(0,0,0,16,0,0),  
new Date(0,0,0,17,30,0) ],
      [ 'Willow Room',   'Beginning Google Charts',    new Date(0,0,0,12,30,0), 
new Date(0,0,0,14,0,0) ],
      [ 'Willow Room',   'Intermediate Google Charts', new Date(0,0,0,14,30,0), 
new Date(0,0,0,16,0,0) ],
      [ 'Willow Room',   'Advanced Google Charts',     new Date(0,0,0,16,30,0), 
new Date(0,0,0,18,0,0) ]]);

    var options = {
      *timeline: { colorByRowLabel: true }*
    };

    chart.draw(dataTable, options);
  }

</script>

<div id="example5.1" style="height: 100px;"></div>


-------------------------


-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/c29e1438-7a01-48a3-9f08-a6d66269ce4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to