Forums

Full Version: DateTime axisX in seconds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.
How to configure MajorTicks and other parameters to be displayed on the axisX DateTime range in seconds? In the example DateDisplayScopeDemo minimum time display can be set as _mDate.AddHours (1). If you set m_Date.AddSeconds (1), the labels axisX not displayed.
Okay, with this question, I figured out (it was built very few points). Another question: Is it possible to put the time and date in two lines axisX, e.g.

15:32:37
24.06.2014

Dave

Have you tried adding a CR and/or LF to the text?

Regards,
Dave
Hi , first thanks for subscribing.
I can not add the time on the x axis in the format HH : mm : ss with on precision of the second.

[Image: bFIiyS.jpg]

with the following code

Code:
public partial class Form1 : Form
    {
        public System.DateTime m_Date = System.DateTime.Now;
        private Random m_RandomGen = new Random(123);
        public Form1()
        {
            InitializeComponent();
            scope1.XAxis.CustomLabel += scope1_XAxis_CustomLabel;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            
            m_Date = m_Date.AddHours(1);  
            scope1.Channels[0].Data.AddXYPoint(m_Date.ToBinary(), m_RandomGen.NextDouble() * 2000 - 1000);
        }
        private void scope1_XAxis_CustomLabel(object sender, Mitov.PlotLab.CustomAxisLabelEventArgs Args)
        {
            Args.AxisLabel = System.DateTime.FromBinary((long)Math.Round(Args.SampleValue)).ToString("HH:mm:ss");
        }
    }
is that I'm doing something wrong. is pocible ?

Dave

Hi! Which version of the labs are you using?

Regards,
Dave
Hi dave
I am using:
_Windows7 32bits
_VS2010
_.NET 4.0
_PlotLabs 7.6.0.0

and I can not find the cause of the problem. :-(
(04-20-2015 09:54 AM)manutek Wrote: [ -> ]and I can not find the cause of the problem. :-(

Hi Manutek,

Thank you!
I am sorry for the late reply, I got caught between the 7.6 release and some system problems in the last few days :-( .
The problem is that your time period is too small and is getting rounded. If you multiply it by 1000 as example it will work. You may need to reformat the date printing accordingly:

private void timer1_Tick(object sender, EventArgs e)
{

m_Date = m_Date.AddHours(1);
scope1.Channels[0].Data.AddXYPoint(m_Date.ToBinary() * 1000, m_RandomGen.NextDouble() * 2000 - 1000);
}

private void scope1_XAxis_CustomLabel(object sender, Mitov.PlotLab.CustomAxisLabelEventArgs Args)
{
Args.AxisLabel = System.DateTime.FromBinary((long)Math.Round(Args.SampleValue / 1000 )).ToString("HH:mm:ss");
}
thank you very much Mr Mitov ¡¡¡¡

problem solved.
How to solve it problem without m_Date = m_Date.AddHours(1) ?
With a time interval of less than one second.
Reference URL's