Jason R. Coombs avatar Jason R. Coombs committed 797661f

Thanks to Emmanuel Blot for patch:
* Adds dedicated initializer to line.py consistent with bar.py to define
the fields.
* Corrected buggy logic in y-axis label rendering.

Comments (0)

Files changed (1)

svg/charts/line.py

 	
 	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:
 		scale_division = self.scale_divisions or (scale_range / 10.0)
 		
 		if self.scale_integers:
-		  scale_division = min(1, round(scale_division))
-		
-		if max_value % scale_division == 0: 
+		  scale_division = max(1, round(scale_division))
+		  
+		if max_value % scale_division != 0: 
 			max_value += scale_division
+    	
 		labels = tuple(float_range(min_value, max_value, scale_division))
 		return labels
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.