Re: GUI strategy advice needed [message #44153 is a reply to message #44152] |
Tue, 24 May 2005 12:04   |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Leslie Welser wrote:
>> Michael Wallace writes:
>> I don't mean to take this thread off subject, but what is the problem
>
>
>> with IDLgrColorbar? I've used OG colorbars in a lot of my plots and
>> never had any issue with them. So, what's not to understand? Just
>
> curious.
>
> Michael, since you seem to understand the IDLgrColorbar, can you give
> me a pointer? My colorbar looks great and is positioned correctly, but
> no matter what I try I can't get the tickmarks to be anything but the
> values from 0-255. In other words, I can't get the colors themselves
> to "link up" with the data values in my plot. Thanks for any help you
> can give me!
>
I'm sure Michael has something better up his sleeve, but I have been
manipulating the tick values by explicitly providing the tick text, ala...
datarange = [15,35.]
colorbar = obj_new('idlgrcolorbar', /show_outline, /show_axis)
colorbar->GetProperty, tickvalues = ticks
nticks = n_elements(ticks)
myTicks = FINDGEN(nTicks)/(nTicks-1) * (dataRange[1]-dataRange[0]) +
dataRange[0]
myTickString = STRTRIM(myTicks,2)
ticktext = OBJ_NEW('idlgrtext', mytickString)
colorbar->SetProperty, ticktext = ticktext
xobjview, colorbar
If you do it this way you'll want to cleanup the ticktext on your own.
I have a simple object that inherits from IDLgrContainer that cleans up
the ticktext, fonts and titles when the colorbar is destroyed. That
prevents memory leakage.
Cheers,
Ben
|
|
|