I was having the same issues--wanting to change the data table based on user actions, and not seeing any change from just calling draw(). By trial and error, however, I discovered that changing something in the options array DOES trigger a redraw when you call draw() again. I don't think it works any better than recreating the object (it blanks the area and completely redraws it; you see the "initializing" progress bar again) but perhaps it would get around your Flash problem.
Scott Gilkeson On May 3, 11:33 am, ChartMan <[email protected]> wrote: > Thanks for your comments. > I am noting them down. > > ChartMan > > > > On Mon, May 3, 2010 at 3:24 AM, Paulo Mendes <[email protected]> wrote: > > Thanks for the reply. > > > Reloading will be okay (although it's a bit of an annoyance if the > > user, like me, has a "flash blocker" application that only loads a > > flash applet on a site after specifically clicking on it, and this > > will force the user to click on the flash applet every time a value is > > updated, but it's a very specific issue that shouldn't occur with the > > majority of users). > > > As for other issues, I'm experiencing long initial loading times, and > > some instability with large datasets (I'm planning on loading hundreds > > or thousands of data entries, and currently entering 900 entries will > > crash my browser when creating the chart. Entering 100 takes a few > > seconds). > > > Paulo Mendes > > > On May 2, 8:24 am, ChartMan <[email protected]> wrote: > > > Hi > > > > You are right one needs to reconstruct the chart and draw in order for > > the > > > changes to take place. > > > I agree that this is not as easy as just calling #draw() but I don't > > think > > > that performance-wise this will make any difference. > > > Are you seeing any other issues here ? > > > > ChartMan > > > > On Fri, Apr 30, 2010 at 11:36 PM, Paulo Mendes <[email protected] > > >wrote: > > > > > Hi all, > > > > I've been evaluating if Google Visualization's Motion Chart would > > > > fulfill our requirements for a visualization tool in financial > > > > analysis. > > > > > I've been having a simple problem however: I'm filling a DataTable > > > > through Javascript, creating the MotionChart and drawing it. I want to > > > > allow the user to change values for a DataTable row's values, > > > > dynamically using JavaScript, and then reflect the value changes in > > > > the chart (where a point would move to a different position, based on > > > > the new data). I've read that that could be done by simple altering > > > > the values in the DataTable (through dataTable.setCell() or > > > > dataTable.setValue()) and then simply calling "chart.draw()". However, > > > > calling "draw()" does not update with the new values (drawing in the > > > > new position). Only recreating the MotionChart object will draw the > > > > object in a new position. > > > > > What else is needed to update/refresh the MotionChar without > > > > recreating the chart object? > > > > > Some code: > > > > > var googleData = null; > > > > var googleChart = null; > > > > var googleOptions = {}; > > > > var userDataTableRowIdx = -1; // will contain the index for the table > > > > row to change > > > > > google.load('visualization', '1', {'packages':['motionchart']}); > > > > google.setOnLoadCallback(initChart); > > > > > function initChart() > > > > { > > > > googleData = new google.visualization.DataTable(); > > > > googleData.addColumn('string', 'Name); > > > > googleData.addColumn('date', 'Date'); > > > > googleData.addColumn('number', 'A'); > > > > googleData.addColumn('number', 'B'); > > > > } > > > > > function fillAndDrawChart() > > > > { > > > > // in a cycle, call the function below to add values several > > > > times, to populate the DataTable > > > > for(/* ... */) > > > > googleData.addRow([name,new Date (2007,12,31),varA, varB]); > > > > > // save the table row to be altered with the user input values, > > > > into variable "userDataTableRowIdx" > > > > /* ... */ > > > > > // setup the chart, create and draw it > > > > googleOptions['width'] = chartWidth; > > > > googleOptions['height'] = chartHeight; > > > > googleOptions['showSidePanel'] = false; > > > > googleOptions['showChartButtons'] = false; > > > > googleOptions['showXScalePicker'] = false; > > > > googleOptions['showYScalePicker'] = false; > > > > googleOptions['showTrails'] = false; > > > > > googleChart = new > > > > google.visualization.MotionChart(document.getElementById('chart_div')); > > > > googleChart.draw(googleData, googleOptions); > > > > } > > > > > /** > > > > * Called when the user inputs new values, to update and redraw the > > > > chart > > > > */ > > > > function ChartSetCellDetails(newValueA, newValueB) > > > > { > > > > googleData.setValue(userDataTableRowIdx, 2, newValueA); > > > > googleData.setValue(userDataTableRowIdx, 3, newValueB); > > > > > // googleChart = new > > > > google.visualization.MotionChart(document.getElementById('chart_div')); > > > > > googleChart.draw(googleData, googleOptions); > > > > } > > > > > Thanks for any help, > > > > Paulo Mendes > > > > > -- > > > > 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]> > > <google-visualization-api%[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]<google-visualization-api%[email protected]> > > . > > > For more options, visit this group athttp:// > > 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]<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 > athttp://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.
