Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic refreshing of chart #51

Closed
hari-rangarajan opened this issue Jun 7, 2016 · 4 comments
Closed

Dynamic refreshing of chart #51

hari-rangarajan opened this issue Jun 7, 2016 · 4 comments

Comments

@hari-rangarajan
Copy link

I'm running into this problem with tool tips getting stuck: http://stackoverflow.com/questions/36205526/tooltip-bug-with-dynamic-google-charts

Can you consider adding this solution:
"
container = document.getElementById('' + youridentifier + '');
chart = new google.visualization.Timeline(container);
chart.draw(dataSet, options);

Every time you "redraw" the google chart you have to create a new visualization object .
"
Thanks

@hari-rangarajan
Copy link
Author

On second thoughts, is there a way to use 'shouldComponentUpdate' to prevent unnecessary updates?

@rakannimer
Copy link
Owner

Hey @hari-rangarajan,

Re-creating a new visualization object on each re-draw would make the library feel sluggish, and all animations when changing the data will be lost, so I'm not sure it would be the best idea.

Can you provide me with some code that I can run to help debug this issue ?

Cheers !

@hari-rangarajan
Copy link
Author

I don't how to package a runnable version but here is the idea to trigger the bug. Set new data when processing any event. The old tool tips get stuck. This is what the stack overflow link I posted earlier talks about.

componentDidMount: function() {
var chart_events = [
{
eventName : 'onmouseover',
callback : function(Chart) {
// Returns Chart so you can access props and the ChartWrapper object from chart.wrapper
console.log("mouseover the chart");
>>>>>> this.setState(columns: newColumnData); <<<<<<
}
}
];

},
render: function() {
<Chart chartType = "ScatterChart" rows = {this.state.rows} columns = {this.state.columns} options = {this.state.options} graph_id = "ScatterChart" width={"100%"} height={"400px"} chartEvents = {chart_events} />

}

@hari-rangarajan
Copy link
Author

Another way to do it would be to create a component containing any html element and the google chart. When handling any event on the google chart, update the html element with a setState. This will force a redraw on the entire component and produce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants