[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date axis in object graphics (IDL 5.3)

"George Constantinides" <gconstantinides@mhl.nsw.gov.au> wrote in message
> This should be an easy one for you.
> I am using LABEL_DATE to produce a time axis in object graphics as
> follows:
>       ;...... some code ....
>       dummy = Label_Date(Date_Format = '%D-%M!C%H',Offset=start_date)
>       ;...... some more code ....
>      xAxis = Obj_New("IDLgrAxis", 0, Color=[255,255,0], Ticklen=0.025, $
>      Minor=4, Range=xrange, Title=xtitle, TickDir=1, $
>      TickFormat = 'Label_Date',Location=[0, 0.2 ,0])
>      ;.......
> I expect the HOURS to appear below the date. This works in direct
> graphics but in object graphics it does not understand !C as a directive
> and instead displays it as a literal.
> Am I going something wrong, or have I discovered bag number: 4527

No you're not doing anything wrong. Text objects do not recognise !C,
although they do recognise other formatting codes if create with the

I don't think it's really a bug (or a bag), just a limitation.

P.S. Ticktext objects created by an IDLgrAxis have ENABLE_FORMATTING turned
off. To turn it on you can do:

oaxis->GetProperty, TICKTEXT=ticktext
for i=0,n_elements(ticktext)-1 do $
    if obj_valid(ticktext[i]) then $
        ticktext[i]->SetProperty, /ENABLE_FORMATTING

Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand