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

Home » Public Forums » archive » automatic placement of legend in 2-D graph
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: automatic placement of legend in 2-D graph [message #58290 is a reply to message #58172] Thu, 24 January 2008 11:30 Go to previous messageGo to previous message
Jean-Paul Davis is currently offline  Jean-Paul Davis
Messages: 17
Registered: March 1998
Junior Member
Okay, so I came up with an idea on my own that should work, but it
appears impossible to implement using the IDLgrLegend object. Yeah, I
know the simplest answer is to write my own Legend object (or use
someone else's), but that's probably not the simplest course of action
for me.

Anyway, here's the problem. I cannot get the IDLgrLegend object to
recompute its dimensions with changes in the containing view object's
viewplane rectangle. The heirarchy is rooted at this view object,
which contains two model objects, one for the plot and axes objects,
the other for the legend (so I can translate the legend around
separately from the plot and axes objects). The dimensions returned
by IDLgrLegend::ComputeDimensions or IDLgrLegend::GetProperty(xrange,
yrange) are correct for the viewplane rectangle set when the IDLgrView
object is initialized, but never change after that, regardless of the
setting of IDLgrLegend's Recompute property and regardless of how many
times I redraw the window after subsequent changes to the viewplane
rectangle. Here is an example to show this:

ofont = obj_new('IDLgrFont', 'Helvetica', size=16.0)
oxtitle = obj_new('IDLgrText', string='X-AXIS TITLE', recompute=2,
font=ofont)
oxaxis = obj_new('IDLgrAxis', direction=0, location=[9999,0,0.01],
title=oxtitle)
oxaxis -> getproperty, ticktext=oxtlab
oxtlab -> setproperty, , recompute=2, font=ofont
omodel = obj_new('IDLgrModel')
omodel -> add, oxaxis
olegend = obj_new('IDLgrLegend', item_linestyle=[0], item_name=['Test
Legend'], font=ofont, glyph_width=3.0, gap=0.3)
olegend -> setproperty, recompute=1 ; according to documentation, this
cannot be set by init
olegmod = obj_new('IDLgrModel')
olegmod -> add, olegend
oview = obj_new('IDLgrView', viewplane_rect=[0.0,0.0,1.0,1.0])
oview -> add, omodel
oview -> add, olegmod
owin = obj_new('IDLgrWindow', graphics_tree=oview)
owin -> draw
lsize = olegend -> computedimensions(owin)
print, lsize
oview -> setproperty, viewplane_rect=[-0.2,-0.2,1.4,1.4]
owin -> draw
lsize2 = olegend -> computedimensions(owin)
print, lsize2

If IDLgrLegend were recomputing it's dimensions, then I'd expect
lsize2 to be different from lsize (the legend is "wider" in the
normalized coordinates indicated by oxaxis object after increasing the
viewplane rectangle). Has anyone seen this or have a work-around?

Jean-Paul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Travel Destination: Holland
Next Topic: Re: Re-gridding Problem

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

Current Time: Mon Dec 01 15:15:04 PST 2025

Total time taken to generate the page: 0.79864 seconds