[jToolkit-cvs] jToolkit/widgets chart.py,1.12,1.13
Brought to you by:
davidfraser,
friedelwolff
From: <dav...@us...> - 2004-02-10 09:05:01
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24559 Modified Files: chart.py Log Message: Removed useless function 'draw'. Added in custom figure size settings to take care of long tag names Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** chart.py 10 Feb 2004 09:00:14 -0000 1.12 --- chart.py 10 Feb 2004 09:01:49 -0000 1.13 *************** *** 52,61 **** self.options.update(args) - def draw(self): - # Put options into effect. Derived class implementations of draw() - # should call this method before calling gdchart.chart(). - for key in self.options.keys(): - set(self.figure.get_current_axis(),key,self.options[key]) - def getimagefromtempfile(self): #Save temporary file --- 52,55 ---- *************** *** 72,76 **** def gethtml(self): gdchartLock.acquire() - self.draw() self.drawimage() img = self.getimagefromtempfile() --- 66,69 ---- *************** *** 98,101 **** --- 91,98 ---- #TODO: x axis spacing should be according to time + #Set the size of the subplot big enough to handle times + #[left, bottom, width, height] out of 1 + self.figure.add_axes([.08,.25,.9,.7],'w') + #Set the min/max of each axis ymin = sys.maxint *************** *** 150,153 **** --- 147,164 ---- def drawimage(self): + #Find the longest text on the x axis + maxtextlen = 0 + for text in self.xdata: + if len(text) > maxtextlen: + maxtextlen = len(text) + + #Convert it to a proportion of the image + bottomProportion = .1 + maxtextlen*.013 + heightProportion = .99 - bottomProportion + + #Set the size of the subplot big enough to handle times + #[left, bottom, width, height] out of 1 + self.figure.add_axes([.125,bottomProportion,.825,heightProportion],'w') + #Set the min/max of each axis ymin = sys.maxint |