src/pages/analyze.js
function addWidgetForFilter (view, filter, editModeHint) {
  var gridster = view._widgetsGridster;
  var row = filter.row || 1;
  var col = filter.col || 1;
  var sizeX = filter.size_x || 3;
  var sizeY = filter.size_y || 3;

  var el = gridster.add_widget('<div class="widgetOuterFrame"></div>', sizeX, sizeY, col, row);
  var frameView = new WidgetFrameView({
    model: filter
  });

  // render, and render content of widget frame
  view.renderSubview(frameView, el[0]);
  frameView.renderContent();

  // link element and view so we can:
  // a) on remove, get to the HTMLElement from the WidgetFrameView
  // b) on resize, get to the WidgetFrameView from the HTMLElement
  frameView.gridsterHook = el[0];
  $(el[0]).data('spotWidgetFrameView', frameView);

  // try to initialize and render possibly present data
  // only follow editModeHint when the widget is configured, default to true
  var chartView = frameView.widget;
  chartView.model.updateConfiguration();
  if (chartView.model.isConfigured) {
    if (!filter.isInitialized) {
      filter.initDataFilter();
    }
    if (!chartView.isInitialized) {
      chartView.initChart();
    }
    chartView.update();

    frameView.editMode = editModeHint;
  } else {
    // widget is not configured, ignore editModeHint
    // and always go to edit mode
    frameView.editMode = true;
  }

  filter.on('newData', function () {
    chartView.update();
  });
}
function addWidgetForFilter (view, filter, editModeHint) {
  var gridster = view._widgetsGridster;
  var row = filter.row || 1;
  var col = filter.col || 1;
  var sizeX = filter.size_x || 3;
  var sizeY = filter.size_y || 3;

  var el = gridster.add_widget('<div class="widgetOuterFrame"></div>', sizeX, sizeY, col, row);
  var frameView = new WidgetFrameView({
    model: filter
  });

  // render, and render content of widget frame
  view.renderSubview(frameView, el[0]);
  frameView.renderContent();

  // link element and view so we can:
  // a) on remove, get to the HTMLElement from the WidgetFrameView
  // b) on resize, get to the WidgetFrameView from the HTMLElement
  frameView.gridsterHook = el[0];
  $(el[0]).data('spotWidgetFrameView', frameView);

  // try to initialize and render possibly present data
  // only follow editModeHint when the widget is configured, default to true
  var chartView = frameView.widget;
  chartView.model.updateConfiguration();
  if (chartView.model.isConfigured) {
    if (!filter.isInitialized) {
      filter.initDataFilter();
    }
    if (!chartView.isInitialized) {
      chartView.initChart();
    }
    chartView.update();

    frameView.editMode = editModeHint;
  } else {
    // widget is not configured, ignore editModeHint
    // and always go to edit mode
    frameView.editMode = true;
  }

  filter.on('newData', function () {
    chartView.update();
  });
}
function addWidgetForFilter ( view , filter , editModeHint ) { var gridster = view . _widgetsGridster ; var row = filter . row || 1 ; var col = filter . col || 1 ; var sizeX = filter . size_x || 3 ; var sizeY = filter . size_y || 3 ; var el = gridster . add_widget ( '<div class="widgetOuterFrame"></div>' , sizeX , sizeY , col , row ) ; var frameView = new WidgetFrameView ( { model : filter } ) ; // render, and render content of widget frame view . renderSubview ( frameView , el [ 0 ] ) ; frameView . renderContent ( ) ; // link element and view so we can: // a) on remove, get to the HTMLElement from the WidgetFrameView // b) on resize, get to the WidgetFrameView from the HTMLElement frameView . gridsterHook = el [ 0 ] ; $ ( el [ 0 ] ) . data ( 'spotWidgetFrameView' , frameView ) ; // try to initialize and render possibly present data // only follow editModeHint when the widget is configured, default to true var chartView = frameView . widget ; chartView . model . updateConfiguration ( ) ; if ( chartView . model . isConfigured ) { if ( ! filter . isInitialized ) { filter . initDataFilter ( ) ; } if ( ! chartView . isInitialized ) { chartView . initChart ( ) ; } chartView . update ( ) ; frameView . editMode = editModeHint ; } else { // widget is not configured, ignore editModeHint // and always go to edit mode frameView . editMode = true ; } filter . on ( 'newData' , function ( ) { chartView . update ( ) ; } ) ; }
Add a widget to the analyze page for the given filter

view {View}             Ampersand View instance of the analyze page
filter {Filter}         Spot filter instance to create the widget for
editModeHint {boolean}  Try to start plot in editMode (ie. accepts dnd of facets) [true] or in interaction mode (false)
Add a widget to the analyze page for the given filter