~alf-rodrigo/cairoplot/trunk

« back to all changes in this revision

Viewing changes to trunk/cairoplot.py

  • Committer: Rodrigo Moreira Araujo
  • Date: 2009-04-03 00:39:10 UTC
  • Revision ID: rodrigo@scrooge-20090403003910-jz4glgb1zswjz9g5
cairoplot.py: Bug fixing on new color mode input

Show diffs side-by-side

added added

removed removed

Lines of Context:
1178
1178
                x0 = self.borders[HORZ]
1179
1179
                y0 = self.borders[VERT] + i*self.steps[VERT] + (i+1)*self.space
1180
1180
                for number,key in enumerate(series):
1181
 
                    linear = cairo.LinearGradient( key*self.steps[HORZ]/2, y0, key*self.steps[HORZ]/2, y0 + self.steps[VERT] )
1182
 
                    color = self.series_colors[number]
1183
 
                    linear.add_color_stop_rgba(0.0, 3.5*color[0]/5.0, 3.5*color[1]/5.0, 3.5*color[2]/5.0,1.0)
1184
 
                    linear.add_color_stop_rgba(1.0, *color[:4])
1185
 
                    self.context.set_source(linear)
 
1181
                    if self.series_colors[number][4] in ('radial','linear') :
 
1182
                        linear = cairo.LinearGradient( key*self.steps[HORZ]/2, y0, key*self.steps[HORZ]/2, y0 + self.steps[VERT] )
 
1183
                        color = self.series_colors[number]
 
1184
                        linear.add_color_stop_rgba(0.0, 3.5*color[0]/5.0, 3.5*color[1]/5.0, 3.5*color[2]/5.0,1.0)
 
1185
                        linear.add_color_stop_rgba(1.0, *color[:4])
 
1186
                        self.context.set_source(linear)
 
1187
                    elif self.series_colors[number][4] == 'solid':
 
1188
                        self.context.set_source_rgba(*self.series_colors[number][:4])
1186
1189
                    if self.rounded_corners:
1187
1190
                        self.draw_rectangle(number, len(series), x0, y0, x0+key*self.steps[HORZ], y0+self.steps[VERT])
1188
1191
                        self.context.fill()
1351
1354
                x0 = self.borders[HORZ] + i*self.steps[HORZ] + (i+1)*self.space
1352
1355
                y0 = 0
1353
1356
                for number,key in enumerate(series):
1354
 
                    if self.series_colors[number][4] == 'linear':
 
1357
                    if self.series_colors[number][4] in ('linear','radial'):
1355
1358
                        linear = cairo.LinearGradient( x0, key*self.steps[VERT]/2, x0 + self.steps[HORZ], key*self.steps[VERT]/2 )
1356
1359
                        color = self.series_colors[number]
1357
1360
                        linear.add_color_stop_rgba(0.0, 3.5*color[0]/5.0, 3.5*color[1]/5.0, 3.5*color[2]/5.0,1.0)
1644
1647
        cr = self.context
1645
1648
        for number,series in enumerate(self.data):
1646
1649
            next_angle = angle + 2.0*math.pi*series/self.total
1647
 
            if self.gradient or self.series_colors[number][4] == 'radial':
 
1650
            if self.gradient or self.series_colors[number][4] in ('linear','radial'):
1648
1651
                gradient_color = cairo.RadialGradient(self.center[0], self.center[1], 0, self.center[0], self.center[1], self.radius)
1649
1652
                gradient_color.add_color_stop_rgba(0.3, *self.series_colors[number][:4])
1650
1653
                gradient_color.add_color_stop_rgba(1, self.series_colors[number][0]*0.7,