Pre loader

WPD 2D Charts in Tab Controls

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hello,

I have a WPF .Net 6 application running on Window 11 that monitors data coming from the network.
The app has five tab controls, each tab has four FIFO line charts.
I have another app (the “sender”) that sends simulated data to feed and test the “main” app.
Everything works beautifully when:
– The sender app is not running
– then, first navigate through all tabs, seeing an empty chart (expected)
– Launch the sender app.
– Navigate through tabs, watching them updating in near real time…

But…
If I do not initially navigate through all tabs, only the visible tab gets updated.

I suspect/speculate that SciChart code is doing some “critical” initializations on the OnLoaded event that are missed if tabs do not get loaded before setup.

We want the charts to get populated even if they are hidden at startup.

Any suggestions to fix the issue? Or am I doing anything wrong ?

Thank you

Version
7.0.2.27161 installed via nuget server
  • Andrew Burnett-Thompson
    Hi Laurent, thank you for getting in touch. Perhaps you can share a code sample that exhibits the behaviour you’re seeing? This will make sure we’re looking at the same thing so we can suggest improvements. Best regards, Andrew
  • Andrew Burnett-Thompson
    Hi Laurent. We’re unable to proceed further without code to reproduce the issue. Please update the question with a code sample project and comment here when done. Thanks!
  • You must to post comments
1
0

I actually resolved this issue already.
Most likely SciCharts indeed do initialization stuff on the Loaded event and the workaround below solves the “lazy loading” issue. Once “Loaded” all charts do run at full speed.

So… No actual issue with the charting code, maybe just a mention in the docs would be helpful.

if (groups.Count > 1)
{
    // Forces all tabs ( == groups) to get loaded and therefore fully initialized at startup.
    // This is required so that charts and everything get full initialized properly before we actively
    // start monitoring. MUCH Needed for example for the SciChart plots to work nicely.
    if (this.View is not null && this.View.mainTabControl is not null)
    {
        var tabControl = this.View!.mainTabControl;
        for (int tabIndex = tabControl.Items.Count - 1; tabIndex >= 0; --tabIndex)
        {
            tabControl.SelectedIndex = tabIndex;

            // this will trigger the Loaded event on the tab content
            tabControl.UpdateLayout();
        }
    }
}
  • Andrew Burnett-Thompson
    Thanks for sharing the workaround, yes that’s correct SciChart WPF does not update or draw a chart which is not currently visible, this is by design. Just curious – why do you want to update a chart that is not visible? Second question: when the chart becomes visible, does it display correctly? (It should – if not – that is a bug)
  • Laurent Testud
    We update when invisible ( == in an other tab) so that when the end user selects another tab, the chart is displayed instantly (and yes correctly). If we do not do that, there is a bit of lag for loading most current data, something that is considered “very annoying”… This is a lab’ application with high frequency updates (up to 2000 updates per second) with now about 20+ fifo line charts in 5 tabs and users navigate back and forth through tabs almost continuously.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.