Pre loader

Multiple Y Axes Via Binding Performance Problem

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

Hi,

I found the solution in this thread to bind multiple YAxes via Binding
http://http://www.scichart.com/questions/question/multiple-y-axes-via-binding/?view=all#post-1095

Example works great but it is very slow.

I want to use this for adding 4 Yaxis with 3000 datapoints / axis.
It almost takes 8 seconds before data is displayed on screen.
How can we speed this up because we can not present this to our customer?

  • You must to post comments
0
0

Hi Egbert,

I’ve spent some time investigating this today. Ok – you highlight a genuine issue with SciChart, but there is a workaround.

I ran your sample (Thanks for that – very helpful) through a profiler. The results are posted below as a screenshot. As you can see there are 12,000 calls to ZoomExtentsY() internally within SciChart, one per Dataseries.Append call.

In your MainViewModel you have a method like this:

private void FillData(IDataSeries<DateTime, double> dataSeries)
{
    for (int i = 0; i < 3000; i++)
    {
         // Each DataSeries.Append call triggers a redraw. Although rendering is 
         // buffered off the UI thread, the ZoomExtents() calculation performed by SciChart
         // when a new axis has an uninitialized VisibleRange is costly. 
         dataSeries.Append(new DateTime(2011, 01, 01).AddDays(i), _random.NextDouble());
    }
}

I modified this slightly to append all 3000 points in one go, like this

private void FillData(IDataSeries<DateTime, double> dataSeries)
{
    var xValues = new DateTime[3000];
    var yValues = new double[3000];

    // Precalculate all x,y values into arrays
    for (int i = 0; i < 3000; i++)
    {
        xValues[i] = new DateTime(2011, 01, 01).AddDays(i);
        yValues[i] = _random.NextDouble();
    }
 
    // Append in one block - triggers a single redraw
    dataSeries.Append(xValues, yValues);
}

The result is the axis renders immediately.

Another way of resolving the problem is to set a VisibleRange on the axis before adding it to SciChart. In your example because the axis had AutoRange=False, but also a null VisibleRange, SciChart tries to compute the zoom-extents of the axis on every single data-point add. This occurs until the axis range has been calculated (after first render).

to test this, keep your original FillData code but set NumericAxis.VisibleRange = new DoubleRange(0, 1) on each axis. You will see the axes also render immediately with this optimisation.

I hope this has resolved the issue for you (and for your client)!! Thank you for bringing this to our attention, as performance is our highest priority.

Best regards,

Images
  • EJansen
    Thanks, this works great/very fast now....
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies