; By Pavel A. Romashkin, NOAA-CMDL, 1999
;************************************
; This routine will shorten tick labels on a given object axis.
; If AX_MAX (float) is over 1000. for AXIS ('IDLgrAxis' instance), then remove 3 zeros from tick marks
; and append ' x1000' to existing axis title. If TITLE is provided, it will contain ' x1000'.

pro ticks1k, the_AXIS, AX_MAX, A_TITLE, format=format

if n_elements(format) eq 0 then format = '(F5.1)'

the_AXIS -> getProperty, tickvalues=tick_text, ticktext=tick_oref, title=axis_title_oref, $
	crange=crange
ax_max = crange[1]

; Get axis title, if present.
if obj_valid(axis_title_oref) then $
	axis_title_oref -> getproperty, string=axis_title $
else axis_title = ''

	; Set axis_title to A_TITLE, if it was supplied. If not or if blank, use old title.
if size(a_title, /type) eq 7 then $
if strlen(a_title) gt 0 then axis_title = a_title

if AX_MAX ge 1000. then begin ; This means, divide tick marks by 1000 and change axis label.
	tick_text = string(tick_text / 1000., format=format)
	tick_oref -> setproperty, string=tick_text
	if strpos(axis_title, ' x1000') eq -1 then axis_title = axis_title+' x1000'
endif else begin; Maybe it was 1k scaled; check and remove, because limit is less than 1k.
	loc = strpos(axis_title, 'x1000')
	if loc ne -1 then axis_title = strmid(axis_title, 0, loc)
endelse

	; Set the title to its value.
if obj_valid(axis_title_oref) then axis_title_oref -> setProperty, string=axis_title
end
