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
- F W asked 8 years ago
- You must login to post comments
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?
- F W answered 8 years ago
-
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.
-
Ah ok. I guess Max is fine then. Cheers Felix
- You must login to post comments
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
- Andrew Burnett-Thompson answered 8 years ago
- You must login to post comments
Please login first to submit.