end draw function Placed here because it needs to be accessed from multiple locations
976351
function drawDonutHole(layer) {
			if (options.series.pie.innerRadius > 0) {

				// subtract the center

				layer.save();
				var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
				layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
				layer.beginPath();
				layer.fillStyle = options.series.pie.stroke.color;
				layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
				layer.fill();
				layer.closePath();
				layer.restore();

				// add inner stroke

				layer.save();
				layer.beginPath();
				layer.strokeStyle = options.series.pie.stroke.color;
				layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
				layer.stroke();
				layer.closePath();
				layer.restore();

				// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
			}
		}
1058488
function() {
        for ( var i = 0; i < this._items.length; i++ ) {
            this._items[i].draw();
        }

        this._needsDraw = false;
    }
525902
function endSelection() {
          var rng = doc.selection.createRange();

          // If the range is collapsed then use the last start range
          if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {
            startRng.select();
          }

          dom.unbind(doc, 'mouseup', endSelection);
          dom.unbind(doc, 'mousemove', selectionChange);
          startRng = started = 0;
        }
76518
function draw(renderer, text, x, y) {
         // allows to provide backward compatibility when
         // adding Bitmap Font to an object container
         if (typeof this.ancestor === "undefined") {
           // update cache
           this.setText(text); // force update bounds

           this.update(0); // save the previous global alpha value

           var _alpha = renderer.globalAlpha();

           renderer.setGlobalAlpha(_alpha * this.getOpacity());
         } else {
           // added directly to an object container
           x = this.pos.x;
           y = this.pos.y;
         }

         var strings = ("" + this._text).split("\n");

         var lX = x;
         var stringHeight = measureTextHeight(this);
         var maxWidth = 0;

         for (var i = 0; i < strings.length; i++) {
           x = lX;
           var string = me.utils.string.trimRight(strings[i]); // adjust x pos based on alignment value

           var stringWidth = measureTextWidth(this, string);

           switch (this.textAlign) {
             case "right":
               x -= stringWidth;
               break;

             case "center":
               x -= stringWidth * 0.5;
               break;

             default:
               break;
           } // adjust y pos based on alignment value


           switch (this.textBaseline) {
             case "middle":
               y -= stringHeight * 0.5;
               break;

             case "ideographic":
             case "alphabetic":
             case "bottom":
               y -= stringHeight;
               break;

             default:
               break;
           } // update initial position if required


           if (this.isDirty === true && typeof this.ancestor === "undefined") {
             if (i === 0) {
               this.pos.y = y;
             }

             if (maxWidth < stringWidth) {
               maxWidth = stringWidth;
               this.pos.x = x;
             }
           } // draw the string


           var lastGlyph = null;

           for (var c = 0, len = string.length; c < len; c++) {
             // calculate the char index
             var ch = string.charCodeAt(c);
             var glyph = this.fontData.glyphs[ch];
             var glyphWidth = glyph.width;
             var glyphHeight = glyph.height;
             var kerning = lastGlyph && lastGlyph.kerning ? lastGlyph.getKerning(ch) : 0; // draw it

             if (glyphWidth !== 0 && glyphHeight !== 0) {
               // some browser throw an exception when drawing a 0 width or height image
               renderer.drawImage(this.fontImage, glyph.x, glyph.y, glyphWidth, glyphHeight, x + glyph.xoffset, y + glyph.yoffset * this.fontScale.y, glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y);
             } // increment position


             x += (glyph.xadvance + kerning) * this.fontScale.x;
             lastGlyph = glyph;
           } // increment line


           y += stringHeight;
         }

         if (typeof this.ancestor === "undefined") {
           // restore the previous global alpha value
           renderer.setGlobalAlpha(_alpha);
         } // clear the dirty flag


         this.isDirty = false;
       }
1198104
function(after) {

    var
      context = this.ctx,
      i;

    E.fire(this.el, 'flotr:beforedraw', [this.series, this]);

    if (this.series.length) {

      context.save();
      context.translate(this.plotOffset.left, this.plotOffset.top);

      for (i = 0; i < this.series.length; i++) {
        if (!this.series[i].hide) this.drawSeries(this.series[i]);
      }

      context.restore();
      this.clip();
    }

    E.fire(this.el, 'flotr:afterdraw', [this.series, this]);
    if (after) after();
  }
1317078
def end(self):
        """"""
        if self.lastUrl is not None:
            self.html.write(u'</li>\n')
        if self.lastComic is not None:
            self.html.write(u'</ul>\n')
        self.html.write(u'</ul>\n')
        self.addNavLinks()
        self.html.close()
461763
def draw(self):
        
        # Assumes that self.index has been set earlier (typically in update method)
        # it is used as the index of the current image/endTime/loc
        theImage = self.imagesList[self.index]  # choose the image to show

        if theImage is None:  # if there is no image to show
            return

        if self.visible:
            theOffset = self.offsetsList[self.index]
            theLoc = ((self.loc[0] + theOffset[0]), (self.loc[1] + theOffset[1]))
            self.window.blit(theImage, theLoc)
81156
def end(self):
        """"""
        for comic in self.data:
            with codecs.open(self.jsonFn(comic), 'w', self.encoding) as f:
                json.dump(self.data[comic], f, indent=2, separators=(',', ': '), sort_keys=True)
539052
function furkotTrip() {
  var form, stops;

  function plan(data) {
    if (!form) {
      form = createForm();
    }
    stops.value = JSON.stringify(data);
    return form.submit();
  }

  function getUrl(data) {
    if (data) {
      if (Array.isArray(data)) {
        data = data.map(function (stop, i) {
          return toQuery(stop, 'stops[' + i + ']');
        }).join('&');
      }
      else {
        data = toQuery(data, 'stop');
      }
      if (data) {
        data = '?' + data;
      }
    }
    return destination + (data || '');
  }

  function toQuery(data, prefix) {
    return Object.keys(data).map(toParam, {
      data: data,
      prefix: prefix
    }).join('&');
  }

  function toParam(key) {
    var data = this.data, prefix = this.prefix + '[' + key + ']';
    if (typeof data[key] === 'object') {
      return toQuery(data[key], prefix);
    }
    return [prefix, encodeURIComponent(data[key] || '')].join('=');
  }

  function target() {
    var hidden = window.locationbar && !window.locationbar.visible;
    return hidden ? '_blank' : '_top';
  }

  function createForm() {
    var form = document.createElement('form');
    form.style.display = 'none';
    form.action = destination;
    form.method = 'post';
    form.target = target();
    stops = document.createElement('input');
    stops.name = 'stops';
    form.appendChild(stops);
    // Firefox needs form in DOM
    document.body.appendChild(form);
    return form;
  }

  return {
    plan: plan,
    getUrl: getUrl
  };
}
994873
protected void fireDrawingEnd() {
		final ListenerCollection<EventListener> list = this.listeners;
		if (list != null) {
			for (final DrawingListener listener : list.getListeners(DrawingListener.class)) {
				listener.onDrawingEnd();
			}
		}
	}
923427
function exports(_selection) {
            _selection.each(function(_data){
                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;
                data = cleanData(_data);

                buildColorScale();
                buildSVG(this);

                if (isHorizontal) {
                    drawHorizontalLegend();
                } else {
                    drawVerticalLegend();
                }

                if (highlightedEntryId) {
                    cleanFadedLines();
                    fadeLinesBut(highlightedEntryId);
                }
            });
        }
1339049
function Conrec(drawContour) {
    if (!drawContour) {
      var c = this;
      c.contours = {};
      /**
       * drawContour - interface for implementing the user supplied method to
       * render the countours.
       *
       * Draws a line between the start and end coordinates.
       *
       * @param startX    - start coordinate for X
       * @param startY    - start coordinate for Y
       * @param endX      - end coordinate for X
       * @param endY      - end coordinate for Y
       * @param contourLevel - Contour level for line.
       */
      this.drawContour = function(startX, startY, endX, endY, contourLevel, k) {
        var cb = c.contours[k];
        if (!cb) {
          cb = c.contours[k] = new ContourBuilder(contourLevel);
        }
        cb.addSegment({x: startX, y: startY}, {x: endX, y: endY});
      }
      this.contourList = function() {
        var l = [];
        var a = c.contours;
        for (var k in a) {
          var s = a[k].s;
          var level = a[k].level;
          while (s) {
            var h = s.head;
            var l2 = [];
            l2.level = level;
            l2.k = k;
            while (h && h.p) {
              l2.push(h.p);
              h = h.next;
            }
            l.push(l2);
            s = s.next;
          }
        }
        l.sort(function(a, b) { return a.k - b.k });
        return l;
      }
    } else {
      this.drawContour = drawContour;
    }
    this.h  = new Array(5);
    this.sh = new Array(5);
    this.xh = new Array(5);
    this.yh = new Array(5);
  }
