I'm currently building a dashboard style web page that uses Dygraph to display several continually updating strip charts.
To make it more obvious when the data behind a strip chart has gone stale, I'm using an underlayCallback to dim the background of the chart if the data hasn't updated after a timeout period has elapsed. If the data resumes updating, I update the chart with the new data and restore the background to full brightness to indicate that the data is no longer stale.
My current implementation of this feature is done with a single call to updateOptions that controls both the underlayCallback and the data being displayed by the chart. Once I make the call to updateOptions, I see both the background color change and the data update. However, the background color change happens a second or two before the data updates. During this window, the graph is displaying stale data with a background color that indicates that the data is not stale.
Is there any way to synchoronize the background color change with the data update? The duration of the delay appears to be related to the length of the data set being displayed by the dygraph. I'm assuming that Dygraph is internally processing the data prior to its being actually displayed. The only thing I can think of at this point is that there might be a way, if I call updateOptions, with block_redraw set, and then force a redraw when Dygraph is actually ready to render. But I'm not sure if that's even workable, much less ideal.
Something else I should mention is that I've also tried using CSS to control the background color of stale charts. That approach works, but (predictably) suffers from the same sort of synchronization issues. The background color change is faster than the data update.
Thanks for any suggestions you might have.
-Mike