
from tw.jquery.flot import FlotWidget
from moksha.api.widgets import LiveWidget

class LiveFlotWidget(LiveWidget):
    """ A live graphing widget """
    topic = 'flot_demo'
    params = ['id', 'data', 'options', 'height', 'width', 'onmessage']
    children = [FlotWidget('flot')]
    onmessage = '$.plot($("#${id}"),json[0]["data"],json[0]["options"])'
    template = '<div id="${id}" style="width:${width};height:${height};" />'
    height = '250px'
    width = '390px'
    options = {}
    data = [{}]


from tw.jquery.flot import flot_js, excanvas_js, flot_css
from moksha.api.widgets import LiveWidget

class LiveFlotWidget(LiveWidget):
    """ A live graphing widget """
    topic = 'flot_demo'
    params = ['id', 'data', 'options', 'height', 'width', 'onmessage']
    onmessage = '$.plot($("#${id}"),json[0]["data"],json[0]["options"])'
    template = '<div id="${id}" style="width:${width};height:${height};" />'
    javascript = [flot_js, excanvas_js]
    css = [flot_css]
    height = '250px'
    width = '390px'
    options = {}
    data = [{}]

Make our LiveFlotWidget not pull in jQuery
Make our LiveFlotWidget not pull in jQuery

  
- from tw.jquery.flot import FlotWidget
+ from tw.jquery.flot import flot_js, excanvas_js, flot_css
  from moksha.api.widgets import LiveWidget
  
  class LiveFlotWidget(LiveWidget):
      """ A live graphing widget """
      topic = 'flot_demo'
      params = ['id', 'data', 'options', 'height', 'width', 'onmessage']
-     children = [FlotWidget('flot')]
      onmessage = '$.plot($("#${id}"),json[0]["data"],json[0]["options"])'
      template = '<div id="${id}" style="width:${width};height:${height};" />'
+     javascript = [flot_js, excanvas_js]
+     css = [flot_css]
      height = '250px'
      width = '390px'
      options = {}
      data = [{}]
  
Make our LiveFlotWidget not pull in jQuery
## Code Before:

from tw.jquery.flot import FlotWidget
from moksha.api.widgets import LiveWidget

class LiveFlotWidget(LiveWidget):
    """ A live graphing widget """
    topic = 'flot_demo'
    params = ['id', 'data', 'options', 'height', 'width', 'onmessage']
    children = [FlotWidget('flot')]
    onmessage = '$.plot($("#${id}"),json[0]["data"],json[0]["options"])'
    template = '<div id="${id}" style="width:${width};height:${height};" />'
    height = '250px'
    width = '390px'
    options = {}
    data = [{}]

## Instruction:
Make our LiveFlotWidget not pull in jQuery
## Code After:

from tw.jquery.flot import flot_js, excanvas_js, flot_css
from moksha.api.widgets import LiveWidget

class LiveFlotWidget(LiveWidget):
    """ A live graphing widget """
    topic = 'flot_demo'
    params = ['id', 'data', 'options', 'height', 'width', 'onmessage']
    onmessage = '$.plot($("#${id}"),json[0]["data"],json[0]["options"])'
    template = '<div id="${id}" style="width:${width};height:${height};" />'
    javascript = [flot_js, excanvas_js]
    css = [flot_css]
    height = '250px'
    width = '390px'
    options = {}
    data = [{}]
