Jump to content
Software FX Community

Problems displaying time on X axis


User (Legacy)

Recommended Posts

I know this has been asked many times before, and I've read several posts

regarding this, but I am having quite a bit of trouble displaying times on

the X axis in a real-time chart. Basically I want to add data to the chart

every five minutes. Here is the VB code I have tried.

ChartFX1.Axis(AXIS_X).Format = AF_TIME

ChartFX1.Axis(AXIS_X).Min = beginTime

ChartFX1.Axis(AXIS_X).LabelValue = TimeValue("00:05")

ChartFX1.Axis(AXIS_X).Step = 2

I thought this would produce a label every 10 minutes (since the step is 2).

Instead it's 4 hours (meaning if step were 1 it would be 2 hours). So

instead of getting one label that says 5:23:49 PM and the next one saying

5:33:49 PM, I get one that says 5:23:49 PM and the next saying 9:23:49 PM.

What am I doing wrong? I'm sure the answer is right under my nose, but I'm

just not seeing it.

Thanks in advance,

Matt Huber

Link to comment
Share on other sites

No, I am not passing any X-Values.

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:4GvVOlU9CHA.1328@webserver1.softwarefx.com...

> Dos your chart has X-Values ? In other words are you passing X-Values

either

> by doing OpenDataEx COD_XVALUES or by specifying so when reading the data

> from a data source ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Hi,

I made the following test with a default chart with 10 points:

ChartFX1.Axis(AXIS_X).Format = AF_TIME

ChartFX1.Axis(AXIS_X).Min = TimeValue("5:39:00 PM") / TimeValue("00:05")

ChartFX1.Axis(AXIS_X).LabelValue = TimeValue("00:05")

ChartFX1.Axis(AXIS_X).Step = 2

ChartFX1.Axis(AXIS_X).FirstLabel = 1

And I got the chart shown in the attached picture.

Can you please send me some kind of a sample program that reproduces your

situation, there must be something we are doing different

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Here is the code I'm currently using.  objMainRS and objGraphRS are ADO

Recordsets that point to different tables in the same database. For now I'm

just grabbing values straight out of the database, but later I'll have to do

some manipulation of the data, so just setting the graph to get the data for

me won't work later on. I've attached a picture of the resulting graph.

Thanks again,

Matt Huber

objMainRS.MoveFirst 'contains a list of active values I want to use

ChartFX1.Axis(AXIS_X).AutoScale = 1

ChartFX1.TypeMask = ChartFX1.TypeMask Or CT_EVENSPACING

ChartFX1.RealTimeStyle = CRT_NOWAITARROW

ChartFX1.Axis(AXIS_X).Format = AF_TIME

ChartFX1.Axis(AXIS_X).Min = objGraphRS.Fields("TimeMark") 'Now - 5

ChartFX1.Axis(AXIS_X).LabelValue = TimeValue("00:05")

ChartFX1.Axis(AXIS_X).FirstLabel = 1

ChartFX1.Axis(AXIS_X).STEP = 2

ChartFX1.Axis(AXIS_X).ScaleUnit = TimeSerial(0, 5, 0)

ChartFX1.OpenDataEx COD_VALUES, numEntries, 5 'numEntries is number of

active values in objMainRS

Do While objMainRS.EOF = False

Dim j As Integer

j = 0

id = objMainRS.Fields("SensorID")

objGraphRS.MoveLast 'contains a history of 5 minute averages of the

values in objMainRS, which is what I'm attempting to graph

Do While objGraphRS.BOF = False And j < 5

If objGraphRS.Fields("SensorID") = id Then

ChartFX1.ValueEx(i, j) = objGraphRS.Fields("Z1SPD")

j = j + 1

End If

objGraphRS.MovePrevious

Loop

objMainRS.MoveNext

i = i + 1

Loop

ChartFX1.CloseData COD_VALUES Or COD_REALTIME

ChartFX1.Refresh

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:rSs2BtU9CHA.1324@webserver1.softwarefx.com...

> Hi,

>

> I made the following test with a default chart with 10 points:

>

> ChartFX1.Axis(AXIS_X).Format = AF_TIME

> ChartFX1.Axis(AXIS_X).Min = TimeValue("5:39:00 PM") / TimeValue("00:05")

> ChartFX1.Axis(AXIS_X).LabelValue = TimeValue("00:05")

> ChartFX1.Axis(AXIS_X).Step = 2

> ChartFX1.Axis(AXIS_X).FirstLabel = 1

>

> And I got the chart shown in the attached picture.

>

> Can you please send me some kind of a sample program that reproduces your

> situation, there must be something we are doing different

>

> --

> FP

> Software FX, Inc.

>

>

>

ExportCFX.zip

Link to comment
Share on other sites

Two things I think are wrong:

1)

ChartFX1.Axis(AXIS_X).ScaleUnit = TimeSerial(0, 5, 0)

What are you trying to achieve with this call ? I think you don't want to

set this property.

2) Notice in my code:

ChartFX1.Axis(AXIS_X).Min = TimeValue("5:39:00 PM") / TimeValue("00:05")

You should do:

ChartFX1.Axis(AXIS_X).Min = objGraphRS.Fields("TimeMark") /

TimeValue("00:05")

--

FP

Software FX, Inc.

Link to comment
Share on other sites

I'm sorry to be asking so many qustions, but I am mroe confused now.  I made

the changes you suggested. My code looks exactly as before except a removed

the call to ScaleUnit and added the division in the call to Min. And while

it sure is closer than I was before I'm still not seeing the results you

get. Attached is a picture of what I got, where you'll see the interval is

1 minute 20 seconds. At first I thought it could be related to

objMainRS.Fields("TimeMark") returning a full date, not just a time. So I

replaced it with your "TimeValue("5:39:00 PM") / TimeValue("00:05")" and

still got results similar to the attached picture. Again, thank you for

taking the time work me through this. I appreciate it a great deal.

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:NCzpC$X9CHA.1324@webserver1.softwarefx.com...

> Two things I think are wrong:

>

> 1)

> ChartFX1.Axis(AXIS_X).ScaleUnit = TimeSerial(0, 5, 0)

>

> What are you trying to achieve with this call ? I think you don't want to

> set this property.

>

> 2) Notice in my code:

>

> ChartFX1.Axis(AXIS_X).Min = TimeValue("5:39:00 PM") / TimeValue("00:05")

>

> You should do:

>

> ChartFX1.Axis(AXIS_X).Min = objGraphRS.Fields("TimeMark") /

> TimeValue("00:05")

>

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Thanks for all your help.  I solved my own problem when I pasted my code

into another project and it worked correctly. As best as I can tell a

property setting got changed at some point and that threw everything off.

Thanks again,

Matt Huber

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:vzO3t559CHA.848@webserver1.softwarefx.com...

> I don't know. I think the way to proceed here is this:

>

> Send me a stand-alone working project that I can run here (a code that

> doesn't not depend on your databases that I don't have) and I'll check it

> and correct it to achieve what you need.

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...