#NEWLINE# def draw( self ) : #NEWLINE# #INDENT# self . hide_line_markers = True #NEWLINE# Pie . __base__ . draw ( self ) #NEWLINE# if ( not self . has_gdata ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# radius = ( ( min ( [ self . graph_width , self . graph_height ] ) / 2.0 ) * 0.8 ) #NEWLINE# center_x = ( self . graph_left + ( self . graph_width / 2.0 ) ) #NEWLINE# center_y = ( ( self . graph_top + ( self . graph_height / 2.0 ) ) - 10 ) #NEWLINE# total_sum = self . sums_for_pie ( ) #NEWLINE# prev_degrees = self . zero_degree #NEWLINE# def percentages_compare( comp_a , comp_b ) : #NEWLINE# #INDENT# 'Use full data since we can easily calculate percentages' #NEWLINE# if ( comp_a [ 'values' ] [ 0 ] > comp_b [ 'values' ] [ 0 ] ) : #NEWLINE# #INDENT# return 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( comp_a [ 'values' ] [ 0 ] < comp_b [ 'values' ] [ 0 ] ) : #NEWLINE# #INDENT# return ( - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return 0 #NEWLINE# #UNINDENT# sorted ( self . gdata , cmp = percentages_compare ) #NEWLINE# dl = DrawableList ( ) #NEWLINE# for data_row in self . gdata : #NEWLINE# #INDENT# if ( data_row [ 'values' ] [ 0 ] > 0 ) : #NEWLINE# #INDENT# dl . append ( DrawableStrokeColor ( label_string [ 'color' ] ) ) #NEWLINE# dl . append ( DrawableFillColor ( 'transparent' ) ) #NEWLINE# dl . append ( DrawableStrokeWidth ( radius ) ) #NEWLINE# current_degrees = ( ( float ( data_row [ 'values' ] [ 0 ] ) / total_sum ) * 360.0 ) #NEWLINE# dl . append ( DrawableEllipse ( center_x , center_y , ( radius / 2.0 ) , ( radius / 2.0 ) , prev_degrees , ( ( prev_degrees + current_degrees ) + 0.5 ) ) ) #NEWLINE# half_angle = ( prev_degrees + ( ( ( prev_degrees + current_degrees ) - prev_degrees ) / 2 ) ) #NEWLINE# label_val = round ( ( ( float ( data_row [ 'values' ] [ 0 ] ) / total_sum ) * 100.0 ) ) #NEWLINE# if ( not ( label_val < self . hide_labels_less_than ) ) : #NEWLINE# #INDENT# label_string = ( str ( label_val ) + '%%' ) #NEWLINE# self . draw_label ( center_x , center_y , half_angle , ( radius + ( radius * TEXT_OFFSET_PERCENTAGE ) ) , label_string ) #NEWLINE# #UNINDENT# prev_degrees += current_degrees #NEWLINE# #UNINDENT# #UNINDENT# self . base_image . draw ( dl )