tw2.jqplugins.flot

TW2 widget wrapper the jquery ui jqplot

Get the source from http://github.com/toscawidgets/tw2.jqplugins.jqplot

flot_js
  • location
    • Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
  • modname
    • Name of Python module that contains the file.
  • filename
    • Path to file, relative to module base.
  • no_inject
    • Don't inject this link. (Default: False)
  • whole_dir
    • Make the whole directory available. (Default: False)

FlotWidget
sin plot
  • options
    • Plot options
  • events
    • (dict) (BETA) javascript callbacks for events
  • data
    • An array of data series
  • height
    • The height of the graph
  • width
    • The width of the graph
  • label
    • Label for the graph
class DemoFlot(FlotWidget):
    data = [
        {
            'data': [[f(i), math.sin(f(i))] for i in range(20)],
            'label': "sin(x)"
        }
    ]
    label = "sin plot"
<%namespace name="tw" module="tw2.core.mako_util"/>
<div id="${w.attrs['id']}"
	style="width:${w.attrs['width']};height:${w.attrs['height']}"></div>
  <div id="flotLabel">${w.label}</div>
  <script type="text/javascript">
	% if w.data:
    $.plot($("#${w.selector}"), ${w._data}, ${w._options});
	% endif
  </script>
</div>