Setup our canvas.

@return Canvas
197177
protected Element setupCanvas() {
    final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN);
    this.layer = setupCanvas(svgp, this.proj, margin, getWidth(), getHeight());
    return layer;
  }
1180143
protected function setUp()
    {
        $this->services['service']->register(array(
            'config' => Config::class,
            'routingFactory' => function(){ return new Factory();},
            'map' => function() { return $this['routingFactory']->createGroup();},
            'request' => function(){ return isset($_SERVER['REQUEST_URI']) ? ServerRequest::createFromGlobals() : null;},
            'url' => function() { return $this->create('url.factory', array($this->map, $this->request ? : null, $this->config->get('app.url', null)));},
        ));

        $this->services['factory']->register(array(
            'runtime.context' => Context::class,
            'runtime.response' => function(){ return Response::createEmptyResponse();},
            'url.factory' => UrlFactory::class
        ));

        $this->map->addExecuteHandler('closure', ClosureHandler::class);
    }
872165
protected function setupViewer()
    {
        $this->app->bindShared('viewer', function ($app) {
            $view = $app['view'];
            $credentials = $app['credentials'];
            $navigation = $app['navigation'];
            $pageprovider = $app['pageprovider'];
            $name = $app['config']['platform.name'];
            $inverse = $app['config']['theme.inverse'];

            return new Classes\Viewer($view, $credentials, $navigation, $pageprovider, $name, $inverse);
        });
    }
278640
private function setup()
    {
        $this->runner = $this->specHelper->getRunner();

        $this->setupWorkspace();
        $this->setupTargets();

        // call initializers
        foreach ($this->application->config('spec.initializers.*') as $initializer) {
            $initializer($this->application);
        }
    }
66571
private function setUpLayout()
    {
        if (Layout::filename()) {
            return;
        }

        Layout::filename('layout' . $this->divisionPostfix . '.php');

        Layout::addJsMgr('layout' . ($this->_division === '' ? '' : '_' . $this->_division));
        Layout::addCss('layout' . $this->divisionPostfix . '.css');

        $fileBaseName = $this->_module . '_' . $this->_method;
        // add default js manager
        $jsPath   = $this->divisionPath . '/js/managers/';
        $jsName   = $this->divisionPrefix . $fileBaseName;
        $fileName = MODULES . $jsPath . $jsName . '_mgr.js';
        if (file_exists($fileName)) {
            Layout::addJsMgr($jsName, MOD . $jsPath);
        }

        // add default css
        $cssPath  = $this->divisionPath . '/css/';
        $cssName  = $this->divisionPrefix . $fileBaseName . '.css';
        $fileName = MODULES . $cssPath . $cssName;
        if (file_exists($fileName)) {
            Layout::addCss($cssName, MOD . $cssPath);
        }
    }
83862
public function init()
    {
        $this->setupSupportedArgs($this->supportedArgs);
        $this->parseArgv($this->argv);
        return $this;
    }
1233411
protected function setupAssets()
    {
        $this->mergeConfigFrom($config = __DIR__ . '/config/datatables.php', 'datatables');

        if ($this->app->runningInConsole()) {
            $this->publishes([$config => config_path('datatables.php')], 'datatables');
        }
    }
864740
protected function setup() {
		// Clear global hashes.
		$this->urls        = $this->predef_urls;
		$this->titles      = $this->predef_titles;
		$this->html_hashes = array();
		$this->in_anchor   = false;
	}
795680
def attach(self, canvas):
        """"""
        self.canvas = canvas

        @canvas.connect
        def on_visual_added(e):
            self.update_program(e.visual.program)
168102
public function draw()
    {

        $this->drawYaxis();

        if ($this->connect_points == 1) {
            $this->connectPoints();
        }

        foreach ($this->points as $point) {

            if ($this->y_axis_hints == 1) {
                imagedashedline($this->im, $point->x, $this->height, $point->x,
                    0, $this->ink['axis']);
            } else {

                //add axis line
                imageline($this->im, $point->x, $this->graph_height, $point->x,
                    $this->graph_height + 10, $this->ink['axis']);
            }

            //add axis label
            imagestring($this->im, 1, $point->x + 5, $this->graph_height + 10,
                $point->label, $this->ink['text']);

            //don't plot actual point if it is null
            if (is_null($point->value)) {
                continue;
            }

            //plot point
            imagefilledellipse($this->im, $point->x, $point->y, 7, 7,
                $this->ink['point']);

            //add point label
            if ($point->y <= 5) {
                $posy = $point->y + 5;
            } elseif ($point->y >= $this->graph_height - 5) {
                $posy = $point->y - 20;
            } else {
                $posy = $point->y - 15;
            }

            imagestring($this->im, 3, $point->x + 10, $posy, $point->value,
                $this->ink['point']);
        }
    }
1190229
function Canvas(width, height) {
  var canvas = new NodeCanvas(width, height);
  var ctx = canvas.getContext('2d');
  this.canvas = canvas;
  this.ctx = ctx;
}
266809
function() {
        canvasWidth = $(window).width();
        canvasHeight = $(window).height();
        if (supportsCanvas) {
          $canvas[0].width = canvasWidth;
          $canvas[0].height = canvasHeight;
        }
        $container.width(canvasWidth);
        $container.height(canvasHeight);
      }
308107
function() {
        var c = this._canvas;
        c.width = Crafty.viewport.width;
        c.height = Crafty.viewport.height;

        var gl = this.context;
        gl.viewportWidth = c.width;
        gl.viewportHeight = c.height;
    }
1080259
protected function setupRootNode()
    {
        $builder = new TreeBuilder();
        $this->rootNode = $builder->root($this->getBundleName());

        return $this;
    }
166860
public function setupClient()
    {
        /* Return if already set */
        if ($this->client)
            return $this;

        /* Set the options for the SOAP request */
        $sslContext = array(
            'ssl' => array(
                'allow_self_signed' => false,
                'verify_peer' => false /* Temporary fix */
            )
        );

        $soapArguments = array(
            'location' => $this->service,
            'encoding' => 'UTF-8',
            'cache_wsdl' => 'WSDL_CACHE_NONE',
            'stream_context' => stream_context_create($sslContext)
        );

        /* Start a new client */
        $this->client = new SoapClient($this->service, $soapArguments);

        /* Client configuration */
        $this->client->soap_defencoding = "utf-8";

        return $this;
    }
962718
private function createBackground()
    {

        imagefilledrectangle($this->im, 0, 0, $this->width, $this->height,
            $this->ink['black']);
    }
444065
private Canvas buildCanvas() {
    Canvas canvas = new Canvas();
    Dimension dimension = getSize();
    Point point = coordinates.inViewPort();
    int x = point.x;
    int y = point.y;

    // Avoid internal error by making sure we have some width and height
    int w = Math.max(dimension.width, 1);
    int h = Math.max(dimension.height, 1);

    canvas.setX(x);
    canvas.setY(y);
    canvas.setHeight(h);
    canvas.setWidth(w);
    canvas.setViewPortRelative(true);

    return canvas;
  }