Commits

Ralph Bean  committed 75152d8

Support for root_title.

  • Participants
  • Parent commits 6cc888e

Comments (0)

Files changed (3)

 
 setup(
     name='tw2.protovis.hierarchies',
-    version='0.1.a2',
+    version='0.1.a3',
     description='toscawidgets2 wrapper for the stanford protovis toolkit',
     long_description=long_description,
     author='Ralph Bean',

File tw2/protovis/hierarchies/samples.py

 class DemoCirclePackingWidget(CirclePackingWidget):
     p_height = 500
     p_width = 500
+    root_title = "filesizes in tw2.core"
     p_data = build_tree() # Builds a tree of the filesizes of tw2.core
 

File tw2/protovis/hierarchies/widgets.py

         tree.label.add(pv.Label)
 
 class CirclePackingWidget(twp.PVWidget):
+    root_title = twc.Param("Root title", default="root title")
+
 
     def prepare(self):
         self.init_js = js(
             """
             var format = pv.Format.number();
             var data = %s;
-            """ % self.p_data
+            var title = "%s";
+            """ % (self.p_data, self.root_title)
         )
 
         self.setupRootPanel()
 
         pack = self.add(pv.Layout.Pack)\
-                .nodes(js('pv.dom(data).root("flare").nodes()'))\
+                .nodes(js('pv.dom(data).root(title).nodes()'))\
                 .size(js('function(d) d.nodeValue'))
 
         pack.node.add(pv.Dot)\