GPL: Date format on axis ticks

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GPL: Date format on axis ticks

la volta statistics
Hi all
How can I change the date format of the x-axis in GPL.
I tried unit.time(), format("dd/MM/yyyy") but get
still a '.Uhr' (the German word for hour) behind each of the ticks.
For the first date from the example below the label of the tick would come
as
'1.1.03.Uhr'
and I want something as 1.1.2003 or 01.01.2003.
Can someone help here?
Christian


data list list / Date (edate10)  Var1 .
begin data
 01.01.2003 1893.76
 02.01.2003 1923.58
 03.01.2003 1923.75
 06.01.2003 1921.53
 07.01.2003 1903.19
 08.01.2003 1888.31
 09.01.2003 1892.90
end data.

Format date (adate8).
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES= Date Var1
  MISSING =  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Date = col(source(s), name("Date"), unit.time(),
format("dd/MM/yyyy"))
 DATA: Var1=col(source(s), name("Var1"))
 GUIDE: axis(dim(1), label("Date"))
 GUIDE: axis(dim(2), label("Var1"))
 ELEMENT: line(position(Date*Var1), color(color.red))
END GPL.


*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
internet: http://www.lavolta.ch/
Reply | Threaded
Open this post in threaded view
|

Re: GPL: Date format on axis ticks

Beadle, ViAnn
add format.date() to the GUIDE statement, as in:

GUIDE: axis(dim(1), label("Date"), format.date())

That will remove the hour.

Alternatively, you can also apply a chart template with much more control over date formats.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics
Sent: Friday, May 25, 2007 8:03 AM
To: [hidden email]
Subject: GPL: Date format on axis ticks

Hi all
How can I change the date format of the x-axis in GPL.
I tried unit.time(), format("dd/MM/yyyy") but get
still a '.Uhr' (the German word for hour) behind each of the ticks.
For the first date from the example below the label of the tick would come
as
'1.1.03.Uhr'
and I want something as 1.1.2003 or 01.01.2003.
Can someone help here?
Christian


data list list / Date (edate10)  Var1 .
begin data
 01.01.2003 1893.76
 02.01.2003 1923.58
 03.01.2003 1923.75
 06.01.2003 1921.53
 07.01.2003 1903.19
 08.01.2003 1888.31
 09.01.2003 1892.90
end data.

Format date (adate8).
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES= Date Var1
  MISSING =  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Date = col(source(s), name("Date"), unit.time(),
format("dd/MM/yyyy"))
 DATA: Var1=col(source(s), name("Var1"))
 GUIDE: axis(dim(1), label("Date"))
 GUIDE: axis(dim(2), label("Var1"))
 ELEMENT: line(position(Date*Var1), color(color.red))
END GPL.


*******************************
la volta statistics
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
Ch-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
internet: http://www.lavolta.ch/