Modules
- moksha.wsgi.widgets.all
- moksha.wsgi.widgets.moksha_js
- tw2.bootstrap.wysihtml5
- tw2.core
- tw2.d3
- tw2.dynforms
- tw2.dyntext
- tw2.etc
- tw2.excanvas
- tw2.forms
- tw2.jit
- tw2.jqplugins.chosen
- tw2.jqplugins.cookies
- tw2.jqplugins.dynatree
- tw2.jqplugins.fg
- tw2.jqplugins.flot
- tw2.jqplugins.fullcalendar
- tw2.jqplugins.gritter
- tw2.jqplugins.jqgrid
- tw2.jqplugins.jqplot
- tw2.jqplugins.portlets
- tw2.jqplugins.select2
- tw2.jqplugins.ui
- tw2.jquery
- tw2.polymaps
- tw2.protovis.conventional
- tw2.protovis.core
- tw2.protovis.custom
- tw2.protovis.hierarchies
- tw2.qrcode
- tw2.rrd
- tw2.slideymenu
- tw2.sqla
- tw2.tinymce
- tw2.tipster
- tw2.util.html5shim
- tw2.wysihtml5
tw2.protovis.conventional
A bunch of cool widgets from protovis (under the 'conventional' heading in their examples page).
Get this source from http://github.com/ralphbean/tw2.protovis.conventional
Protovis itself can be found here: http://vis.stanford.edu/protovis/
AreaChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
- p_color
- Color of the area
class DemoAreaChart(AreaChart):
p_data = [{'x': i, 'y' : math.sin(i) + random.random() * .5 + 2}
for i in map(lambda x : x / 10.0, range(100))]
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
BarChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
- p_show_values
- bool -- show values on bars
class DemoBarChart(BarChart):
p_data = [random.random()*100 for i in range(10)]
p_labels = ['label ' + str(i) for i in range(10)]
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
ScatterPlot
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
class DemoScatterPlot(ScatterPlot):
p_data = [{'x': i, 'y' : random.random(), 'z' : 10**(2*random.random())}
for i in range(100)]
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
PieChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
class DemoPieChart(PieChart):
p_data = [random.random() for i in range(10)]
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
LineChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
- p_interpolate
- How to interpolate between values. Linear interpolation ("linear") is the default, producing a straight line between points. For piecewise constant functions (i.e., step functions), either "step-before" or "step-after" can be specified. To draw a clockwise circular arc between points, specify "polar"; to draw a counter clockwise circular arc between points, specify "polar-reverse". To draw open uniform b-splines, specify "basis". To draw cardinal splines, specify "cardinal"; see also #tension.
- p_line_width
- Floating point.
- p_time_series
- Convert from "seconds since the epoch"?
- p_time_series_format
- strftime-type format for time strings. See http://vis.stanford.edu/protovis/jsdoc/symbols/pv.Format.date.html
class DemoLineChart(LineChart):
class AutoRefreshingData(object):
""" Helper class for DemoLineChart. Refreshes its data dynamically. """
def __iter__(self):
n = 20.0
T_scale = 1000.0
now = int(time.time())
tspan = range(now-100, now)
funcs = [
lambda t : math.sin(t/n),
lambda t : abs(math.sin(t/n))**((t%(2*n))/n),
lambda t : math.cos(t/(n+1))*1.5,
]
funcs.append(
lambda t : funcs[1](t) * funcs[2](t)
)
for i in range(len(funcs)):
yield [ { 'x': t*1000.0, 'y' : funcs[i](float(t)) }
for t in tspan ]
def __repr__(self):
print "repr"
return str(self)
def __str__(self):
return str([ele for ele in self])
def __len__(self):
return 4
p_data = AutoRefreshingData()
p_labels = ["billy", "bobby", "sally", "suzie"]
p_time_series = True
p_time_series_format = "%I:%M:%S"
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
StackedAreaChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
- p_time_series
- Convert from "seconds since the epoch"?
- p_time_series_format
- strftime-type format for time strings. See http://vis.stanford.edu/protovis/jsdoc/symbols/pv.Format.date.html
class DemoStackedAreaChart(StackedAreaChart):
class AutoRefreshingData(object):
""" Helper class for DemoLineChart. Refreshes its data dynamically. """
def __iter__(self):
n = 20.0
T_scale = 1000.0
now = int(time.time())
tspan = range(now-100, now)
funcs = [
lambda t : math.sin(t/n),
lambda t : abs(math.sin(t/n))**((t%(2*n))/n),
lambda t : math.cos(t/(n+1))*1.5,
]
funcs.append(
lambda t : funcs[1](t) * funcs[2](t)
)
for i in range(len(funcs)):
yield [ { 'x': t*1000.0, 'y' : abs(funcs[i](float(t))) }
for t in tspan ]
def __repr__(self):
print "repr"
return str(self)
def __str__(self):
return str([ele for ele in self])
def __len__(self):
return 4
p_data = AutoRefreshingData()
p_labels = ["billy", "bobby", "sally", "suzie"]
p_time_series = True
p_time_series_format = "%I:%M:%S"
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>
GroupedBarChart
- pvcls
- None
- p_width
- The width of the panel, in pixel.
- p_height
- The height of the panel, in pixels.
- p_bottom
- The bottom margin, in pixels.
- p_top
- The top margin, in pixels.
- p_left
- The left margin, in pixels.
- p_right
- The right margin, in pixels.
- init_js
- JSSymbol
- p_show_values
- bool -- show values on bars
class DemoGroupedBarChart(GroupedBarChart):
p_data = [
[random.random() + 0.1 for j in range(4)] for i in range(3)]
p_labels = ['DataSet1', 'Dataset2', 'Dataset3']
<%namespace name="tw" module="tw2.core.mako_util"/>
<div ${tw.attrs(attrs=w.attrs)}>
<script type="text/javascript+protovis">
${w.init_js.src|n}
var vis = new pv.Panel()
% for f in w._pv_prop_funcs:
${f.src|n}
% endfor
% for a in w._adds:
${a.display()|n}
% endfor
vis.render();
</script>
</div>