Lorenzo Gil Sánchez avatar Lorenzo Gil Sánchez committed fbd40e6

Better way to draw the layout areas

Comments (0)

Files changed (1)

         self.colorScheme = None
 
         # debug mode to draw aditional hints
-        self.debug = True
+        self.debug = False
 
     def addDataset(self, dataset):
         """Adds an object containing chart data to the storage hash"""
         self.y_ticks = Area()
         self.chart = Area()
 
+        self._areas = (
+            (self.title, (1, 126/255.0, 0)), # orange
+            (self.y_label, (41/255.0, 91/255.0, 41/255.0)), # grey
+            (self.x_label, (41/255.0, 91/255.0, 41/255.0)), # grey
+            (self.y_tick_labels, (0, 115/255.0, 0)), # green
+            (self.x_tick_labels, (0, 115/255.0, 0)), # green
+            (self.y_ticks, (229/255.0, 241/255.0, 18/255.0)), # yellow
+            (self.x_ticks, (229/255.0, 241/255.0, 18/255.0)), # yellow
+            (self.chart, (75/255.0, 75/255.0, 1.0)), # blue
+            )
+
     def update(self, cx, options, width, height, xticks, yticks):
         self.title.x = options.padding.left
         self.title.y = options.padding.top
             cx.fill()
 
         cx.save()
-        draw_area(self.title, 1, 126/255.0, 0) # orange
-        draw_area(self.y_label, 41/255.0, 91/255.0, 41/255.0) # grey
-        draw_area(self.x_label, 41/255.0, 91/255.0, 41/255.0) # grey
-        draw_area(self.y_tick_labels, 0, 115/255.0, 0) # green
-        draw_area(self.x_tick_labels, 0, 115/255.0, 0) # green
-        draw_area(self.y_ticks, 229/255.0, 241/255.0, 18/255.0) # yellow
-        draw_area(self.x_ticks, 229/255.0, 241/255.0, 18/255.0) # yellow
-        draw_area(self.chart, 75/255.0, 75/255.0, 1.0) # blue
+        for area, color in self._areas:
+            draw_area(area, *color)
         cx.restore()
 
     def _getAxisTickLabelsSize(self, cx, options, axis, ticks):
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.