hi,
thanks for the answer... I'm quite new to JavaScript, i wrote this, but
doesn't work...:
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([....]);
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);
};
}
It draw the chart .. but nothing happens when i change the date range...
what's wrong?
thanks,
Marco
--
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/-/X1a9_mKUjesJ.
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.