Page 1 of 1

Live data draws back in time when zoomed in

Posted: Mon May 13, 2013 4:55 pm
by 13052810
Hello,

I'm finding that while I'm plotting live, changing data, if I zoom in on a specific area, the incoming data plots far to the left of the current time. Below is my basic setup.

It acts as if when the plot is zoomed that the incoming data is plotted with the ExpectedJobLength variable temporarily changed to the zoomed Time length. Example if I start out at 120 mins., ExpectedJobLength = 120. After I zoom in and display 5 min., then ExpectedJobLength seems to be getting changed to 5 mins. So any new incoming data is plotted further to the left once the plot is un-zoomed.

ExpectedJobLength is not actually changing, but it does seem to act like it.

ExpectedJobLength is in minutes.
The Series is Line.

Code: Select all

'SETUP CODE:
    With Tchart1.axis
        .Bottom.Maximum = TimeValue(Format$(TimeSerial(0, ExpectedJobLength, 0), "hh:mm"))
        .Bottom.Labels.DateTimeFormat = "h:mm"
        .Bottom.MinorTickCount = 4
        .Bottom.Labels.Style = talValue
        .Bottom.Maximum = TimeValue(Format$(TimeSerial(0, JobInfo.ExpectedJobLength, 0), "hh:mm"))
        .Bottom.Increment = TimeValue("00:00:01")
        .Bottom.Increment = TChart1.GetDateTimeStep(dtOneSecond)
    End With

Code: Select all

'Timer routine - TChart1.OnTimer:
    bb = ExpectedJobLength * 60
    For aa = 0 To 7
        With TChart1.Series(aa)
            Chart_X = .count * (TChart1.axis.Bottom.Maximum / bb)
            Chart_Y(aa) = Data2Plot(aa).YData
            .AddXY Chart_X, Chart_Y(aa), "", Data2Plot(aa).TraceColor
        End With
    Next aa

Any ideas?

Thanks

Re: Live data draws back in time when zoomed in

Posted: Mon May 13, 2013 7:42 pm
by 13052810
I've noticed that it also tends to draw the trace well advanced to to the right (beyond the bounds of the right side drawing area) after un-zooming. The live data seems to plot in the right place, but looks like its interupting the drawn line.
I will post some screen shots.

<Edited>

I could not make the traces do as I stated, however, the realtime data is plotting in the middle of the zoomed view rather than at the rightmost end of the trace line. The document I posted after this give examples.

Re: Live data draws back in time when zoomed in

Posted: Mon May 13, 2013 8:19 pm
by 13052810
See attached MS Word files.

Re: Live data draws back in time when zoomed in

Posted: Wed May 15, 2013 8:33 am
by yeray
Hello,

In the Timer routine you are calculating the XValue to add like this:

Code: Select all

Chart_X = .count * (TChart1.axis.Bottom.Maximum / bb)
So this value has a relation with the bottom axis maximum, that changes when you zoom or scroll. You should not use this bottom axis value to calculate the next XValue.

Re: Live data draws back in time when zoomed in

Posted: Wed May 15, 2013 2:35 pm
by 13052810
Thanks Yeray!
Sometimes you just can't see the forest cause the trees are blocking your view!

Re: Live data draws back in time when zoomed in

Posted: Thu May 16, 2013 7:12 am
by yeray
hehe, you're welcome! :)