Pre loader

KeyNotFoundException in ISciList.GetMaximum()

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’m overriding FastBubbleRenderableeSeries.InternalDraw. I recently upgraded to SciChart 4 and now some of my code throws a KeyNotFoundException.

The following code, inside InternalDraw(..), results in a KeyNotFoundException.

The contents of ZPoints at the time are 0.01, 0.01.

   var points = (XyzPointSeries)renderPassData.PointSeries;

                if (points.Count == 0)
                {
                    return;
                }

                var maxZ = (double)points.ZPoints.GetMaximum();    <---- exception thrown

Am I doing something wrong? How can I get the maximum Z value?

Cheers
Felix

  • You must to post comments
0
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • Andrew Burnett-Thompson
    SciList.GetMaximum() simply iterates over all members (in a for-loop) and returns the maximum found. It does this in a fast, generic way using unsafe code. It’s as simple as that really. It is faster than .Max() but it is still linear depending on number of points I’m afraid.
  • F W
    Ah ok. I guess Max is fine then. Cheers Felix
  • You must to post comments
0
0

Hi Felix,

I was able to reproduce this in a simple unit test:

    [Test]
    public void WhenGetMaximumShouldNotThrowKeyNotFoundException()
    {
        var xyzDataSeries = new XyzDataSeries<double>();
        xyzDataSeries.Append(0, 1, 2);
        xyzDataSeries.Append(3, 4, 5);

        var xyzPointSeries = xyzDataSeries.ToPointSeries(ResamplingMode.Auto, new IndexRange(0,1), 400, false, null, new PointResamplerFactory()) as XyzPointSeries;

        Assert.That(xyzPointSeries, Is.Not.Null);
        Assert.That(xyzPointSeries.Count, Is.EqualTo(2));

        Assert.DoesNotThrow(() => xyzPointSeries.ZPoints.GetMaximum());
    }

However, inspecting the code, we’re actually returning ISciList from the ZPoints property, and GetMaximum expects a concrete type (e.g. double, int, float). In other words ‘we didn’t expect you to call this API at this point’.

A very simple subsititution to get the maximum is to call this function instead:

// using System.Linq
xyzPointSeries.ZPoints.Max(); 

Let me know if that helps.

Best regards,
Andrew

  • You must to post comments
Showing 2 results
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