comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDLgrAxis set TICKVALUES in specific positions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDLgrAxis set TICKVALUES in specific positions [message #61422] Thu, 17 July 2008 09:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Font compatibility question
Next Topic: Re: Font compatibility question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:19:39 PDT 2025

Total time taken to generate the page: 0.00394 seconds