#NEWLINE# def drawGraph( self , **params ) : #NEWLINE# #INDENT# self . pieLabels = params . get ( 'pieLabels' , 'horizontal' ) #NEWLINE# self . total = sum ( [ t [ 1 ] for t in self . data ] ) #NEWLINE# self . slices = [ ] #NEWLINE# for ( name , value ) in self . data : #NEWLINE# #INDENT# self . slices . append ( { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'value' : value , #NEWLINE# 'percent' : ( value / self . total ) , #NEWLINE# 'color' : next ( self . colors ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# titleSize = ( self . defaultFontParams [ 'size' ] + math . floor ( math . log ( self . defaultFontParams [ 'size' ] ) ) ) #NEWLINE# self . setFont ( size = self ) #NEWLINE# self . setColor ( self . foregroundColor ) #NEWLINE# if params . get ( 'title' ) : #NEWLINE# #INDENT# self . drawTitle ( params [ 'title' ] ) #NEWLINE# #UNINDENT# self . setFont ( ) #NEWLINE# if ( not params . get ( 'hideLegend' , False ) ) : #NEWLINE# #INDENT# elements = [ ( slice [ 'name' ] , slice [ 'color' ] , None ) for slice in self . slices ] #NEWLINE# self . drawLegend ( elements ) #NEWLINE# #UNINDENT# self . drawSlices ( ) #NEWLINE# self . valueLabelsMin = float ( params . get ( 'valueLabelsMin' , 5 ) ) #NEWLINE# self . valueLabels = params . get ( 'valueLabels' , 'percent' ) #NEWLINE# assert ( self . valueLabels in self . validValueLabels ) , ( 'valueLabels=%s must be one of %s' % ( self . valueLabels , self . validValueLabels ) ) #NEWLINE# if ( self . valueLabels != 'none' ) : #NEWLINE# #INDENT# self . drawLabels ( )