ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot in Report - time axis format (script)

Solved!
Go to solution

Hi,

How can I format the time axis in a report plot ?  I have tried using the variable D2AxisXFormat without much success.  This script gives a plot like this; -

Call PicLoad("Template")

Call GraphObjNew("2D-Axis","2DAxis1")

Call GraphObjOpen("2DAxis1")

Call GraphObjNew("2D-Curve","New_Curve") 'Creates a new curve

Call GraphObjOpen("New_Curve") 'Opens the curve object

D2CChnXName = "TimeCorr"

D2CChnYName = "Current[mA]"

Call GraphObjClose("New_Curve")

Call GraphObjClose("2DAxis1")

Call PicUpdate

FirstPlot.PNGwhich has a nice x axis format by default. 

However, if I try to modify the axis (by script), I lose the formating and end up with something like this: -

SecondPlot.PNG

where the axis info is less useful.  The above plot was created by this script which modifies the start and end dates of the previous plot: -

(I also attempt to format the axis...)

Call GraphObjOpen("2DAxis1")

Call GraphObjOpen(D2AxisXObj(1)) 'Setup of X axis

D2AxisXDivMode = "Date/Time"

D2AxisXFormat = "#ttt/yy"

D2AxisXScaleType = "begin/end manual"

D2AxisXBegin = cdate(mid((RTT(View.Sheets("Home").Areas(1).DisplayObj.XBegin)),2,19))

D2AxisXEnd = cdate(mid((RTT(View.Sheets("Home").Areas(1).DisplayObj.XEnd)),2,19))

Call GraphObjClose(D2AxisXObj(1))

Call GraphObjClose("2DAxis1")

call PicUpdate

The start and end are modified, but I cannot reproduce the axis format of the first picture above where the days, months and year are nicely displayed...

 

I would be grateful for any help on how to proceed?

Thanks!

 

 

0 Kudos
Message 1 of 3
(3,256 Views)
Solution
Accepted by topic author mrme

Hello mrme,

 

Please try this:

D2AxisXFormat = "#dd CRLF ttt/yy"

 

instead of this:

D2AxisXFormat = "#ttt/yy"

 

 

 

Otmar D. Foehner
0 Kudos
Message 2 of 3
(3,225 Views)

Hello Otmar,

 

It works.  Thanks!

 

Thomas

0 Kudos
Message 3 of 3
(3,215 Views)