I have a series of charts with data feeding in from named queries with a variable parameter for the timeframe of data to use. When grabbing data large enough, the charts remain blank while the named queries are populating the charts, ~10-20 seconds. Is there a way to detect this such that I can have a loading animation for the user to know things are still loading?
Vision or Perspective? What triggers the execution of these named queries?
This is in Vision. One of the parameters in the named query changes. In my case it is a Starting date.
So, we don’t provide any ability to ‘introspect’ the bindings and know that they’re in progress. What you can do instead of bindings is issue your named query from scripting; you’ll want to wire up the appropriate
propertyChange scripting events to fire your script, but if you do that then you’ll be able to set some ‘loading’ flag (and react to that in your UI accordingly) and then, in a background thread, execute your named query (and then jump back to the EDT to deliver the results).
It’s an immediate, significant jump in complexity, unfortunately, but is the best way to get what you want.
@pturmel wrote a scripting module,
later.py, that helps a lot with the ‘boilerplate’ around running an async task and returning results on the main thread: