sorry, there wan an error in the previous post.
this is correct:
 
 google.load('visualization', '1', {'packages':['annotatedtimeline']}); 
google.setOnLoadCallback(drawchart); 
      
function drawchart() { 
 var data = new google.visualization.DataTable(); 
        data.addColumn('date', 'Data'); 
        data.addColumn('number', 'fondo');
 data.addColumn('number', 'Benchmark');
      data.addRows([[new Date(2007, 8, 24), 5, 100], [new Date(2007, 8, 25), 
4.992, 99.3632911510798], [new Date(2007, 8, 26), 5.026, 100.075701244891], 
[new Date(2007, 8, 27), 5.029, 100.568918725117], [new Date(2007, 8, 28), 
5.028, 100.422972180913], [new Date(2007, 9, 1), 5.066, 100.983706987663], [
new Date(2007, 9, 2), 5.105, 101.33220551144], [new Date(2007, 9, 3), 5.116, 
101.223086599886], [new Date(2007, 9, 4), 5.107, 101.199216837983], [newDate(
2007, 9, 5), 5.12, 101.900033047442], [new Date(2007, 9, 8), 5.109, 
101.509796539995], [new Date(2007, 9, 9), 5.132, 101.744811395756]]); 
 
 var chart = new 
google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); 

 var options = {width: 300, height: 300, displayAnnotations: 'false', 
legend: 'right', scaleType: 'allmaximized'};
 chart.draw(data, options);
 
  google.visualization.events.addListener(chart, 'rangechange', normalize); 
 function normalize() { 

  var start = chart.getVisibleChartRange().start;
  var end = chart.getVisibleChartRange().end;
  var fooBase = chart.getValue(chart.getFilteredRows(start)[0], 1);
  var barBase = chart.getValue(chart.getFilteredRows(start)[0], 2);
  var view = new google.visualization.DataView(data);
  view.setColumns([0, {type: 'number', label: 'foo', calc:colone }, {type: 
'number', label: 'bar', calc:coltwo}]);
  function colone(dataTable, rownum) {
   return (dataTable.getValue(rownum, 1)/fooBase);
  }
  function coltwo(dataTable, rownum) {
   return (dataTable.getValue(rownum, 2)/barBase);
  }
  chart.draw(view, options);
 };
} 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/yGiXGDjyvsIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to