Changeset 109 for trunk/src/scatter.py

Show
Ignore:
Timestamp:
10/27/08 16:49:58 (4 years ago)
Author:
lgs
Message:

Some refactoring and support for negative values in line and bar charts. Inspired by Nicolas patch

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/scatter.py

    r96 r109  
    1616# along with PyCha.  If not, see <http://www.gnu.org/licenses/>. 
    1717 
    18 from pycha.chart import Chart 
    19 from pycha.color import hex2rgb, clamp 
    20 from pycha.line import Point, LineChart 
     18from pycha.line import LineChart 
    2119 
    2220class ScatterplotChart(LineChart): 
     
    2422    def _renderChart(self, cx): 
    2523        """Renders a scatterplot""" 
    26         def drawSymbol(point, size=2): 
    27             ox = point.x * self.area.w + self.area.x 
    28             oy = point.y * self.area.h + self.area.y 
    29             cx.move_to(ox-size, oy  ) 
    30             cx.line_to(ox+size, oy  ) 
    31             cx.move_to(ox     , oy-size) 
    32             cx.line_to(ox     , oy+size) 
     24        def drawSymbol(point, size=2): 
     25            ox = point.x * self.area.w + self.area.x 
     26            oy = point.y * self.area.h + self.area.y 
     27            cx.move_to(ox-size, oy  ) 
     28            cx.line_to(ox+size, oy  ) 
     29            cx.move_to(ox     , oy-size) 
     30            cx.line_to(ox     , oy+size) 
    3331 
    3432        def preparePath(storeName, size=2): 
     
    4240 
    4341        cx.set_line_width(self.options.stroke.width) 
    44         # TODO: self.options.stroke.shadow 
    45         for key in self._getDatasetsKeys(): 
    46             cx.set_source_rgb(*self.options.colorScheme[key]) 
    47             preparePath(key) 
    48             cx.stroke() 
     42        # TODO: self.options.stroke.shadow 
     43        for key in self._getDatasetsKeys(): 
     44            cx.set_source_rgb(*self.options.colorScheme[key]) 
     45            preparePath(key) 
     46            cx.stroke() 
    4947 
    5048        cx.restore() 
    5149 
    5250    def _renderLines(self, cx): 
    53         """We don't need lines in the background""" 
    54         pass 
     51        # We don't need lines in the background 
     52        pass