On Sat, 28 May 2005 11:18:36 +0200
Joerg Lehmann <[EMAIL PROTECTED]> wrote:

> You could just define a new style deriving from the arrow style and
> replace the drawpoint function to do what you want. Just have a look at
> the code (in pyx/graph/style.py), it's pretty straightforward.
> 

Here it is:

class arrow(graph.style.arrow):
  def drawpoint(self, privatedata, sharedata, graph, point):
    if privatedata.lineattrs is not None and privatedata.arrowattrs is not None 
and sharedata.vposvalid:
      linelength_pt = unit.topt(self.linelength)
      x_pt, y_pt = graph.vpos_pt(*sharedata.vpos)
      try:
        angle = point["angle"] + 0.0
        size = point["size"] + 0.0
      except:
        pass
      else:
        if point["size"] > self.epsilon:
          dx = math.cos(angle*math.pi/180)
          dy = math.sin(angle*math.pi/180)
          x1 = x_pt #-0.5*dx*linelength_pt*size
          y1 = y_pt #-0.5*dy*linelength_pt*size
          x2 = x_pt+1.0*dx*linelength_pt*size
          y2 = y_pt+1.0*dy*linelength_pt*size
          privatedata.arrowcanvas.stroke(path.line_pt(x1, y1, x2, y2), 
privatedata.lineattrs +
            [deco.earrow(privatedata.arrowattrs, size=self.arrowsize*size)])

Can I suggest that these numbers (-0.5 and +0.5, which I changed to 0.0 and 1.0)
become parameters ?

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to