X Data in Editor not matching Bottom Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

X Data in Editor not matching Bottom Axis

Post by tirby » Sun Nov 29, 2015 8:15 pm

HI,

This test program is written in VB.Net - VS2010,
TChart - 3.5.3371.26406

When the test program is first launched, the bottom axis is in "Numeric" mode.
When the "Time" button is pressed, the bottom axis will display the current date and time, 5 minute increments, for a total of 1 hour.
However, the traces disappear.

If the "Editor" button is pressed, and the 'Data" tab is viewed, a date starting at 12/30/1899 is what is shown for the X value, which is not the value shown on the Bottom axis.

Viewing any of the data stores for any of the traces reveals similar results.

NOTE:
At this point I must alert you to an idiosyncrasy: which ever mode is selected the first time the editor is accessed, is the mode in which the editor will present its data from this point on until the program is re-started.

Viewing the Data Tab in the Editor when "Numeric" mode is selected does coincide with the bottom axis.

I'm confused by this and would like some assistance.

Thank you!
Attachments
BottomAxisTestA.Zip
(11.65 KiB) Downloaded 776 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: X Data in Editor not matching Bottom Axis

Post by Christopher » Mon Nov 30, 2015 2:02 pm

Hello,
tirby wrote: However, the traces disappear.
If I do this:

Code: Select all

  Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    'Time Mode
    Dim aa As Integer
    Dim bb As DateTime
    Dim cc As DateTime

    For aa = 0 To 7
      TChart1.Series(aa).XValues.DateTime = True
    Next aa

    TChart1.Axes.Bottom.Labels.DateTimeFormat = "MM/dd/yyyy HH:mm"
    TChart1.Axes.Bottom.Labels.Angle = 90
    bb = Now
    cc = bb.AddMinutes(60)
    TChart1.Axes.Bottom.Minimum = bb.ToOADate()
    TChart1.Axes.Bottom.Maximum = cc.ToOADate()
    TChart1.Axes.Bottom.Increment = (TChart1.Axes.Bottom.Maximum - TChart1.Axes.Bottom.Minimum) / 12

    Dim min As Double = TChart1.Axes.Bottom.Minimum
    Dim first As Double = TChart1(0)(TChart1(0).Count - 1).X

    MessageBox.Show("min: " + min.ToString(CultureInfo.InvariantCulture) + "  last: " + first.ToString())

  End Sub
I obtain this:
result1.PNG
result1.PNG (16.16 KiB) Viewed 10539 times
Here we have the reason why the series disappears - the largest X Value of the first series is much smaller than the minimum value of the bottom axis. This is because the time values on the bottom axis are OLE Automation Dates, about which you can read a little here.
tirby wrote: If the "Editor" button is pressed, and the 'Data" tab is viewed, a date starting at 12/30/1899 is what is shown for the X value, which is not the value shown on the Bottom axis.

Viewing any of the data stores for any of the traces reveals similar results.
Using the latest version of TeeChart, I get the following results:
http://screencast.com/t/mWRBnkUhq
tirby wrote: NOTE:
At this point I must alert you to an idiosyncrasy: which ever mode is selected the first time the editor is accessed, is the mode in which the editor will present its data from this point on until the program is re-started.

Viewing the Data Tab in the Editor when "Numeric" mode is selected does coincide with the bottom axis.
I haven't been able to reproduce this issue here, as can be seen in the screenvideo I link to above. Could you please give me some more specific instructions on how to reproduce this issue?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: X Data in Editor not matching Bottom Axis

Post by Christopher » Mon Nov 30, 2015 2:41 pm

tirby wrote:NOTE:
At this point I must alert you to an idiosyncrasy: which ever mode is selected the first time the editor is accessed, is the mode in which the editor will present its data from this point on until the program is re-started.
Actually, I have been able to reproduce this now and have added to our issue tracker with id=1378.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Re: X Data in Editor not matching Bottom Axis

Post by tirby » Mon Nov 30, 2015 4:51 pm

Christopher,

Thanks for looking at this.

In testing the Time issue, I added the same lines of code you had added, and I get the same result.
I read the MS link you posted, and I now understand the why- but not how to correct it.

Can provide some guidance?

Thanks!

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: X Data in Editor not matching Bottom Axis

Post by Christopher » Mon Nov 30, 2015 6:11 pm

Hello,
tirby wrote: In testing the Time issue, I added the same lines of code you had added, and I get the same result.
I read the MS link you posted, and I now understand the why- but not how to correct it.
I'm afraid I don't know either, as this depends on what you want to do. For example, imagine a numeric X (bottom) axis with these values:

0 1 2 3 4 5 6 7 ...

how to convert these to DateTime values? When you convert 0, what do you want to convert it to? Do you want to convert it to today's date? Or maybe DateTime.Now? What is clear is that you will have to add new values to the series's XValues, because converting 0 to DateTime gives you a date right at the end of the nineteenth century.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply