Generate a widget visualization using the widget. The export_viz_to_widget
    method passes the visualization JSON to the instantiated widget, which is
    returned and visualized on the front-end.
764269
def widget(self, which_viz='viz'):
    '''
    
    '''
    if hasattr(self, 'widget_class') == True:

      # run clustering if necessary
      if len(self.viz['row_nodes']) == 0:
        self.cluster()

      self.widget_instance = self.widget_class(network = self.export_viz_to_widget(which_viz))

      return self.widget_instance
    else:
      print('Can not make widget because Network has no attribute widget_class')
      print('Please instantiate Network with clustergrammer_widget using: Network(clustergrammer_widget)')
176059
def create_widget(self):
        
        d = self.declaration
        self.widget = TextView(self.get_context(), None,
                               d.style or '@attr/textViewStyle')
1356704
function createVisualization(data) {
  var json = buildHierarchy(data);

  // Basic setup of page elements.
  initializeBreadcrumbTrail();

  // Bounding circle underneath the sunburst, to make it easier to detect
  // when the mouse leaves the parent g.
  vis.append("svg:circle")
      .attr("r", radius)
      .style("opacity", 0);

  // For efficiency, filter nodes to keep only those large enough to see.
  var nodes = partition.nodes(json)
      .filter(function(d) {
      return (d.dx > 0.005); // 0.005 radians = 0.29 degrees
      });

  var path = vis.data([json]).selectAll("path")
      .data(nodes)
      .enter().append("svg:path")
      .attr("display", function(d) { return d.depth ? null : "none"; })
      .attr("d", arc)
      .attr("fill-rule", "evenodd")
      .style("fill", function(d) { return colors[d.depth]; })
      .style("opacity", 1)
      .on("mouseover", mouseover);

  // Add the mouseleave handler to the bounding circle.
  d3.select("#container").on("mouseleave", mouseleave);

  // Get total size of the tree = value of root node from partition.
  totalSize = path.node().__data__.value;
 }
87568
def create_widget(self):
        
        d = self.declaration
        self.widget = View(self.get_context(), None, d.style)
446454
def fig_to_geojson(fig=None, **kwargs):
    
    if fig is None:
        fig = plt.gcf()
    renderer = LeafletRenderer(**kwargs)
    exporter = Exporter(renderer)
    exporter.run(fig)

    return renderer.geojson()
1196911
public function generatePopup()
    {
        $GLOBALS['TL_JAVASCRIPT']['cca.dc-general.vanillaGeneral'] = 'bundles/ccadcgeneral/js/vanillaGeneral.js';

        $environment = $this->getEnvironment();
        $translator  = $environment->getTranslator();
        $template    = new ContaoBackendViewTemplate('widget_treepicker_popup');

        $icon = new GenerateHtmlEvent($this->titleIcon);
        $environment->getEventDispatcher()->dispatch(ContaoEvents::IMAGE_GET_HTML, $icon);

        $template
            ->setTranslator($translator)
            ->set('id', 'tl_listing')
            ->set('name', $this->strName)
            ->set('class', ($this->strClass ? ' ' . $this->strClass : ''))
            ->set('icon', $icon->getHtml())
            ->set('title', $translator->translate($this->title ?: 'MSC.treePicker', '', [$this->sourceName]))
            ->set('fieldType', $this->fieldType)
            ->set('resetSelected', $translator->translate('MSC.resetSelected'))
            ->set('selectAll', $translator->translate('MSC.selectAll'))
            ->set('values', StringUtil::deserialize($this->varValue, true));

        // Create Tree Render with custom root points.
        $tree = '';
        foreach ($this->getRootIds() as $pid) {
            $tree .= $this->generateTreeView($this->loadCollection($pid), 'tree');
        }

        $template->set('tree', $tree);

        // Load the fonts for the drag hint.
        $GLOBALS['TL_CONFIG']['loadGoogleFonts'] = true;

        return $template->parse();
    }
1290597
function exports(_selection) {
            _selection.each(function(_data) {
                dataPoints = cleanData(_data);

                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;

                buildScales();
                buildSVG(this);
                buildAxis();
                buildVoronoi();
                drawAxis();
                drawGridLines();
                initHighlightComponents();
                drawDataPoints();
                drawMaskingClip();

                if (hasTrendline) {
                    drawTrendline(calcLinearRegression());
                }

                addMouseEvents();
            });
        }
50978
Widget createWidget() {

        if (isTrue(m_jsonConfig, CmsDataViewConstants.CONFIG_PREVIEW)) {
            return new CmsDataViewPreviewWidget(
                m_config,
                m_valueAccessor,
                new CmsDataViewPreviewWidget.ContentImageLoader());
        } else {
            I_ImageProvider provider = null;
            CmsDataViewValue val = m_valueAccessor.getValue();
            JSONValue iconVal = m_jsonConfig.get(CmsDataViewConstants.CONFIG_ICON);
            if ((iconVal != null) && (iconVal.isString() != null)) {
                provider = new CmsDataViewPreviewWidget.SimpleImageLoader(iconVal.isString().stringValue());
            }
            return new CmsDataViewPreviewWidget(m_config, m_valueAccessor, provider);
        }

    }
333818
def create_widget(self):
        
        d = self.declaration
        self.widget = DrawerLayout(self.get_context(),  None, d.style)
496522
def _generate_view(self, method, endpoint):
        

        def new_view(**kwargs):
            if method == Method.GET:
                data = request.args
            else:
                content_length = request.headers.get('content-length', 0)
                if content_length and int(content_length) > 0:
                    content_type = request.headers.get('content-type', None)
                    if content_type != 'application/vnd.api+json':
                        data = MissingContentTypeError().data
                        data = json.dumps(data, cls=JSONAPIEncoder)
                        response = make_response(data)
                        response.status_code = 409
                        response.content_type = 'application/vnd.api+json'
                        return response
                    data = request.get_json(force=True)
                else:
                    data = None

            event_kwargs = {
                'method': method,
                'endpoint': endpoint,
                'data': data,
                'req_args': kwargs
            }
            results = self.on_request.send(self, **event_kwargs)
            data = override(data, results)

            args = [self.sqla.session, data, kwargs['api_type']]
            if 'obj_id' in kwargs.keys():
                args.append(kwargs['obj_id'])
            if 'relationship' in kwargs.keys():
                args.append(kwargs['relationship'])

            try:
                attr = '{}_{}'.format(method.name, endpoint.name).lower()
                handler = getattr(self.serializer, attr)
                handler_chain = list(self._handler_chains.get((
                    kwargs['api_type'], method, endpoint), []))
                handler_chain.append(handler)
                chained_handler = self._call_next(handler_chain)
                response = chained_handler(*args)
                results = self.on_success.send(self,
                                               response=response,
                                               **event_kwargs)
                response = override(response, results)
            except BaseError as exc:
                self.sqla.session.rollback()
                results = self.on_error.send(self, error=exc, **event_kwargs)
                response = override(exc, results)
            rendered_response = make_response('')
            if response.status_code != 204:
                data = json.dumps(response.data, cls=self.json_encoder)
                rendered_response = make_response(data)
            rendered_response.status_code = response.status_code
            rendered_response.content_type = 'application/vnd.api+json'
            results = self.on_response.send(self,
                                            response=rendered_response,
                                            **event_kwargs)
            return override(rendered_response, results)

        return new_view
