Changeset 75
- Timestamp:
- 12/20/07 06:21:14 (4 years ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
examples/linechart.png (modified) (previous)
-
src/line.py (modified) (1 diff)
-
src/scatter.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/line.py
r54 r75 34 34 x = (xval - self.minxval) * self.xscale 35 35 y = 1.0 - (yval - self.minyval) * self.yscale 36 point = Point(x, clamp(0.0, 1.0, y), xval, yval, name)36 point = Point(x, y, xval, yval, name) 37 37 38 if 0.0 <= point.x <= 1.0 :38 if 0.0 <= point.x <= 1.0 and 0.0 <= point.y <= 1.0: 39 39 self.points.append(point) 40 40 -
trunk/src/scatter.py
r74 r75 18 18 from pycha.chart import Chart 19 19 from pycha.color import hex2rgb, clamp 20 from pycha.line import Point 20 from pycha.line import Point, LineChart 21 21 22 class ScatterplotChart(Chart): 23 24 def __init__(self, surface=None, options={}): 25 super(ScatterplotChart, self).__init__(surface, options) 26 self.points = [] 27 28 def _updateChart(self): 29 """Evaluates measures for scatterplots""" 30 self.points = [] 31 32 for i, (name, store) in enumerate(self.datasets): 33 for item in store: 34 xval, yval = item 35 x = (xval - self.minxval) * self.xscale 36 y = 1.0 - (yval - self.minyval) * self.yscale 37 point = Point(x, clamp(0.0, 1.0, y), xval, yval, name) 38 39 if 0.0 <= point.x <= 1.0: 40 self.points.append(point) 41 22 class ScatterplotChart(LineChart): 23 42 24 def _renderChart(self, cx): 43 25 """Renders a scatterplot"""
