ThreadException in CustomLinePointColoringAndShaping

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
frank
Posts: 51
Joined: Tue Mar 25, 2014 9:04 am

ThreadException in CustomLinePointColoringAndShaping

Post by frank » Wed May 07, 2014 12:26 pm

Hi,

after upgrading to Version 6.0.1 I get an System.InvalidOperationException in an CustomLinePointColoringAndShaping-Implementation. The line
_chart.ViewXY.YAxes[0].CoordToValue(coords.Y, out yValue);
causes "The calling thread cannot access this object because a different thread owns it." In LC 5.5 it worked without any problems.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: ThreadException in CustomLinePointColoringAndShaping

Post by ArctionPasi » Wed May 07, 2014 1:09 pm

Hello.

You are are probably accessing dependency preperties, like ViewXY or X axis in the event handler. DPs work only in UI thread. LC uses multithreading by default for rendering of the line series, and the CustomLinePointColoringAndShapingHandler event fires from a threadpool task. That causes the problem. The event handler needs to execute right there, and it can't be queued in the UI thread by Dispatcher.Invoke.

The solution is to disable multithreading from that chart. Set chart.ChartRenderOptions.MultiCoreProcessing = MultiCoreProcessing.Off;
LightningChart Support Team, PT

Post Reply