Hi,
We are trying to display the tick labels every second for real-time audio data (using FastStepLineBitmapSeries). We also want the chart to auto scroll with the data on a 0.5 second window
If we use:
DateTimeAxis
Interval = 1;
IntervalType = DateTimeIntervalType.Seconds;
then the app will lock up and crash (the above will work properly if we use something like a 1 minute interval - but still not with scrolling - see below):
ContextSwitchDeadlock occurred
Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Users\Tyler\Documents\Visual Studio 2015\Projects\Collage-Xamarin\Collage.WPF\bin\Debug\MedwebLIVE.exe'.
Additional information: The CLR has been unable to transition from COM context 0xcb53e0 to COM context 0xcb5328 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
When we switched to our custom Axis class to do the scrolling it no longer crashes but ignores the intervals for the grid:
using Syncfusion.UI.Xaml.Charts;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Collage.WPF.Components
{
public class RealTimeAxis : DateTimeAxis
{
private const double DISPLAY_X_AXIS_SECONDS = 0.5d;
public RealTimeAxis() : base()
{
ActualRangeChanged += RealTimeAxis_ActualRangeChanged;
Interval = 1;
IntervalType = DateTimeIntervalType.Seconds;
}
private void RealTimeAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e)
{
if (e.IsScrolling)
return;
DateTime? date = e.ActualMaximum as DateTime?;
if (date.HasValue)
{
e.VisibleMinimum = date.Value.Subtract(TimeSpan.FromSeconds(DISPLAY_X_AXIS_SECONDS));
}
}
}
}