Commits

Ralph Bean committed 98e7446

added marks

  • Participants
  • Parent commits 6ff7d22

Comments (0)

Files changed (1)

File tw2/protovis/conventional/widgets.py

                 w = %i,
                 h = %i,
                 x = pv.Scale.linear(data, function(d) d.x).range(0, w),
-                y = pv.Scale.linear(0, 5).range(0, h);
+                y = pv.Scale.linear(0, 4).range(0, h);
             """ % (self.py_data, self.p_width, self.p_height))
                           
         self.init().width(self.p_width).height(self.p_height) \
                 .bottom(self.p_bottom).top(self.p_top) \
                 .left(self.p_left).right(self.p_right)
 
+        self.add(pv.Rule) \
+                .data(js('x.ticks()')) \
+                .visible(js('function(d) { return d }')) \
+                .left(js('x')) \
+                .bottom(-5) \
+                .height(5) \
+                .add(pv.Label) \
+                .bottom(-5) \
+                .text(js('x.tickFormat'))
+
+        self.add(pv.Rule) \
+                .data(js('y.ticks(5)')) \
+                .bottom(js('y')) \
+                .strokeStyle(js('function(d) { return d ? "#eee" : "#000"}')) \
+                .anchor("left")\
+                .add(pv.Label).text(js('y.tickFormat'))
+
         self.add(pv.Area) \
-                .data(self.py_data) \
-                .bottom(1) \
-                .left(js('function(d) x(d.x)')) \
-                .height(twc.JSSymbol(src='function(d) y(d.y)')) \
-                .fillStyle(self.p_color) \
-                .anchor('top').add(pv.Line).lineWidth(3)
+                 .data(js('data')) \
+                 .bottom(1) \
+                 .left(js('function(d) x(d.x)')) \
+                 .height(twc.JSSymbol(src='function(d) y(d.y)')) \
+                 .fillStyle(self.p_color) \
+                 .anchor('top').add(pv.Line).lineWidth(3)
+