Hi. Calling the draw method again should work. Double check to see that all the variables are indeed available when you are inside the called function.
Viz Kid On Sat, Mar 6, 2010 at 2:29 AM, Enock <[email protected]> wrote: > Hi, > > I have a static set of data for a chart for a range chart. The data > is changes in percentage. I would like to rebase all the data to > start at 0 when the range changes. > > I have got the google.visualization.events.addListener(chart1, > 'rangechange',function(event) {}) to work and I can now isolate the > correct date to make zero. > > I have been going through the data and altering the values to rebase > it, BUT the chart does not update... > > Any clues would be gratefully received. > > Yours > > Enock > > var dataChanged = data.clone() > > var chart1 = new > > google.visualization.AnnotatedTimeLine(document.getElementById('dave_chart')); > chart1.draw(dataChanged, {displayAnnotations: false}); > > google.visualization.events.addListener(chart1, > 'rangechange',function(event) { > r1 = chart1.getVisibleChartRange(); > var value = 0.0; > var i=0; > do > { > var currCell = data.getValue(i,0); > > if ( r1.start < currCell ) { > value = data.getValue(i-1,1); > i = data.getNumberOfRows(); > alert('Found the date '+r1.start+' is more than > '+currCell+' value '+value+' i '+i); > } > i++; > } > while(i<data.getNumberOfRows()); > > for(i=0;i<dataChanged.getNumberOfRows();i++) { > dataChanaged.setValue(i,1,data.getValue(i,1)-value); > } > chart1.draw(dataChanaged, {displayAnnotations: false}); > }); > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-visualization-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. 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.
