Commits

Jason R. Coombs  committed a35cc3b

Backed out initializer for Line class as it breaks backward compatibility. A future release of svg.charts should allow for keyword arguments for initialization. For now, use Line({'fields': fields}).

  • Participants
  • Parent commits 3107134

Comments (0)

Files changed (2)

 2.0.9
 ~~~~~
 
-* Adds dedicated initializer to line.py consistent with bar.py to define
-  the fields (thanks to Emmanuel Blot).
 * Corrected buggy logic in y-axis label rendering (thanks to Emmanuel
   Blot).
 * Converted to Unix line endings.

File svg/charts/line.py

 	stacked = False
 	"Fill in the area under the plot"
 	area_fill = False
-	
+
 	scale_divisions = None
 
 	#override some defaults
 	top_align = top_font = right_align = right_font = True
-	
+
 	stylesheet_names = Graph.stylesheet_names + ['plot.css']
 
-	def __init__(self, fields, *args, **kargs):
-		self.fields = fields
-		super(Line, self).__init__(*args, **kargs)
-
 	def max_value(self):
 		data = map(itemgetter('data'), self.data)
 		if self.stacked:
 		range = max_value - min_value
 		top_pad = (range / 20.0) or 10
 		scale_range = (max_value + top_pad) - min_value
-		
+
 		scale_division = self.scale_divisions or (scale_range / 10.0)
-		
+
 		if self.scale_integers:
 		  scale_division = max(1, round(scale_division))
-		  
-		if max_value % scale_division != 0: 
+
+		if max_value % scale_division != 0:
 			max_value += scale_division
-    	
+
 		labels = tuple(float_range(min_value, max_value, scale_division))
 		return labels
 
 		y_label_values = self.get_y_label_values()
 		y_label_span = max(y_label_values) - min(y_label_values)
 		field_height /= float(y_label_span)
-		
+
 		field_width = self.field_width()
 		#line = len(self.data)
-		
+
 		prev_sum = [0]*len(self.fields)
 		cum_sum = [-min_value]*len(self.fields)
 
 		coord_format = lambda c: '%(x)s %(y)s' % c
-		
+
 		for line_n, data in reversed(list(enumerate(self.data, 1))):
 			apath = ''
-			
+
 			if not self.stacked: cum_sum = [-min_value]*len(self.fields)
-		
+
 			cum_sum = map(add, cum_sum, data['data'])
 			get_coords = lambda (i, val): self.calc_coords(i,
 														 val,
 				'd': 'M0 %s L%s' % (self.graph_height, line_path),
 				'class': 'line%(line_n)s' % vars(),
 				})
-			
+
 			if self.show_data_points or self.show_data_values:
 				for i, value in enumerate(cum_sum):
 					if self.show_data_points: