We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Trying to display label every second with DateTimeAxis

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));
            }
        }
    }
}


4 Replies

DA Devi Aruna Maharasi Murugan Syncfusion Team September 8, 2016 10:17 AM UTC

Hi Tyler, 
  
Thanks for contacting Syncfusion Support. 
  
We have analyzed the reported problem and unable to reproduce the problem at our end. We have prepared a demo sample based on provided requirement and it can be downloaded from below link, 
  
  
If you are still able to reproduce the issue, please revert us by modifying the sample. It would be helpful for us to serve you better. 
  
Regards, 
Devi 





TZ Tyler Zale September 8, 2016 04:57 PM UTC

Hi,

Your example shows exactly the problem we are trying to fix.


It repeats the labels instead of only showing one label on the first entry of every second. Is there a way to fix this?



Example we want to display:


blank blank blank 12:00:01 blank

insead of:

12:00:01 12:00:01 12:00:01 12:00:01 12:00:01





TZ Tyler Zale September 8, 2016 09:42 PM UTC

solved by using EnableAutoIntervalOnZooming = false;


DA Devi Aruna Maharasi Murugan Syncfusion Team September 9, 2016 10:37 AM UTC

Hi Tyler, 
  
Thanks for your update. 
  
Please contact us, if you need any further assistance, 
  
Regards, 
Devi 


Loader.
Live Chat Icon For mobile
Up arrow icon