bernat writes:
> I tried it with no results. EXAMPLE:
>
> values=['0','30','50','70']
> values_pos=['50','55','76','256']
> text_arr=objarr(n_elements(values))
> for i=0, n_elements(values)-1 do begin
> itext=OBJ_NEW('IDLgrText', values[i], FONT=self.font, $
> RECOMPUTE_DIMENSIONS=2, /ENABLE_FORMATTING)
> text_arr[i]=itext
> endfor
>
> ;-- then the axis
>
> axis=OBJ_NEW('IDLgrAxis', 1, TEXTPOS=1, TICKDIR=0, $
> TICKTEXT=text_arr, /EXACT, MAJOR=N_ELEMENTS(values), MINOR=0,
> TICKLEN=3)
>
> axis->GetProperty, TICKTEXT=ticktext, YCOORD_CONV=ys
> for i=0, n_elements(ticktext)-1 do begin
> location=[ys[0], (values_pos[i]/256.)*ys[1]]
> ticktext[i]->SetProperty, LOCATION=location
> endfor
>
> xobjview, axis
The thing about object graphics that makes it so much fun
to work with, is that there are thousands of ways to do
something incorrectly and one one way (usually) to do it
right. And the best part is: YOU GET NO FEEDBACK!!! :-)
Try this:
values=['0','30','50','70']
values_pos=['50','55','76','256']
text_arr=objarr(n_elements(values))
for I=0, n_elements(values)-1 do begin
itext=OBJ_NEW('IDLgrText', values_pos[I], $
RECOMPUTE_DIMENSIONS=2, /ENABLE_FORMATTING)
text_arr[I]=itext
endfor
;-- then the axis
axis=OBJ_NEW('IDLgrAxis', 1, TEXTPOS=1, TICKDIR=0, $
TICKTEXT=text_arr, /EXACT, MAJOR=N_ELEMENTS(values), MINOR=0,$
TICKLEN=3, TICKVALUES=values_pos/256.)
axis->GetProperty, TICKTEXT=ticktext, YCOORD_CONV=ys
for I=0, n_elements(ticktext)-1 do begin
location=[ys[0], (values_pos[I]/256.)*ys[1]]
ticktext[I]->SetProperty, LOCATION=location
endfor
xobjview, axis
END
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|