79200
function handleBrushEnd() {
            if (!d3Selection.event.sourceEvent) {
                return; // Only transition after input.
            }

            let dateExtentRounded = [null, null];
            const selection = d3Selection.event.selection;

            if (selection) {
                let dateExtent = selection.map(xScale.invert);

                dateExtentRounded = dateExtent.map(timeIntervals[roundingTimeInterval].round);

                // If empty when rounded, use floor & ceil instead.
                if (dateExtentRounded[0] >= dateExtentRounded[1]) {
                    dateExtentRounded[0] = timeIntervals[roundingTimeInterval].floor(dateExtent[0]);
                    dateExtentRounded[1] = timeIntervals[roundingTimeInterval].offset(dateExtentRounded[0]);
                }

                d3Selection.select(this)
                    .transition()
                    .call(d3Selection.event.target.move, dateExtentRounded.map(xScale));
            }

            dispatcher.call('customBrushEnd', this, dateExtentRounded);
        }
954278
function () {
            if (this.length) {
                var gl = this.gl;

                // Copy data into stream buffer
                var len = this.length * ELEMENT_SIZE * ELEMENTS_PER_QUAD;
                gl.bufferData(
                    gl.ARRAY_BUFFER,
                    this.stream.subarray(0, len),
                    gl.STREAM_DRAW
                );

                // Draw the stream buffer
                gl.drawElements(
                    gl.TRIANGLES,
                    this.length * INDICES_PER_QUAD,
                    gl.UNSIGNED_SHORT,
                    0
                );

                this.sbIndex = 0;
                this.length = 0;
            }
        }
794288
def draw_line(x1, y1, x2, y2)
      @context.drawLine(x1, y1, x2, y2)
    end
1062442
function drawLoop () {
  ctx.clearRect(0, 0, canvas.width, canvas.height)

  var centerX = canvas.width / 2
  var centerY = canvas.height / 2

  // draw circle
  ctx.beginPath()
  ctx.arc(centerX, centerY, 100, 0, 2 * Math.PI, false)
  ctx.fillStyle = 'yellow'
  ctx.fill()

  // draw three oscilloscopes in different positions and colors
  ctx.strokeStyle = 'lime'
  scope.draw(ctx, 0, 0, centerX, centerY)

  ctx.strokeStyle = 'cyan'
  scope.draw(ctx, centerX, 0, centerX, centerY)

  ctx.strokeStyle = 'red'
  scope.draw(ctx, 0, centerY, null, centerY)

  window.requestAnimationFrame(drawLoop)
}
41515
function drawLinearMajorTicks(context, options) {
    let [hasLeft, hasRight] = drawings.prepareTicks(options);
    let lineWidth = 2;
    let valuePerNonExactTick = (options.maxValue - options.minValue) /
        (options.majorTicks.length - 1);
    let colors = options.colorMajorTicks instanceof Array ?
        options.colorMajorTicks :
        new Array(options.majorTicks.length).fill(
            options.colorStrokeTicks || options.colorMajorTicks);
    let ticks = options.exactTicks ? options.majorTicks :
        options.majorTicks.map((tick, i) => {
            return options.minValue + valuePerNonExactTick * i;
        });

    drawLinearTicks(context, colors, ticks, options.minValue, options.maxValue,
        hasLeft, hasRight, lineWidth, options.ticksWidth / 100);

    if (options.strokeTicks) {
        let {isVertical, length, width, barWidth, barMargin, barOffset, X, Y,
            ticksLength, pixelRatio, ticksPadding} = context.barDimensions;
        let rightTicks = (width - barWidth) / 2 + barWidth +
            ticksPadding * width;
        let leftTicks = (width - barWidth) / 2 - ticksPadding * width;
        let sX, sY, eX, eY;

        context.strokeStyle = options.colorStrokeTicks || colors[0];

        lineWidth *= pixelRatio;

        if (isVertical) {
            sY = Y + length - barMargin - barOffset + lineWidth / 2;
            eY = sY - ticksLength - lineWidth;

            if (hasLeft) {
                //noinspection JSUnresolvedFunction
                eX = sX = round(X + leftTicks);
                drawLinearTickStroke(context, sX, sY, eX, eY);
            }

            if (hasRight) {
                //noinspection JSUnresolvedFunction
                eX = sX = round(X + rightTicks);
                drawLinearTickStroke(context, sX, sY, eX, eY);
            }
        }

        else {
            sX = X + barMargin + barOffset - lineWidth / 2;
            eX = sX + ticksLength + lineWidth;

            if (hasLeft) {
                //noinspection JSUnresolvedFunction
                eY = sY = round(Y + leftTicks);
                drawLinearTickStroke(context, sX, sY, eX, eY);
            }

            if (hasRight) {
                //noinspection JSUnresolvedFunction
                eY = sY = round(Y + rightTicks);
                drawLinearTickStroke(context, sX, sY, eX, eY);
            }
        }
    }
}