613947
def createWidgets(self):
        #create the panels for the tabs
        PanelAssembly = wx.Panel(self.nb)
        boxAssembly = wx.BoxSizer(wx.VERTICAL)
        PanelAssembly.SetAutoLayout(True)
        PanelAssembly.SetSizer(boxAssembly)
        PanelAssembly.Layout()

        PanelEngine = wx.Panel(self.nb)
        boxEngine = wx.BoxSizer(wx.VERTICAL)
        PanelEngine.SetAutoLayout(True)
        PanelEngine.SetSizer(boxEngine)
        PanelEngine.Layout()

        PanelTakeoff = wx.Panel(self.nb)
        boxTakeoff = wx.BoxSizer(wx.VERTICAL)
        PanelTakeoff.SetAutoLayout(True)
        PanelTakeoff.SetSizer(boxTakeoff)
        PanelTakeoff.Layout()

        PanelCruise = wx.Panel(self.nb)
        boxCruise = wx.BoxSizer(wx.VERTICAL)
        PanelCruise.SetAutoLayout(True)
        PanelCruise.SetSizer(boxCruise)
        PanelCruise.Layout()

        PanelDrop = wx.Panel(self.nb)
        boxDrop = wx.BoxSizer(wx.VERTICAL)
        PanelDrop.SetAutoLayout(True)
        PanelDrop.SetSizer(boxDrop)
        PanelDrop.Layout()

        PanelLanding = wx.Panel(self.nb)
        boxLanding = wx.BoxSizer(wx.VERTICAL)
        PanelLanding.SetAutoLayout(True)
        PanelLanding.SetSizer(boxLanding)
        PanelLanding.Layout()

        PanelShutdown = wx.Panel(self.nb)
        boxShutdown = wx.BoxSizer(wx.VERTICAL)
        PanelShutdown.SetAutoLayout(True)
        PanelShutdown.SetSizer(boxShutdown)
        PanelShutdown.Layout()

        #add the data to the individual tabs

        ''''''
        for key in self.beforeAssemblyList:
            if self.beforeAssemblyList[key] == 0:
                disCheckBox = wx.CheckBox(PanelAssembly, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxAssembly.Add(disCheckBox)
            if self.beforeAssemblyList[key] == 2:
                boxAssembly.Add(wx.CheckBox(PanelAssembly, wx.ID_ANY, key))

        self.AssemblyButton = wx.Button(PanelAssembly, wx.ID_ANY, "Close final hatches")
        boxAssembly.Add(self.AssemblyButton)

        '''before Engine Start checklist'''
        for key in self.beforeEngineList:
            if self.beforeEngineList[key] == 0:
                disCheckBox = wx.CheckBox(PanelEngine, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxEngine.Add(disCheckBox)
            if self.beforeEngineList[key] == 2:
                boxEngine.Add(wx.CheckBox(PanelEngine, wx.ID_ANY, key))

        self.EngineButton = wx.Button(PanelEngine, wx.ID_ANY, "Ready for Engine start")
        boxEngine.Add(self.EngineButton)

        '''before takeoff checklist'''
        for key in self.beforeTakeoffList:
            if self.beforeTakeoffList[key] == 0:
                disCheckBox = wx.CheckBox(PanelTakeoff, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxTakeoff.Add(disCheckBox)
            if self.beforeTakeoffList[key] == 2:
                boxTakeoff.Add(wx.CheckBox(PanelTakeoff, wx.ID_ANY, key))

        self.TakeoffButton = wx.Button(PanelTakeoff, wx.ID_ANY, "Ready for Takeoff")
        boxTakeoff.Add(self.TakeoffButton)

        '''before cruise/AUTO checklist'''
        for key in self.beforeCruiseList:
            if self.beforeCruiseList[key] == 0:
                disCheckBox = wx.CheckBox(PanelCruise, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxCruise.Add(disCheckBox)
            if self.beforeCruiseList[key] == 2:
                boxCruise.Add(wx.CheckBox(PanelCruise, wx.ID_ANY, key))

        self.CruiseButton = wx.Button(PanelCruise, wx.ID_ANY, "Ready for Cruise/AUTO")
        boxCruise.Add(self.CruiseButton)

        '''before bottle drop checklist'''
        for key in self.bottleDropList:
            if self.bottleDropList[key] == 0:
                disCheckBox = wx.CheckBox(PanelDrop, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxDrop.Add(disCheckBox)
            if self.bottleDropList[key] == 2:
                boxDrop.Add(wx.CheckBox(PanelDrop, wx.ID_ANY, key))

        self.DropButton = wx.Button(PanelDrop, wx.ID_ANY, "Ready for Bottle Drop")
        boxDrop.Add(self.DropButton)

        '''before landing checklist'''
        for key in self.beforeLandingList:
            if self.beforeLandingList[key] == 0:
                disCheckBox = wx.CheckBox(PanelLanding, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxLanding.Add(disCheckBox)
            if self.beforeLandingList[key] == 2:
                boxLanding.Add(wx.CheckBox(PanelLanding, wx.ID_ANY, key))

        self.LandingButton = wx.Button(PanelLanding, wx.ID_ANY, "Ready for Landing")
        boxLanding.Add(self.LandingButton)

        '''before shutdown checklist'''
        for key in self.beforeShutdownList:
            if self.beforeShutdownList[key] == 0:
                disCheckBox = wx.CheckBox(PanelShutdown, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxShutdown.Add(disCheckBox)
            if self.beforeShutdownList[key] == 2:
                boxShutdown.Add(wx.CheckBox(PanelShutdown, wx.ID_ANY, key))

        self.ShutdownButton = wx.Button(PanelShutdown, wx.ID_ANY, "Ready for Shutdown")
        boxShutdown.Add(self.ShutdownButton)

        #and add in the tabs
        self.nb.AddPage(PanelAssembly, "1. During Assembly")
        self.nb.AddPage(PanelEngine, "2. Before Engine Start")
        self.nb.AddPage(PanelTakeoff, "3. Before Takeoff")
        self.nb.AddPage(PanelCruise, "4. Before Cruise/AUTO")
        self.nb.AddPage(PanelDrop, "5. Before Bottle Drop")
        self.nb.AddPage(PanelLanding, "6. Before Landing")
        self.nb.AddPage(PanelShutdown, "7. Before Shutdown")
70333
function exports(_selection) {
            _selection.each(function(_data) {
                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;
                data = cleanData(_data);

                buildLayout();
                buildColorScale();
                buildShape();
                buildSVG(this);
                drawSlices();
                initTooltip();

                if (highlightedSliceId) {
                    initHighlightSlice();
                }
                if (isEmpty && emptyDataConfig.showEmptySlice) {
                    drawEmptySlice();
                }
            });
        }
788045
def _viz_prototype(self, vis_fn):
        ''' 
        '''
        def _viz_logger(*args, **kwargs):
            self.win = vis_fn(*args,
                              win=self.win,
                              env=self.env,
                              opts=self.opts,
                              **kwargs)
        return _viz_logger
1156845
function exports(_selection) {
            _selection.each(function (_data) {
                data = cleanData(_data);

                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;

                buildScales();
                buildSVG(this);
                drawDayLabels();
                drawHourLabels();
                drawBoxes();
            });
        }
1291053
def generate_html():
    
    html_file = open(html_filename, "w")
    html_file.write("<html><body>")
    html_file.write("<h1>Here are some graphs for you!</h1>")
    for image in [lines_filename, bars_filename, histogram_filename]:
        html_file.write("<div><h2>{0}</h2><img src='{0}' /></div>".format(image))
    html_file.write("</body></html>")
    html_file.close()
548266
def action_visualize(args,
                     fromshell=False,
                     path=None,
                     title="",
                     viztype="",
                     theme="",
                     verbose=False):
    

    from ..ontodocs.builder import ask_visualization, select_visualization, VISUALIZATIONS_LIST, build_visualization

    if fromshell:
        ontouri = args
        islocal = True
    else:
        ontouri = args[0]
        islocal = False

    # select a visualization
    if viztype:
        viztype = select_visualization(viztype)
    else:
        viztype = ask_visualization()
        if viztype == "":
            return None
        # raise SystemExit, 1

    # 2017-01-23: bypass pickled stuff as it has wrong counts etc..
    # get ontospy graph
    printDebug("Loading graph...", dim=True)
    g = Ontospy(ontouri, verbose=verbose)

    # put in home folder by default: <ontouri>/<viztype>/files..
    if not path:
        from os.path import expanduser
        home = expanduser("~")
        onto_path = slugify(unicode(ontouri))
        viz_path = slugify(unicode(VISUALIZATIONS_LIST[viztype]['Title']))
        path = os.path.join(home, "ontospy-viz/" + onto_path + "/" + viz_path)
        if not os.path.exists(path):
            os.makedirs(path)

    # url  = build_viz(ontouri, g, viztype, path)
    printDebug("Building visualization...", dim=True)
    url = build_visualization(ontouri, g, viztype, path, title, theme)

    return url
243802
function localExport(opt) {
    var ind = _.reGet(/\d/)(opt.chart.renderTo);
    _.assign(opt, {
      'exporting': {
        'buttons': {
          'contextButton': {
            'y': -10,
            'menuItems': [{
              'text': 'Save as PNG',
              onclick: function() {
                this.createCanvas(opt.title, 'png', ind);
              },
              'separator': false
            }, {
              'text': 'Save as JPEG',
              onclick: function() {
                this.createCanvas(opt.title, 'jpeg', ind);
              },
              'separator': false
            }]
          }
        }
      }
    })
    return opt;
  }