Pre loader

Try dividing by zero

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
while (_CameraDataPlot.TryDequeue(out PlotData record))
{
    Parallel.ForEach(record.Values, val =>
    {
        try
        {
            IRenderableSeriesViewModel render = CameraChannels
                .First(x => x.ChannelId == val.Key)
                .RenderableSeries
                .FirstOrDefault(r => (int)(r as LineRenderableSeriesViewModel).Tag == record.Group);

            if (render != null)
            {
                using (render.DataSeries.SuspendUpdates())
                {
                    long ticks = record.Timestamp / 100;
                    (render.DataSeries as XyDataSeries<TimeSpan, double>).Append(new TimeSpan(ticks), val.Value);
                }
            }
        }
        catch (DivideByZeroException ex)
        {
            Console.WriteLine($"DivideByZeroException caught: {ex.Message}");
            Console.WriteLine($"Timestamp: {record.Timestamp}, Value: {val.Value}");
            Console.WriteLine($"Stack Trace: {ex.StackTrace}");
        }
        catch (Exception ex)
        {
            // Optional: Add logging or handling for general exceptions
        }
    });
}

Here is my code. When my frame rate is set to greater than 1, rendering is normal, but when I set the frame rate to less than 1, an error occurs at the “render.DataSeries as XyDataSeries<TimeSpan, double>).Append(new TimeSpan(ticks), val.Value);” position: attempting to divide by 0.

The detailed error message is as follows:

引发的异常:“System.DivideByZeroException”(位于 SciChart.Data.dll 中)
DivideByZeroException caught: 尝试除以零。
Timestamp: 2209466241, Value: 0.000170655727634525
Stack Trace: 在 puq1.nuo()
在 puq
1.Add(a item)
在 SciChart.Charting.Model.DataSeries.XyDataSeries2.Append(TX x, TY y, IPointMetadata metadata)
在 SciChart.Charting.Model.DataSeries.XyDataSeries
2.Append(TX x, TY y)

引发的异常:“System.DivideByZeroException”(位于 SciChart.Data.dll 中)

Version
6.3.0.13476
  • Lex
    Hi Zhang, Thank you for reporting this. Please accept my apologies for the delayed response. I’m going to discuss the provided information with our team and will get back to you as soon as I have an update. Kind regards, Lex, SciChart Technical Support Engineer
  • You must to post comments
0
0

Hi Zhang,

Hope you are doing well.
We looked at your inquiry.

To avoid the mentioned issue, you could use the ThreadedRenderTimer instead:

RenderSurfaceBase.UseThreadedRenderTimer = true;

Additionally, we have logged the reported issue in our tracking system for further investigation.

Kind regards,
Lex,
SciChart Technical Support Engineer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.